public inbox for [email protected]  
help / color / mirror / Atom feed
From: Gavin M. Roy via PostgreSQL Announce <[email protected]>
To: PostgreSQL Announce <[email protected]>
Subject: tree-sitter-postgres, libpgfmt, pgfmt, and libpgdump
Date: Fri, 03 Apr 2026 09:03:54 +0000
Message-ID: <177520703424.3221094.14337907105874202751@wrigleys.postgresql.org> (raw)

I've been rebuilding some internal tools and open source projects in Rust and have a few things to share:

[tree-sitter-postgres](https://github.com/gmr/tree-sitter-postgres) — A Tree-sitter grammar for Postgres (SQL + PL/pgSQL) that uses codegen to convert directly from Postgres' Bison source into a Tree-sitter grammar.

[libpgfmt](https://github.com/gmr/libpgfmt) — A Rust library for formatting SQL and PL/pgSQL, with support for multiple style presets: aweber, dbt, gitlab, kickstarter, mozilla, mattmc3, and river.

[pgfmt](https://github.com/gmr/pgfmt) — A CLI tool for formatting and lint-checking SQL and PL/pgSQL, built on libpgfmt.

[libpgdump](https://github.com/gmr/libpgdump) — A Rust library for reading and writing PostgreSQL dump files that supports custom, directory, and tar formats. This is a port of my [pgdumplib](https://github.com/gmr/pgdumplib) project and will be used in the next version of pgdumplib.

There are several tree-sitter projects for Postgres including both SQL and PL/PgSQL. What I believe differentiates tree-sitter-postgres from the others is that it is entirely driven by code generation from the Postgres source. When a new major version drops that may add new keywords or other changes, it should be very easy to keep the grammar up to date.

libpgfmt and pgfmt were primarily built to support the [AWeber style guide](https://gist.github.com/gmr/2cceb85bb37be96bc96f05c5b8de9e1b) which derives from [sqlstyle.guide](https://sqlstyle.guide), but was built to support multiple styles.

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: [email protected]
  Cc: [email protected], [email protected]
  Subject: Re: tree-sitter-postgres, libpgfmt, pgfmt, and libpgdump
  In-Reply-To: <177520703424.3221094.14337907105874202751@wrigleys.postgresql.org>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox