Releases: gmr/libpgfmt
v1.2.0
pg_dump style
Adds a new Style::PgDump (pg_dump / pgdump / postgres) that reproduces PostgreSQL's ruleutils.c deparser layout — the output of pg_get_viewdef / pg_get_functiondef. Its correctness bar is byte-idempotency: formatting genuine deparser output returns it unchanged, making it suitable for canonicalizing and diffing catalog-dumped DDL.
Covers views (target lists, all JOIN forms, WHERE/GROUP BY/HAVING/ORDER BY, LIMIT/OFFSET, set operations, CTEs, multi-line CASE, comma-separated FROM, subqueries in expressions / derived tables, DISTINCT ON, FILTER, window frames, LATERAL) and functions (RETURNS scalar/SETOF/TABLE, DEFAULT/OUT/VARIADIC args, grouped behavior attributes, SET, verbatim and SQL-standard RETURN bodies).
Validated by 31 byte-idempotency fixtures captured from genuine deparser output (#13).
v1.1.7
What's Changed
Changed
- Bump
tree-sitter-postgresto 1.2.4, bringing the releasedAT TIME ZONEandE'...'escape-string grammar fixes. Catalog-dumped views (pg_get_viewdefoutput) andLANGUAGE sqlfunction bodies now parse and format without errors.
Fixed (from this release line)
v1.1.6
What's Changed
Fixed
- Format PL/pgSQL constructs that previously rendered incorrectly:
ALIAS FORdeclarations (the target was dropped),RETURN NEXT/RETURN QUERY(the keyword was dropped), andFORloops over a query (the query text afterINwas dropped). (#9)
Changed
- Bump
tree-sitter-postgresto 1.2.3, which adds PL/pgSQL grammar support for multi-word type names (character varying,double precision,timestamp with time zone),DEFAULTinitializers, bareRETURN NEXT, andALIAS FOR $N. (gmr/tree-sitter-postgres#42)
v1.1.5
What's Changed
Fixed
- Fix an infinite-loop hang when formatting PL/pgSQL bodies containing an
IF … END IFstatement.format_stmt_ifnever advanced past the closingIFofEND IF, so anyformat_plpgsqlinput with an IF statement hung. (#8) - Fix corrupted output for decimal literals such as
0.00and0.0(e.g.(0.00)::real→(0 .00)::real,0.0→.0) by upgrading the grammar. (#8)
Changed
- Bump
tree-sitter-postgresto 1.2.2, which fixes afloat_literallexer bug that split decimals like0.00into separate tokens. (gmr/tree-sitter-postgres#41)
v1.1.4
What's Changed
Fixed
- Preserve typed string literals in constant expressions.
INTERVAL '2 days',DATE '...',TIMESTAMP '...',INTERVAL '2' DAY, andINTERVAL(6) '...'previously lost everything after the type keyword (gmr/pgfmt#7)
v1.1.3
v1.1.2
v1.1.1
v1.1.0
What's Changed
Breaking
- Default style changed from river to AWeber
Fixed
- All 7 previously-failing fixture tests now pass — removed
KNOWN_FAILINGmechanism - Typecast
::operator no longer adds spaces ('x' :: TEXT→'x'::TEXT) ARRAY[...]expressions formatted correctlyCAST(expr AS type)converted to PostgreSQLexpr::typenotationCOALESCE,GREATEST,LEASTformatted asFUNC(args)notFUNC ( args )RANK() OVER (...)window functions:OVERclause no longer droppedANY/ALL/SOMEget space before opening parenVALUEpseudo-variable lowercased in domainCHECKconstraints- Redundant parentheses stripped around simple expressions in typecasts
NUMERICtype keyword recognized for proper casing- Bare table aliases always get explicit
ASkeyword TIMESTAMP WITH TIME ZONE/WITHOUT TIME ZONEtypes formatted correctlyCREATE FUNCTIONdollar-quoting:AS $$on same line, body indented,$$on own lineCREATE TABLE WITHno longer duplicatesWITHkeywordCREATE TABLEcolumn constraints (DEFAULT,NOT NULL) no longer lost on nestedColQualListCREATE VIEW ... AStrailing space removedSELECT DISTINCT/DISTINCT ONseparated fromSELECTkeyword for proper river alignment- CTE bodies inherit parent river width for consistent alignment
- Nested
WITHclauses river-aligned inside CTE bodies - Decimal literal fragments merged when split by tree-sitter ERROR nodes
Added
CREATE FOREIGN TABLEformatting with column alignment,SERVER, andOPTIONSblockswrap_case_elsestyle config: AWeber/mattmc3 wrapCASE+ELSE, others keep inline- Style guide links in README for all 7 styles
dump_treeandformat_testdevelopment examples
Full Changelog: v1.0.1...v1.1.0