PostgreSQL Query Parser
JSON →pgsql-parser is a JavaScript/TypeScript library designed for parsing PostgreSQL SQL queries into an Abstract Syntax Tree (AST) and deparsing ASTs back into SQL. It leverages the actual PostgreSQL C parser, compiled to WebAssembly, to ensure 100% compatibility with PostgreSQL's syntax. The current stable version, as specified, is 17.9.15. The project is part of a broader monorepo that includes related packages like `@pgsql/parser` for multi-version parsing, `@pgsql/deparser` for AST-to-SQL conversion only, and `@pgsql/types` for comprehensive TypeScript definitions of AST nodes. It offers symmetric operations, meaning an AST generated from SQL can be perfectly converted back to the original SQL, and is extensively tested for reliability. This library is ideal for tools requiring deep SQL analysis, modification, or code generation, providing a robust and type-safe foundation for working with PostgreSQL at the AST level. Its release cadence follows the PostgreSQL versioning and related ecosystem packages are frequently updated.
Traffic · last 30 days ↓22% vs prev 7d
top countries 🇺🇸 United States · 🇫🇷 France · 🇫🇮 Finland · 🇨🇦 Canada · 🇩🇪 Germany