Skip to content

Releases

v0.1.2.0

Choose a tag to compare

@github-actions github-actions released this 27 Nov 08:07
v0.1.2.0
9d5f508

What's Changed

  • Lay out plain SQL from libpg_query's parse tree by @lorenzo in #4
  • Lay out plain SQL statements with comments inside them by @lorenzo in #5
  • Keep blank lines before comments and dollar-quoted strings as written by @lorenzo in #6
  • Put values rows on one line each when they all fit by @lorenzo in #7
  • Keep blank lines between values rows by @lorenzo in #8
  • Lay out create table and create view in the syntax backend by @lorenzo in #9
  • Lay out create index and alter table in the syntax backend by @lorenzo in #10
  • Lay out create function in the syntax backend by @lorenzo in #11
  • Lay out create trigger, grant and revoke in the syntax backend by @lorenzo in #12
  • Lay out index include and with, alter constraint, keys using an index and partitions by @lorenzo in #13
  • Apply sqiff's readability process: refactor round, docs and hopinion checks by @lorenzo in #14
  • Write a subquery's explicit all once by @lorenzo in #15
  • Readability round two: shapes, function parts, trigger and grant clauses from the tree by @lorenzo in #16
  • Readability round three: name spellings, environment stages, one parenthesis walk by @lorenzo in #17
  • Rename to pgstyle, Docker image on each release; pgstyle 0.1.2.0 by @lorenzo in #18

Full Changelog: v0.1.1.0...v0.1.2.0

v0.1.1.0

Choose a tag to compare

@github-actions github-actions released this 26 Nov 13:04
v0.1.1.0
616e9ae

What's Changed

  • Pin haskell.nix and nixpkgs to sqiff's and sqint's revisions by @lorenzo in #3

Full Changelog: v0.1.0.1...v0.1.1.0

v0.1.0.1

Choose a tag to compare

@github-actions github-actions released this 26 Nov 07:55
v0.1.0.1
6ce964c

What's Changed

  • Static Linux binaries on each release by @lorenzo in #2

Full Changelog: v0.1.0.0...v0.1.0.1

pgfmt 0.1.0.0

Choose a tag to compare

@lorenzo lorenzo released this 25 Nov 22:20
v0.1.0.0
70caee4

The first release of pgfmt: a formatter for PostgreSQL files that does not change what any statement does.

Install

pgfmt is built with Nix for x86_64-linux, aarch64-linux and aarch64-darwin, and the binaries are in the kronor-open cache:

nix run github:kronor-io/pgfmt/v0.1.0.0 -- --help
nix profile install github:kronor-io/pgfmt/v0.1.0.0

There are no prebuilt tarballs yet. To build with cabal, see Building from source: it needs libpg_query 18 with nix/libpg_query-set-values-as-strings.patch applied.

What it does

  • Formats PostgreSQL files statement by statement, and rewrites a statement
    only when libpg_query parses the new text to the same statement, with the
    same number of comments. Text between statements is copied byte for byte.
  • Two backends: pgfmt's own renderer for DML, with leading commas, and
    libpg_query's pretty-printer for everything PostgreSQL parses, including all
    DDL. --backend auto, the default, uses the first where it can.
  • --check for CI and pre-commit: names the files that are not formatted and
    exits 1, changing nothing.
  • --keyword-case lower|upper, applied to every statement in the file,
    whichever backend laid it out. Identifiers are never changed.
  • Formats the SQL statements inside PL/pgSQL function bodies, and keeps the new
    body only if it parses to the same PL/pgSQL.
  • SET values keep their single quotes: set lock_timeout to '50ms' stays as
    it is. libpg_query 18.0.0 writes such values as quoted identifiers
    ("50ms"); the flake builds it with
    nix/libpg_query-set-values-as-strings.patch.
  • --dialect hasql-th lets the syntax backend read hasql-th's quasiquote
    extensions, and the library exposes PgFmt.Render.formatSql for them.
  • Builds with Nix for x86_64-linux, aarch64-linux and aarch64-darwin;
    binaries come from the kronor-open cache.

How pgfmt fits with sqiff, sqint and the other tools: sqitchcraft.