Skip to content

Releases: gmr/pgfmt

v2.1.7

15 Jun 23:09
@gmr gmr
4c5b805

Choose a tag to compare

Bumps libpgfmt to 1.2.0, adding the pg_dump style: pgfmt --style pg_dump (also pgdump / postgres) reproduces PostgreSQL's ruleutils.c deparser layout (the output of pg_get_viewdef / pg_get_functiondef), byte-idempotent on genuine deparser output.

v2.1.6

15 Jun 19:33
@gmr gmr
30040eb

Choose a tag to compare

What's Changed

Changed

  • Bump libpgfmt to 1.1.7 (now on tree-sitter-postgres 1.2.4), bringing support for AT TIME ZONE expressions and E'...' escape strings, multi-word type names in :: casts, and graceful handling of LANGUAGE sql function bodies. Catalog-dumped views and functions that previously failed now format correctly.

v2.1.5

15 Jun 17:06
@gmr gmr
bee17c6

Choose a tag to compare

What's Changed

Changed

  • Bump libpgfmt to 1.1.6, which adds PL/pgSQL formatting support for multi-word type names (character varying, double precision, timestamp with time zone), DEFAULT initializers, ALIAS FOR $N, bare RETURN NEXT/RETURN QUERY, and FOR-over-query loops, and fixes decimal-literal handling. (libpgfmt v1.1.6)

v2.1.4

12 Jun 16:47
@gmr gmr
f66fcdd

Choose a tag to compare

What's Changed

Fixed

  • Typed string literals are no longer dropped during formatting. SELECT INTERVAL '2 days' previously formatted to SELECT INTERVAL; this affected INTERVAL, DATE, TIMESTAMP, interval qualifiers (INTERVAL '2' DAY), and precision (INTERVAL(6) '...'). Fixed via libpgfmt 1.1.4 (#7)

Documentation

  • Document the Homebrew 6.0 tap-trust workaround in the README

v2.1.3

12 Jun 16:05
@gmr gmr
89da551

Choose a tag to compare

What's Changed

Improved

  • Updated libpgfmt to 1.1.3, which fixes the missing comma between CTEs in non-compact WITH formatting (libpgfmt#7)

v2.1.2

12 Jun 15:39
@gmr gmr
d2f9b0b

Choose a tag to compare

What's Changed

Improved

  • Updated internal dependency: libpgfmt from 1.1.1 to 1.1.2, which bumps tree-sitter-postgres to 1.2.1

v2.1.1

17 Apr 22:40
@gmr gmr
a0e45b5

Choose a tag to compare

What's Changed

Improved

  • Updated internal dependencies: libpgfmt from 1.1.0 to 1.1.1 (#6)
  • Added Homebrew formula update automation to the release workflow

v2.1.0

08 Apr 13:27
@gmr gmr
7e0605c

Choose a tag to compare

What's New

  • Add --inplace / -i flag to format SQL files in place, writing the formatted output back to the source file instead of stdout
  • Preserve original file permissions when writing in place

Usage

pgfmt -i file.sql
pgfmt --inplace query1.sql query2.sql

v2.0.0

30 Mar 16:06
@gmr gmr
3c02fe7

Choose a tag to compare

What's New

Complete rewrite of pgfmt from Python to Rust, powered by libpgfmt.

Changes

  • Rewritten CLI in Rust using libpgfmt and clap
  • Default formatting style changed from river to aweber
  • Pre-built binaries for Linux and macOS (x86_64 and aarch64)
  • curl-based installer script

Install

curl -fsSL https://raw.githubusercontent.com/gmr/pgfmt/main/install.sh | sh

Or via Cargo:

cargo install pgfmt

0.1.0a1

27 Mar 16:44
@gmr gmr
73d3412

Choose a tag to compare

0.1.0a1 Pre-release
Pre-release

What's Changed

Added

  • New SQL formatting styles: dbt-modern (lowercase keywords), GitLab, Kickstarter, and mattmc3 modern SQL (#2)
  • AWeber-style formatter with river alignment, CASE expression formatting, and nested CTE support (#1, #2)
  • River-style SQL formatter as the base for alignment-driven styles, including subquery indentation, CTE support, and CREATE TABLE/VIEW/FUNCTION/DOMAIN/MATERIALIZED VIEW (#1)
  • Mozilla-style SQL formatter (#1)
  • CLI and Python library API with passthrough for unsupported statement types
  • MkDocs documentation for CLI, API, and all formatting styles

Fixed

  • Nested CTE river width inheritance: width is now always computed as the maximum of the inherited width and the local unified river width, ensuring consistent alignment across nested WITH scopes (#2)
  • CASE expression multi-line THEN/ELSE value indentation in AWeber style (#2)
  • Integer and float zero literal parsing
  • USING clause preservation and passthrough output normalization in Mozilla style
  • CREATE FUNCTION STRICT/SECURITY option parsing