Converts parsed PL/pgSQL function ASTs back into SQL source code. Part of the pgsql-parser ecosystem. v0.7.7 (stable, weekly releases). Key differentiator: round-tripping from AST to SQL with high fidelity, supporting PostgreSQL's PL/pgSQL dialect including complex control structures. Depends on libpg_query for parsing; you must parse first with pgsql-parser.
npm install plpgsql-deparserNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Parses a PL/pgSQL function and then deparses it back to SQL.
Always use parsePlPgSql from pgsql-parser.
Check the documentation for known limitations; test round-tripping.
Ensure pgsql-parser is also v0.7.x.
import { deparse } from 'plpgsql-deparser'Use pgsql-parser's parsePlPgSql to parse the SQL before deparsing.
npm install plpgsql-deparser