Releases: darold/pgFormatter
Version 5.9
December 21 2025 - v5.9
This release adds several formatting improvements and fixes some issues
reported by users since the last release.
Here is the complete list of changes and acknowledgments:
- Fix wierd nested indenting when using multi conditional join with integer 0
value. Thanks to Neszt Tibor for the report. - Fix bad indentation with simple join. Thanks to anttilinno for the report.
- Fix indentation after RAISE EXCEPTION ... USING. Thanks to Ray Ng for the
report. - Fix bad formatting in CASE statements with variable assignments. Thanks to
Serhii Khoma for the report. - Limit the number of perl version tested
- Add CI action to test pgFormatter on commit push
- Fix dollar quote sign when attached to a word. Thanks to Andrew Jackson for
the report. - Fix indentation of UNION in RETURN QUERY clause. Thanks to birgersp for the
report. - Fix false negative in keyword detection with QUERY after RETURN
- Add pre-commit hook config. Thanks to Alexey Shrub for the patch.
- Add extra newline after ariga/atlas related comment line. Thanks to Jay Babu
for the feature request. - Fix incorrect formatting in PL/pgSQL when using DECLARE and CASE. Thanks to
lkslawek for the report. - Fix incorrect formatting of scientific notation with exponents. Thanks to
Ray Ng for the report. Add regression tests cases. - Fix incorrectly removing extra parenthesis in CREATE POLICY statements.
Thanks to Julian Niedermeier for the report.
Version 5.8
September 14 2025 - v5.8
This release adds several formatting improvements ans fixes some issues
reported by users since the last release.
Here is the complete list of changes and acknowledgments:
-
Fix bad indentation for WHERE after JOIN. Thanks to Neko Hz for the
report. -
pgFormatter is now able to distinguish between single values and
multiple values INSERT statement and to format them differently.
Here an example of the output format:-- multiple values form INSERT INTO tempy_mc_tempface VALUES ('tempy'), ('mc'), ('tempface'); -- single values form INSERT INTO tempy_mc_tempface VALUES ('another', 'world');Thanks to Paul Gelardi for the feature request.
-
Fix indentation issue of INSERT statements in DO block. Thanks to Paul Gelardi for the report.
-
Fix version in main script
-
Fix case where pgFormatter was removing a table named rule from joins. Thanks to Andy Freeland for the report.
-
Fix wrong format of format() function placeholders. Thanks to Andrew Jackson for the report.
Version 5.7
August 29 2025 - v5.7
This maintenance release fixes some issues reported by users since the last
release and adds some improvements.
Improvements:
- Better formatting of UPSERT queries.
- Better formatting of some form of CTE queries.
- Fix warning with new Perl versions.
Here is the complete list of changes and acknowledgments:
- Fix formatting of UPSERT queries.
- Fix space added after group_concat function. Thanks to Ahmad bin Marakkar
for the report. - Fix Possible-precedence-problem warnings with a switch to ne operator
instead of !=. Thanks to actualben for the patch. - Fix extra space before cast in create table statement. Thanks to Zoe Roux
for the report. - Fix indentation by running: perltidy -et=4 file. Thanks to Tello-Wharton
Aaron for the report - Fix indentation for SELECT statements in CTEs that use Postgres functions.
Thanks to Tello Wharton for the patch. - Adding functionality to understand if a function is just being closed.
Thanks to Tello Wharton for the patch. - Add a test to verify that the indentation in select statements in CTEs
is honoured. Thanks to Tello Wharton for the patch. - Signaling that a FROM statement has been exited when a WITH is being exited.
Thanks to Tello Wharton for the patch. - Add OFFSET to the list of keywords. Thanks to Muhammad Imaduddin for the report.
Version 5.6
March 17 2025 - v5.6
This maintenance release fixes some issues reported by users since the last
release and adds some improvements.
Improvements:
- Add support to pg_vector operator <#>. Thanks to Taylor Brown for the report
- Add support for the @? jsonb-jsonpath operator. Thank to Simon Whitaker for
the patch. - Follow the XDG Base Directory Specification by searching configuration file
into XDG_CONFIG_HOME/pg_format/config.conf. Thanks to afk-mario for the
feature request. - Check USERPROFILE env var for Windows. Thanks to Aaron Sherber for the patch
- Add to_reg* and reg* to function list.
- Add missing Perl modules in installation instructions. Thanks to dullbananas
for the patch. - Add information about the Perl module to install for the JSON feature.
- Expand web capabilities of the app with adding API-like JSON capability to
the CGI module. The API can be disabled using the enable_api parameter to
the CGI (default: 1). Thanks to m.desoutter for the patch. - Add option --redundant-parenthesis to prevent pgFormatter to remove
reduntant parenthesis in DML.
Here is the complete list of changes and acknowledgments:
- Fix indentation issue of INSERT in procedures. Thanks to Olamshin for the
report. - Fix indentation in triggers in an exception block. Thanks to bmk9727 for
the report. - Fix create type output. Thanks to Alec Larson for the report.
- Fix formatting of CHECK clause to be single line. Thanks to Alec Larson for
the report - Apply last fix changes for b = - 5 rewritten into b = -5
- Fix use of % formatter in format() function. Thanks to Ender Dobra for the
report. - Fix formatting of column name corresponding to keywords in INSERT and UPDATE
statement. Thanks to Zoe Roux for the report. - Fix single quotes inside /**/ comments break formatting. Thanks to Jakob
Egger for the report. - Fix formatting with BEGIN+ATOMIC. Thanks to dullbananas for the report.
- Update regression tests.
- Fix indentation of ELSE in a CASE clause. Thanks to VinceT for the report.
- Fix handling of the assignment operator := when there is no space
between the variable name and the operator. Thanks to Alexey Samoilov
for the report. - Fix broken indent when a comment is found before DECLARE. Thanks to Alexey
Samoilov for the report. - Fix format of SET statement in CREATE FUNCTION block. Thanks to Robert
Nilsson for the report. - Fix data type case in ALTER command. Thanks to Brandon Stilson for the
report. - Remove extra space after comment characters added by pgFormatter. Thanks
to Brandon Stilson for the report. - Fix documentation about function-case. Thanks to John Clow for the
report. - Fix other occurence of --no-grouping remaining in the documentation
instead of --nogrouping - Fix Use of uninitialized value $ENV{"XDG_CONFIG_HOME"}. Thanks to looi
for the report. - Fix typo on nogrouping option. Thanks to Edmundo Santos for the patch.
- Allow more characters in double quoted fqdn objects. Thanks to lsyuan
for the report. - Fix an uninitialized variable error. Thanks to Profpatsch for the report.
- Add prerequisite information about the Perl autodie module with RH like
distribution. Thanks to Saunders Brandon for the report.
Version 5.5
February 04 2023 - v5.5
This maintenance release fixes some issues reported by users since the last
month and some improvements.
Improvements:
- Prevent newline in function supporting the FROM keyword like substring().
- Add multi-line formatting on TRUNCATE with a table list. Thanks to GabenGar
for the feature request.
Here is the complete list of changes and acknowledgments:
- Fix not respected --no-space-function behavior with SELECT of function.
Thanks to fenuks for the report. - Update regression test result for fix on double quoted alias name. Thanks
to Christoph Berg for the report. - Fix potential exception on uninitialized variable. Thanks to Nate Smith
for the report.
Version 5.4
January 11 2023 - v5.4
This maintenance release fixes issues reported by users since the last five
months with some improvements and new features.
New options and features:
- Add option --no-space-function, when used pgFormatter removes the
space character between a function call and the open parenthesis that
follow. By default pgFormatter adds a space character, for example:
DROP FUNCTION IF EXISTS app_public.hello (a text);
When this option is used the resulting query is formatted as follow:
DROP FUNCTION IF EXISTS app_public.hello(a text);
Available in CGI mode as a checkbox. - Add command line option --extra-keyword to apply keywords formatting to
a list of additional keywords defined in a file (one keyword per line).
You can also pass a special value 'redshift' instead of a path to a file
to use the keywords defined internally in pgFormatter for this database.
This was historically possible through the -r | --redshift option that
is now obsolete and will be removed in the future. Thanks to Thom Brown
for the feature request.
Here is the complete list of changes and acknowledgments:
- Add option --no-space-function. Thanks to Aaron Merryman for the feature request.
- Fix particular case of alias with double quote. Thanks to Carl Jackson for the report.
- Fix some lines involuntary turned to comment. Thanks to Daniel Kukula for the report.
- Fix CREATE DOMAIN formatting. Thanks to Daniel Kukula for the report.
- Add formatting of code from SQL function.
- Fix wrong indentation in ORDER BY clause. Thanks to Thom Brown for the report.
- Fix CREATE TRIGGER formatting when there is a OR REPLACE clause. Thanks to hexcowboy for the report.
- Fix documentation by using variable based installation instruction. Thanks to Lav Patel for the patch.
- Add the possibility to format in place multiple files. Thanks to Benjamin Yolken for the report.
Version 5.3
August 07 2022 - v5.3
This maintenance release fixes issues reported by users since the last six
months. Here is the complete list of changes and acknowledgments:
- Remove some useless parenthesis in DML statement. Thanks to Marc Cousin for the request.
- Fix -o | --output that was always forced to stdout. Thanks to Linekio and Joraao Bernardo for the report.
- Fix unsupported json operator ?|. Thanks to Jack Thibaut for the report.
- Fix formatting of create table with option and tablespace. Thanks to jonyscathe for the report.
- Fix wrong wrapping in create table when --nocomment was used. Thanks to Alexander Haase for the report.
- Fix nested CREATE SCHEMA formatting. Thanks to GabenGar for the report.
- Fix invalid multi-line string constant formatting. Thanks to zaneduffield for the report.
- Force multiple INSERT values to be on separate lines. Previous behavior was to keep all values on the same line. Thanks to Damien-B for the report.
- Add missing ELSIF keyword. Thanks to ideev for the report.
- Fix bad indentation when INDEX is present in target list. Thanks to Marc Cousin for the report.
Version 5.2
December 03 2021 - v5.2
This maintenance release fixes issues reported by users since the last three months with some improvements and new features.
New options and features:
- Allow to pass multiple files when using --inplace. Thanks to mieszko4 for the patch.
- Add a button to copy formatted text to clipboard in the CGI interface. Thanks to Yan Sheng for the feature request.
Here is the complete list of changes and acknowledgments:
- Fix bad formatting of materialized view ddl with parameters. Thanks to Wilson Lin for the report.
- Fix/unicode and --inplace argument causing an error. Thanks to mieszko4 for the patch.
- Fix anonymizing disabled in last version. Thanks to Nikolas Poniros for the report.
- Correctly format casts to quoted types. Thanks to Adam Vartanian for the patch.
Version 5.1
September 28 2021 - v5.1
This maintenance release fixes issues reported by users since the last six months with some improvements and new features.
New options and features:
- Alternate format type (option -t) now keep enumeration in GROUP BY clause on a single line.
- Add new option -k or --keep-newline to preserve empty line in plpgsql code.
- Look for .pg_format configuration file in local directory first then in the $HOME directory.
- Force UTF8 encoding for all I/O to solve unicode character in object name parsing issues.
Here is the complete list of changes and acknowledgments:
- Fix typo in documentation with use of echo instead of cat. Thanks to
Сергей Бурладян for the patch.
- Fix space added after negative sign of numbers. Thanks to Carlos Hanson
for the report.
- Formatting words with CREATE prefix or DROP suffix raises a deadly
warning. Thanks to Martin Jan Kohler for the patch.
- Fix indentation in CASE clause. Thanks to jonyscathe for the report.
- Force UTF8 encoding for all I/O to solve unicode character in object name
parsing issues. Thanks to Monson Shao for the report.
- Fix formatting of the BETWEEN clause. Thanks to Monson Shao for the report.
- Look for .pg_format configuration file in local directory first then in the
$HOME directory. Thanks to Peter Lithammer for the suggestion.
- Add option -k or --keep-newline to preserve empty line in plpgsql code.
This doesn't work with comments for the moment. Thanks to Andrey Larionov
for the feature request.
- Fix "Unmatched ) in regex;" error. Thanks to Hew Wolff for the report.
- Fix an other use of uninitialized value in substitution iterator. Thanks to
Christophe Courtois for the report.
- Fix false positives for TYPE keyword and fix %TYPE and %ROWTYPE. Thanks to
Hew Wolff for the report
- Option -t (alternate format type) now keep enumeration in GROUP BY clause
on a single line. Thanks to MeadMaker pfassina for the feature request.
- Remove temporary debug code
- Fix indentation of FROM and WHERE in subquery. Thanks to Hew Wolff and
Sergey Shepelev for the report.
- Fix indentation before RETURNS when it is a RETURNS NULL ON clause.
- Fix seadly warning: Filehandle STDIN reopened as $[...] only for output.
Thanks to Andrew Dunstan for the report.
- Fix formatting of multi-line comment. Thanks to Jacob Beard for the report.
- Fix use of uninitialized value in pattern match. Thanks to arlt for the
report.
Version 5.0
February 11 2021 - v5.0
This major release fixes issues reported by users since the last six months with some improvements and new features.
New options and features:
- Add new option -M | --multiline to enable multi-line search with placeholder regexp specified at command line with -p or --placeholder.
- Fix improper handling of constants between quotes in all kind of queries and especially in function body. They were sometime corrupted by extra space before of after single quotes or some words was identified as keywords and turned upper case.
- Add keywords ALWAYS, DISABLE, ENABLE, LEVEL and STORED.
- Improve formatting of CREATE POLICY which doesn't the need anymore that alternate formatting (-t) be enabled.
- More fix of false positive keywords detection following their place.
- Add REGCLASS, REGCONFIG, REGDICTIONARY, REGNAMESPACE, REGOPER, REGOPERATOR, REGPROC, REGPROCEDURE, REGROLE, REGTYPE, to list of data types.
Here is the complete list of changes and acknowledgments:
- Fix false positive detection of keyword following their place. Thanks to allprecisely for the report.
- Add quick regression test for constant handling.
- Fix formatting for RAISE, CAST and EXCEPTION.
- Fix case of NEW/OLD in triggers code
- Fix improper handling of columns and tables aliases between double quotes.
- Don't assume HOME variable exists in Makefile.PL. Thanks to Samyak Bakliwal for the patch.
- Add new option -M | --multiline to enable multi-line search with placeholder regexp specified at command line with -p or --placeholder. Thanks to Taro Sato for the feature request.
- Fix generated columns formatting. Thanks to Oliver Ni for the report.
- Include regression test to not wrap URL hint and update the documentation.
- Adding example for regular expression preserving the URL and to prevent it from being wrapped. Thanks to Clement Aubert for the patch.
- Improve RLS policy formatting when alternate format is enabled. Thanks to madflow for the report.
- Fix formatting of numbers with signed exponents. Thanks to Jakob Egger for the report.
- Fix HTML footer in CGI mode.
- Fix formatting of CREATE TABLE using a CTE. Thanks to prichardson211 for the report.
- Replace deprecated TG_RELNAME with TG_TABLE_NAME. Thanks to Andreas Karlsson fot the patch.
- Fix regression in COPY formatting. Thanks to Paul Melnikow for the report.
- Fix CTE formatting with NOT MATERIALIZED clause. Thanks to Sergey Shepelev for the report.
- Update regression tests with the addition of oid types and fix for C functions formatting.
- Fix error format string for extra-function and 2 typos. Thanks to Sven Klemm for the patch.
- Fix formatting for C functions with obj_file and link_symbol. Thanks to Sven Klemm for the patch.
- Fix typo in CGI text. Thanks to Justin Hawkins for the report.
- Add oid types to list of data types. Thanks to Sven Klemm for the patch.