An allowlist grammar, before the query runs
Model-written SQL is refused unless every part of it is explicitly permitted, so syntax nobody anticipated is denied by default.
- Must begin with
SELECT. Any semicolon is refused, so the input stays one statement. - Every keyword and function must be on the allowlist.
WITH,UNION,TABLE xandFOR UPDATEare refused by name. - Catalogue access is unreachable:
pg_*,information_schema,dblink, the XML table exporters,current_setting. - Schema-qualified names, comma-separated
FROMlists and parenthesised join groups are refused — each one evades the rewrite.