Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1w8apY-000geU-2C for pgsql-announce@arkaria.postgresql.org; Fri, 03 Apr 2026 09:28:45 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1w8apW-00AuT4-1P for pgsql-announce@arkaria.postgresql.org; Fri, 03 Apr 2026 09:28:42 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1w8aRi-00AhUy-2v for pgsql-announce@lists.postgresql.org; Fri, 03 Apr 2026 09:04:07 +0000 Received: from mahout.postgresql.org ([2001:4800:3e1:1::227]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.98.2) (envelope-from ) id 1w8aRg-00000000KVT-12IA for pgsql-announce@lists.postgresql.org; Fri, 03 Apr 2026 09:04:06 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=postgresql.org; s=20171124; h=Message-ID:Date:Reply-To:From:To:Subject: MIME-Version:Content-Type:Sender:Cc:Content-Transfer-Encoding:Content-ID: Content-Description:In-Reply-To:References; bh=NLxC/Q1k8j4LKSXi3YG/FXGOnqTp3ROvzkweE/E0TZs=; b=phXjVc2dp8HMFVvAwG9EsqiWuF E8FBdalqY0o87uP+vqQLgDoDUj3N2Sox8yyIDaYZqdRCzaKhfES//Jg7aEJWciMDkgrHvxZaejMwE 3YilvMUtJHaVyHjz/SW/pdabGXDhwkATsWg/Oox7ZtU+CPmxZJvV5XIHIPeNltLF6sm41fRZQLNfF RgUrCOxk62nyG/I7aqtbBcIKvRuH5ZqWQnoV9kTiS40Sp1oZtXdh3nfea8BLh9JDKIyK5OnNzni0m a6beYvCMxKc1xLEXw3vqyGEvmZSc4mRaGR/a+SrCsc/WO+2DDoR6F3omlPes4vkUqqUUPh1w+nCdN nSJ9pCww==; Received: from wrigleys.postgresql.org ([217.196.149.60]) by mahout.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1w8aRf-000uxk-1X for pgsql-announce@lists.postgresql.org; Fri, 03 Apr 2026 09:04:03 +0000 Received: from localhost ([127.0.0.1] helo=wrigleys.postgresql.org) by wrigleys.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1w8aRd-00Egjt-2X for pgsql-announce@lists.postgresql.org; Fri, 03 Apr 2026 09:04:02 +0000 Content-Type: multipart/alternative; boundary="===============3079218680449324552==" MIME-Version: 1.0 Subject: tree-sitter-postgres, libpgfmt, pgfmt, and libpgdump To: PostgreSQL Announce From: "Gavin M. Roy via PostgreSQL Announce" Reply-To: gavinmroy@gmail.com Date: Fri, 03 Apr 2026 09:03:54 +0000 Message-ID: <177520703424.3221094.14337907105874202751@wrigleys.postgresql.org> X-Auto-Response-Suppress: All Auto-Submitted: auto-generated X-pglister-tags: related X-pglister-tagsig: 13c185396b9dd3b22a9be89798a133a9076c1741de7ff51f62009502eaabb242 List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --===============3079218680449324552== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable I've been rebuilding some internal tools and open source projects in Rust a= nd have a few things to share: [tree-sitter-postgres](https://github.com/gmr/tree-sitter-postgres) =E2=80= =94 A Tree-sitter grammar for Postgres (SQL + PL/pgSQL) that uses codegen t= o convert directly from Postgres' Bison source into a Tree-sitter grammar. [libpgfmt](https://github.com/gmr/libpgfmt) =E2=80=94 A Rust library for fo= rmatting SQL and PL/pgSQL, with support for multiple style presets: aweber,= dbt, gitlab, kickstarter, mozilla, mattmc3, and river. [pgfmt](https://github.com/gmr/pgfmt) =E2=80=94 A CLI tool for formatting a= nd lint-checking SQL and PL/pgSQL, built on libpgfmt. [libpgdump](https://github.com/gmr/libpgdump) =E2=80=94 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/pg= dumplib) 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 other= s 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 derive= s from [sqlstyle.guide](https://sqlstyle.guide), but was built to support m= ultiple styles. --===============3079218680449324552== Content-Type: text/html; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable tree-sitter-postgres, libpgfmt, pgfmt, and libpgdump
 

tree-sitter-postgres, libpgfmt, pgfmt, and libpgdump

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

tree-sitt= er-postgres =E2=80=94 A Tree-sitter grammar for Postgres (SQL + PL/pgSQ= L) that uses codegen to convert directly from Postgres' Bison source into a= Tree-sitter grammar.

libpgfmt =E2=80= =94 A Rust library for formatting SQL and PL/pgSQL, with support for multip= le style presets: aweber, dbt, gitlab, kickstarter, mozilla, mattmc3, and r= iver.

pgfmt =E2=80=94 A CL= I tool for formatting and lint-checking SQL and PL/pgSQL, built on libpgfmt= .

libpgdump =E2=80= =94 A Rust library for reading and writing PostgreSQL dump files that suppo= rts custom, directory, and tar formats. This is a port of my pgdumplib project and will be used in the next version of pgdu= mplib.

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

libpgfmt and pgfmt were primarily built to = support the AWeber style= guide which derives from sqlstyle.guide, but was buil= t to support multiple styles.

This email was sent to you from Gavin M. Roy. It was delivered on their beh= alf by the PostgreSQL project. Any questions about the content of the message shou= ld be sent to Gavin M. Roy.

You were sent this email as a subscriber of the pgsql-announce mai= linglist, for the content tag Related Open Source. To unsubscribe from further emails, or change which emails you want to receive, please click th= e personal unsubscribe link that you can find in the headers of this email, or visit https://lists.postgresql.org/unsubscribe/.
 
--===============3079218680449324552==--