Skip to content

Releases: darold/pgFormatter

Version 4.0

02 Jun 13:18
Compare
Choose a tag to compare

June 2 2019 - v4.0

This major release fixes a huge list of formatting issues which makes
pgFormmater the best tool to format your plpgsql code and sql queries.

pgFormatter is now able to auto-detect user defined functions to
prevent adding new line between parameters.

There's also a huge improvement to the CGI mode which can now apply
directly a formatting option change to current code to format without
having to submit again the content.

Here is the complete list of changes and acknowledgments: https://github.com/darold/pgFormatter/blob/master/ChangeLog

Version 3.4

21 Apr 16:48
Compare
Choose a tag to compare

April 21 2018 - v3.4

This release fixes several issues reported by users since the last
six months and adds lot of improvements in code formatting:

  • Add -W, --wrap-after option to set number of column after which
    lists must be wrapped. Default is to puts every item on its own
    line.
  • Add 'Wrap after' option to CGI in the indentation section to
    support the -W | --wrap_atfer command line option in CGI mode.
  • Add -w | --wrap-limit command line option to be able to to wrap
    queries at a certain length. This option is not available in CGI
    mode.
  • Allow uploaded file content-type to be application/octet-stream.
  • Allow a single $ sign in object name.
  • Major optimization of function detection, speed difference is 10
    time faster.
  • Better detection of function versus keyword with same name.
  • Add WORK, GENERATED and IDENTITY as PostgreSQL keyword.
  • Add array_remove and array_replace to the list of PostgreSQL
    functions.
  • Add detection of code separator after DO keyword if it starts
    with a dollar sign.
  • Major optimization of function detection, speed difference is 10
    time faster.
  • Better detection of function versus keyword with same name.
  • Add WORK, GENERATED and IDENTITY as PostgreSQL keyword.
  • Add array_remove and array_replace to the list of PostgreSQL
    functions.
  • Add detection of code separator after DO keyword if it starts
    with a dollar sign.
  • Add new option -t | --format-type to try another formatting type
    for some statements. At this stage it will just use a multi-line
    format in POLICY and PUBLICATION statements. It also introduce
    newline in parameter function list.
  • Add formatting of CREATE POLICY statements.
  • Add information about (Neo)vim plugin and Visual Studio use of
    pgFormatter to format PLPGSQL and SQL code.

For the complete list of changes see: https://github.com/darold/pgFormatter/blob/master/ChangeLog

Version 3.3

21 Apr 16:46
Compare
Choose a tag to compare

November 20 2018 - v3.3

This minor release fixes several issues reported by users since last
release, adds and improves some code formatting:

  • Add formatting of GROUPING and ROLLUP clause.
  • Replace concat operator from some SGBD with operator ||.
  • Add formatting of FILTER and WITHIN GROUP clause.
  • Fix several wrong formatting with comment.
  • Improve arrays formatting.
  • Treat DISTINCT as a modifier of the whole select clause.
  • Fix formatting of ON UPDATE/DELETE in create table statements.
  • Add DETACH,ATTACH,LIST,HASH,MODULUS and REMINDER to keywords list.
  • Add formatting of CREATE PARTITION STATEMENT.

For a complete list of changes see https://github.com/darold/pgFormatter/blob/master/ChangeLog

Version 3.2

08 Oct 06:53
Compare
Choose a tag to compare

October 08 2018 - v3.2

This minor release adds support to PostgreSQL v11.0 new keywords
and fixes several issues reported by users since last release.

  • Add new PostgreSQL v11 keywords CALL, GROUPS, INCLUDE, OTHERS, PROCEDURES, ROUTINE, ROUTINES, TIES.
  • Add formatting of CREATE PUBLICATION.
  • Add formatting of CREATE PROCEDURE code.
  • Add formatting of ALTER PROCEDURE/ROUTINE, all on a single line.
  • Add an indentation before VALUES of INSERT statements.

Here is the complete list of changes and acknowledgments:

  - Fix weird formatting on UNIQUE and PRIMARY KEY constraints in CREATE TABLE statements. Thanks to Aaron Reisman for the report.
  - Add operator for name convention,  ":=" was changed to "=>". Thanks to snailshell-321 for the report.
  - Fix missing formatting in SQL function with a single SELECT.
  - Remove any new line in CALL statement.
  - Never add newline after comma in ALTER statements.
  - Prevent new line between ROW LEVEL SECURITY. Thanks to madflow for the report.
  - Update samples with last formatting changes.

