Pure Go PostgreSQL 18.4 SQL and PL/pgSQL parser. No CGO or external parser runtime required. Go 1.25+.
Provides parsing, deparsing, normalization, fingerprints, statement splitting, and query summaries through a pg_query_go-style API.
go get github.com/gosuda/pg18_query_goimport pg "github.com/gosuda/pg18_query_go"
tree, err := pg.Parse("SELECT id FROM accounts WHERE balance > 100")Verified against 49,125 PostgreSQL corpus inputs, 854 PL/pgSQL cases, and upstream API tests. This does not guarantee identical behavior for every input or live-database validation.
Trigger output intentionally fixes malformed JSON in the upstream parser. Other catalog-free PL/pgSQL limitations remain.
CGO_ENABLED=0 go test ./...
go generate ./... # requires Ragel
python3 tools/regenerate_fixtures.py --check # requires Python 3.10+ and a C compilerTests pass on Go 1.25 and 1.27, including race and pointer-safety checks. AST lint findings remain.
BSD-3-Clause. See NOTICE and licenses/ for third-party terms and attribution, including gFire Projects Groups.