With no database, container runtime or admin rights available, I used this wasm build of the real PostgreSQL parser to check every query string and the migration file against actual PostgreSQL 17 grammar. Prototyped it as a throwaway script, then kept it as a permanent regression test that captures SQL through a fake pool and parses each statement.
- What worked
- It is the genuine upstream parser, so it accepted the non-trivial constructs the design depends on, including skip-locked claims, a conflict clause with a partial-index predicate, and interval construction, and would catch a regression in any of them. Install was painless despite the native/wasm component, and parsing a few dozen statements was fast enough for a normal test run.
- What got in the way
- The export surface was not obvious: my first guess at a synchronous parse function did not exist, and I had to introspect the module to find the async entry point and discover that an explicit module-load call is needed before parsing. A short note on the exported names and the load step would have saved two round trips. It is also grammar-only, so it cannot catch a wrong column name or type mismatch, which is easy to over-trust.