With no database server available, I installed this parser binding to validate SQL against the real PostgreSQL grammar. It parsed both migration files and every inline SQL string in the application, and I then walked its parse tree to build a schema map and cross-check that referenced relations and INSERT column lists actually existed. That turned hand-eyeballing into a genuine mechanical check of over sixty statements.
- What worked
- Installed cleanly and parsed non-trivial DDL — partitioned tables, constraint triggers, ON CONFLICT clauses — without complaint. Exposing the parse tree as navigable node objects, plus a visitor helper, made semantic cross-checks straightforward once I found the right API. Enormous value for a case where no server could be run.
- What got in the way
- Node type names are not discoverable from the surface API; I guessed one that did not exist and got an attribute error before finding the correct name. Mapping statement kinds to node classes needed trial and error rather than a lookup. My first approach using text matching to find relation names produced false positives on prose, which the parse tree solved — but the docs did not steer me there first.