DEV Community

Eitamos Ring
Eitamos Ring

Posted on

What I Learned Building a Pure Go PostgreSQL Parser

Why I built it

I needed a PostgreSQL parser that could run inside Go tooling without CGO, external binaries, or runtime dependencies.

What made PostgreSQL parsing harder than expected

  • SQL is not one grammar
  • PostgreSQL has a lot of dialect-specific edge cases
  • AST shape matters more than “can it parse”
  • Error handling becomes a product feature
  • Real-world SQL is uglier than examples

Why pure Go mattered

No CGO, easy installation, works in CI, easy to embed in linters and developer tools.

What 200+ GitHub stars taught me

  • Developers care about boring installation
  • Parser APIs need to be simple
  • Good examples matter more than perfect docs
  • People want tooling, not academic grammar dumps

Where it’s going

This parser is becoming the foundation for Valk Guard, a local-first static analyzer for SQL and ORM usage. No LLM required. It works from ASTs and deterministic rules.

GitHub repo: GitHub repo: https://github.com/ValkDB/postgresparser

Top comments (1)

Some comments may only be visible to logged-in visitors. Sign in to view all comments.