pgsql-parser

The PostgreSQL Parser for Node.js

The real PostgreSQL parser for Node.js that interprets and converts PostgreSQL syntax. Uses actual PostgreSQL C parser via WebAssembly for symmetric parsing and deparsing with battle-tested reliability.

Real PostgreSQL Parser

Uses actual PostgreSQL C parser via WebAssembly

Symmetric Operations

Parse SQL to AST and deparse AST back to SQL

Battle-Tested

Tested with 23,000+ SQL statements

pgsql-parser Features

Professional-grade PostgreSQL parsing and AST manipulation

Authentic PostgreSQL Parser

Uses the actual PostgreSQL C parser via WebAssembly, ensuring 100% compatibility with PostgreSQL syntax.

Symmetric Parsing and Deparsing

Parse SQL statements to AST and convert AST back to SQL with perfect round-trip fidelity.

Battle-Tested Reliability

Extensively tested with over 23,000 SQL statements to ensure robust parsing of complex queries.

AST Manipulation

Programmatically modify, analyze, and transform PostgreSQL queries through Abstract Syntax Tree manipulation.

WebAssembly Performance

Leverages WebAssembly for near-native performance while maintaining JavaScript accessibility.

TypeScript Support

Full TypeScript definitions for AST nodes, enabling type-safe query manipulation and analysis.

Basic SQL Parsing and Deparsing

Parse SQL statements into AST and convert them back to SQL with perfect fidelity using the real PostgreSQL parser.

AST Manipulation and Transformation

Modify SQL queries by manipulating their AST representation, enabling powerful query transformation capabilities.