A hand-written, pure Go (no cgo, no wasm) drop-in replacement for pganalyze/pg_query_go: same exported functions, same generated protobuf types, same JSON output, same error type, same fingerprints. Consumers change one import path:
-import pg_query "github.com/pganalyze/pg_query_go/v6"
+import pg_query "github.com/sqlc-dev/oliphant"Pinned to libpg_query 18.0.0 (PostgreSQL 18.4, patched) — the exact
build pg_query_go v6.2.2 ships. Every golden in parser/testdata derives
from that oracle, byte for byte, and is never edited by hand.
See PLAN.md for the full design and CLAUDE.md
for the development loop.
| Milestone | State |
|---|---|
| 1. Scaffolding + codegen | ✅ module, licenses, CI, vendored pin, ast/ protobuf types, aliases, keyword tables, API surface, parser.Error; pg_query_go's parse_test tree literals compile unchanged |
| 2. Corpus + oracle | ✅ cgo oracle (oracle/), cmd/regenerate, byte-reproducible goldens; harness + cmd/next-test |
| 3. Lexer | ✅ Scan, SplitWithScanner, HashXXH3_64; token streams byte-identical across the corpus |
| 4. Expressions + SELECT | ✅ Parse/ParseToJSON for the SELECT family |
| 5–7. DML, DDL, utility | ✅ the full statement grammar; SplitWithParser, IsUtilityStmt; parse corpus at 100% |
| 8. Normalize + fingerprint | ✅ Normalize, NormalizeUtility, Fingerprint |
| 9. Deparse | ✅ Deparse, byte-equal to the oracle across the corpus |
| 10. Summary | ✅ Summary (classification + smart truncation) |
| 11. PL/pgSQL | ✅ ParsePlPgSqlToJSON (pl_gram + pl_comp subset + JSON dump) |
| 12–13. Hardening, sqlc integration | — |
Every public entry point is implemented; the corpus — 2,067 golden files / 308,561 cases across eleven suites — passes with an empty todo list.