Version 3.1

12 Sep 20:14
Compare
Choose a tag to compare

September 12 2018 - v3.1

This minor release fixes several issues reported by users since six
months. This release also adds some improvements in code formatting.

  • Function code in other language tha SQL or PLPGSQL is now kept untouched.
  • Make formatting output of function/procedure more compliant with the pg_dump PostgreSQL format.
  • Add information about atom package integration of pgFormatter.
  • Add a "Clear code" button to reset text area and preserve options changes.
  • Add a logo to the project and change title and style of the CGI part.
  • Add application/sql content-type support in CGI mode.

Here is the complete list of changes and acknowledgments:

  - Add preprocessing to autodetect function language before entering
    the tokenizer. If the language is not SQL or PLPGSQL the code is
    kept untouched. Thanks to Philip Trauner for the report.
  - Fix whatis entry of POD manpage. Thanks to Christoph Berg
    for the patch.
  - Add more regression tests.
  - Remove newline between sub query and ON keyworks in JOIN clause.
    Thanks to Christophe Courtois for the report.
  - Fix indentation of multiline comments. Thanks to Philip Trauner
    for the report.
  - Fix missing newline after comma in some select statement,
    especially from the online example.
  - Fix formatting of query with multiple CTE. Thanks to Christophe
    Courtois for the report.
  - Fix plv8 syntax. Thanks to Aaron Reisman for the report.
  - Fix undefined value crash when formatting query not terminated
    by a semi colon. Thanks to David Luzar for the report.
  - Add newline and indentation after WITH [RECURSIVE] ... (
  - Fix bad indentation on case statements with 0 value. Thanks to
    John Dimm for the report.
  - Add regression test for sub queries followed by a join.
  - Set the code separator for ex19.sql regression test.
  - Fix indentation in join when previous instruction is a sub
    select. Thanks to Christophe Courtois for the report.
  - Fix indentdation of INNER JOINS when a previous JOIN use AND/OR
    operator. Thanks to David Vogt for the report.
  - Fix indentation problem with sub-select and UNION. Thanks to
    Christophe Courtois for the report.
  - Fix handling of newline after comma in CGI mode for insert
    queries.
  - Cleanup some code with comment addition.
  - Prevent newline before BETWEEN operator.
  - Fix JOIN formatting with AND/OR operator.
  - Fix utf8 uncaught exception on CLI mode.
  - Remove requirement to Perl v5.14 minimum.
  - Avoid backward indentation in multiple JOIN clauses.
  - Set default CGI maxlength to 100KB
  - Fix unwanted indentation of WHEN in CASE statement.
  - Remove use of UTF8 Perl pragma in CGI mode, it is not
    recommended and it breaks CGI when not utf8 encoding.
    Thanks to Christophe Courtois for the report.
  - Fix PREPARE and INSERT|DELETE formatting. Thanks to Tom
    Halson for the report.
  - Fix formatting of WITH inside CREATE TABLE statement that was
    wrongly formatting TIMESTAMP WITH TIME ZONE. Thanks to James
    Bourne for the report.
  - Fix uninitialized maxlength. Thanks to Steve Wainstead for
    the report.
  - Reactivate -m | --maxlength in CLI mode that was removed in
    version 2.0. Thanks to Steve Wainstead for the report.

Version 3.0

28 Feb 18:24
Compare
Choose a tag to compare

Febuary 28 2018 - v3.0

This major release fixes some issues reported by users during the
last six months and adds several new features.

  * Add colorization of comments.
  * Add detection and colorization of user defined function in the SQL
    code. Until now only PostgreSQL internal function was highlighted.
  * Add new option -B | --comma-break and in CGI the checkbox
    "New-line after comma (insert)" to force a newline after each
    comma in INSERT statements, columns and values parts.
  * Add command line option: -F | --format to be able to change the
    output format in CLI mode. At now there is two possible format,
    text the default or html. More format can be added in the future.
  * Add support to all psql meta commands up to v1O.

There is also some improvement in SQL code formatting.

The move to a new major release is related to the removing of the
html_highlight_code() method used to apply HTML formatting style.

If you are using your own custom scripts based on the pgFormatter
Perl modules this will break backward compatibility and you will
have to remove the call to html_highlight_code() in your script.
Here is the new synopsys for an HTML output:

   my $beautifier = pgFormatter::Beautify->new();
   $beautifier->query( 'select a,b,c from d where e = f' );
   $beautifier->format('html');
   $beautifier->beautify();
   my $nice_html = $beautifier->content();

Note that if you are using the pg_format script provided in the
pgFormatter release you don't have to care about this change.

For the complete list of changes see: https://github.com/darold/pgFormatter/blob/master/ChangeLog

Version 2.1

02 Sep 16:56
Compare
Choose a tag to compare

This release fixes several issues reported by users since four months. It also adds some improvements in code formatting:

  - Add support to new psql meta-command from v10.
  - Add two command line option to defined where comma must appears
    in a parameter list:

     -b | --comma-start: in a parameters list, start with a comma (see -e)
     -e | --comma-end  : in a parameters list, end with a comma (default)

    The CGI interface adds a new checkbox to force comma at beginning.
    Default is lines end with a comma.
  - Prevent dynamic code formatting. By default pgFormatter takes all
    code between single quote as string constant and do not perform
    any formatting on this code. It is common to use a string as
    code separator to avoid doubling single quote in dynamic code
    generation, in this case pgFormatter can fail to auto detect
    the code separator. By default it will search for any string after
    the EXECUTE keyword starting with dollar sign. If it can not auto
    detect your code separator you can use the command line option -S
    or --separator to set the code separator that must be used.
  - Make it possible to run pg_format via symlink. For example, if
    pgFormatter is in /opt/pgFormatter and there is a symlink like
    /usr/local/bin/pg_format -> /opt/pgFormatter/pg_format
    then previous version wouldn't work when called via symlink, as
    it would search for libs in /usr/local/bin/lib/, and not in
    /opt/pgFormatter/lib.

For the full list of changes, see:

Version 2.0

07 May 21:30
Compare
Choose a tag to compare

This major release adds a plpgsql code beautifier. This makes pgFormatter the best free tool to rewrite and beautify any SQL and PLPGSQL code. This release also fixes several issues and adds lot of improvements in code formatting.

    - Add PLPGSQL beautifier.
    - Fix case sensitivity of plpgsql keywords when using the -u command line
      option. Thanks to Hubert Depesz Lubaczewski for the report.
    - Add regression tests script regress_test.pl, more test files and expected
      results.
    - Do not append newline before a concatenation operator.
    - Fix unitialized variable issue and remove newline in insert statement
      after a close parenthesis.
    - Remove comment before HTML beautifier and restore them after to prevent
      beautifying keywords in comments.
    - Improve formatting of UPDATE and DELETE statement.
    - Improve all DDL statements formatting.
    - Only format functions when name is followed by an open parenthesis.
    - Add support for AWS Redshift keywords. Thanks to cavanaug for the feature
      request.
    - Prevent new line after a comma in parameters function.
    - Add LATERAL keyword.
    - Remove new line between UNION and ALL.
    - Add RETURNING as far left keyword.
    - Fix some potential case sensitivity issues.
    - Replace tabulation with space for better indentation.
    - Prevent newline in USING clause of JOIN.
    - Prevent newline after a closing parenthesis but before an operator.
    - Prevent new line when a comma is followed by a quote

Version 1.5

18 Jan 09:55
Compare
Choose a tag to compare

This release fixes several issues and adds support to new keywords added in
PostgreSQL 9.5. There's also a major code rewrite by Hubert depesz Lubaczewski,
pg_format works as previously - handles both CGI and CLI interface, but you
can get directly to whatever functionality you want by using pgFormatter::*
modules.

New beautified keywords are: BERNOULLI, CUBE, GROUPING SETS, SKIP LOCKED,
LOGGED, POLICY, ROLLUP, TABLESAMPLE. And new functions are: jsonb_pretty,
jsonb_set, pg_last_committed_xact, pg_xact_commit_timestamp.

There is also a useful hint added to documentation to be able to format
you SQL code from vi by adding a simple line to .vimrc. This hint is taken
from David Fetter's blog : http://people.planetpostgresql.org/dfetter/index.php?/archives/78-Formatting!.html