Changes¶
Version 7¶
7.10 (2025-10-26)¶
Fix
AlterTableCmdprinter, to handleALTER TABLE a ALTER b SET STATISTICS DEFAULTUse Cython 3.1.6
7.9 (2025-10-22)¶
Add an empty line between a
SELECT foo UNION SELECT barand itsORDER BY/LIMIT/OFFSETclause, to emphasize the fact that it applies to the whole statement, not to the “right” subquery.
7.8 (2025-10-19)¶
Fix prettification of single keyword statements (PR #173), thanks to Vlastimil Zíma
Improve
WithClauseprinter, when there is more than one CTEAvoid spurious parenthesis around expression terms in some common cases like
1 + 2 + 3 + 4Use macOS 14 to build arm 64 wheels and macOS 15 to build x86-64 wheels, given that GH is going to drop macOS 13 runners in a couple of months
Generate Python 3.14 wheels, thanks to cibuildwheel 3.2.1
7.7 (2025-04-04)¶
Nothing visible, fix GitHub Actions CI environment
7.6 (2025-04-03)¶
Upgrade libpg_query to 17-6.1.0
7.5 (2025-03-17)¶
Merge with Version 6
7.4 (2025-03-17)¶
Merge with Version 6
7.3 (2025-02-09)¶
Handle the
SET configuration_parameter FROM CURRENTcase in theVariableSetStmtprinter (PR #168), thanks to Bolaji Wahab
7.2 (2024-12-21)¶
Merge with Version 6
Handle
timestamp AT LOCALexpression, new in PG17
7.1 (2024-11-26)¶
Merge with Version 6
7.0 (2024-11-13)¶
No visible changes
7.0.dev1 (2024-11-01)¶
Upgrade libpg_query to 17-6.0.0
7.0.dev0 (2024-10-31)¶
No visible changes with respect to v6, apart from the support for new/revised syntaxes of PostgreSQL 17
Breaking changes¶
Target PostgreSQL 17, thanks to libpg_query 17-latest-dev
Require Python >= 3.9
Version 6¶
6.16 (2025-03-17)¶
No visible changes, just a workaround to a strange CI Windows-only failure on a test introduced by v6.15
6.15 (2025-03-17)¶
Escape occurrences of C-style end markers in SQL-style comments, when changing comment style in the
RawStream(issue #170)
6.14 (2025-02-09)¶
Handle the
SET configuration_parameter FROM CURRENTcase in theVariableSetStmtprinter (backport of PR #168)
6.13 (2024-12-17)¶
Better fix to the
x AT TIME ZONE fooglitch, v6.12 solution was incomplete
6.12 (2024-12-16)¶
Properly wrap
x AT TIME ZONE fooin parens when it is the argument of aDEFAULTconstraint
6.11 (2024-11-26)¶
Remove spurious trailing space in the
ConstrTypePrinter.CONSTR_IDENTITYand theConstraintprinters (issue #165)
6.10 (2024-11-01)¶
Upgrade libpg_query to 16-5.2.0
6.9 (2024-10-31)¶
Fix regression introduced by recent modification to the
CommonTableExprprinter that impacted on theRawStreamrenderer (issue #163)Expose the
RawStreamrenderer in the CLI tool with a new--normalizeoption
6.8 (2024-10-29)¶
6.7 (2024-10-28)¶
Generate wheels on PyPI using Python 3.13.0 final release, thanks to cibuildwheel 2.21.3
Improve
CommonTableExprprinter, reducing horizontal space waste
6.6 (2024-09-30)¶
Make recently introduced doctest related to issue #88 work on different Python versions
6.5 (2024-09-29)¶
6.4 (2024-09-28)¶
6.3 (2024-08-06)¶
Fix
SEQUENCE NAMEincreate_seq_stmt_def_elem(PR #151), thanks to oragesGenerate wheels on PyPI using Python 3.13.0rc1 release, thanks to cibuildwheel 2.20.0
Use Cython 3.0.11
6.2 (2024-02-01)¶
Almost no-op release to fix issue 144, producing correct wheels for macOS arm64
6.1 (2024-01-22)¶
6.0 (2024-01-22)¶
Produce wheels for macOS arm64
6.0.dev2 (2024-01-21)¶
Enable compilation on Windows and produce related 32bit and 64bit wheels (issue #7)
6.0.dev1 (2024-01-11)¶
Re-enable Linux 32bit wheels, thanks to libpg_query to 16-5.1.0
6.0.dev0 (2023-12-29)¶
No visible changes with respect to v5, apart from the support for new/revised syntaxes of PostgreSQL 16
Do not build binary wheels for Python 3.8
Skip compilation on Linux 32bit (see this comment for details)
Breaking changes¶
Target PostgreSQL 16, thanks to libpg_query 16-5.0.0
Version 5¶
5.9 (2024-01-22)¶
Fix issue 143, affecting
AlterOwnerStmtandRenameStmtprinters
5.8 (2024-01-11)¶
Fix issue #142, a glitch that affected 32-bit systems
5.7 (2023-12-23)¶
Use Cython 3.0.7
Update libpg_query to 15-4.2.4
5.6 (2023-12-07)¶
Fix issue #138, a defect that hindered the creation of AST nodes that act as markers, (currently
A_StarandCheckPointStmt), that do not carry any other informationUse Cython 3.0.6
Handle the
ENABLE TRIGGER ALLinAlterTableCmdFix issue #136, a regression introduced by “Avoid overly abundancy of parentheses in expressions”
5.5 (2023-10-07)¶
Use Cython 3.0.3
Produce wheels using final Python 3.12 release, thanks to
cibuildwheel2.16.2
5.4 (2023-08-24)¶
Improve documentation, adding
parser.Displacements,parser.scanandparser.splitexamples (issue #128)Fix issues #129 and #130 (merged from version 4.4)
5.3 (2023-08-05)¶
Update libpg_query to 15-4.2.3
5.2 (2023-05-20)¶
Update libpg_query to 15-4.2.1
5.1 (2023-02-28)¶
Merge version 4.2 changes
5.0 (2023-02-19)¶
No changes
5.0.dev1 (2023-02-11)¶
Update libpg_query to 15-4.2.0
Breaking changes¶
Change the type of the
ast.Floatvalue fromDecimaltostrUsing a
Decimalimplies potential differences in the representation of floating numbers, and already caused issues (#91 and #100) in the past, making it impossible to render, say,SELECT 0.0e1, due to the fact thatDecimal('0.0e1')resolves toDecimal('0').
5.0.dev0 (2022-12-19)¶
No visible changes with respect to v4, apart from the support for new/revised syntaxes of PostgreSQL 15
Breaking changes¶
Target PostgreSQL 15, thanks to libpg_query 15-4.0.0
Version 4¶
4.5 (unreleased)¶
Use Cython 3.0.2
4.4 (2023-08-24)¶
Fix issues #129 and #130 (merged from version 3.18)
4.3 (2023-04-27)¶
Fix serialization issue when column’s
DEFAULTvalue is an expression
4.2 (2023-02-27)¶
Handle special syntax required by
SET TIME ZONE INTERVAL '-08:00' hour to minuteFix mistype mapping of raw C “long” and “double” attributes, that were decorated with the wrong Python type
4.1 (2022-12-19)¶
Fix serialization glitches introduced by “Avoid overly abundancy of parentheses in expressions” (to be precise, by this commit)
4.0 (2022-12-12)¶
Update libpg_query to final 14-3.0.0
4.0.dev0 (2022-11-24)¶
Update libpg_query to 14-3.0.0
Avoid overly abundancy of parentheses in expressions
Prefer
SELECT a FROM b LIMIT ALLto... LIMIT NONE
Breaking changes¶
Target PostgreSQL 14
The wrapper classes used in previous versions, implemented in
pglast.node, are gone: now everything works on top of theASTclasses (issue #80)The
Ancestorclass is not iterable anymore: it was an internal implementation facility, now moved to a_iter_members()method
Version 3¶
3.18 (2023-08-24)¶
Fix
BooleanTestprinter, enclosing expression within parens in more cases (issue #129)Fix
Constraintprinter, avoiding repetition of “DEFERRABLE INITIALLY DEFERRED” on some kind of constraints (issue #130)
3.17 (2022-11-04)¶
Fix
AlterSubscriptionStmtprinter, handling “SET PUBLICATION” without options
3.16 (2022-11-03)¶
Update libpg_query to 13-2.2.0
3.15 (2022-10-17)¶
3.14 (2022-08-08)¶
Harden the way
Visitorhandle modifications to the AST (issue #107)
3.13 (2022-06-29)¶
Update libpg_query to 13-2.1.2
3.12 (2022-06-19)¶
Rewrite the implementation of the
referenced_relations()function, that was flawed with regard to CTEs handling (issue #106), thanks to Michal Charemza for providing his own versionImprove
WithClauseprinter indentationFix minor whitespace related issues in a few printer functions
3.11 (2022-05-29)¶
Fix the
Visitorclass, it was ignoring nodes nested in sub-listsReduce the size of the generated parser by factoring out common code into helper functions
3.10 (2022-05-11)¶
3.9 (2022-02-24)¶
Fix bug handling node containing a
locationfield, e.g.CreateTableSpaceStmt(issue #98)Properly handle dereferenced array expression (issue #99)
Avoid improper “floatification” of literal integers (issue #100)
3.8 (2021-12-28)¶
3.7 (2021-10-13)¶
Update libpg_query to 13-2.1.0
3.6 (2021-10-09)¶
Use latest libpg_query, to fix an error parsing
PLpgSQLstatements (issue #88)
3.5 (2021-09-26)¶
Forward the
special_functionsoption to substream, when concatenating items (issue #89)Fix representation of floating point numbers without decimal digits (issue #91)
Produce Python 3.10 wheels, thanks to
cibuildwheel2.1.2Update libpg_query to 13-2.0.7
New option
--remove-pg_catalog-from-functionson the command line tool (PR #90), thanks to Boris ZentnerImplement more special functions (PR #92), thanks to Boris Zentner
3.4 (2021-08-21)¶
Fix another packaging issue, that prevented recompilation from the sdist
.tar.gz(issue #86), thanks to Christopher Brichford
3.3 (2021-07-04)¶
Update libpg_query to 13-2.0.6
3.2 (2021-06-25)¶
Effectively include libpg_query’s vendored sources (issue #82)
3.1 (2021-06-25)¶
3.0 (2021-06-04)¶
Fix glitch in the
RawStream, avoiding spurious space after an open parenthesisImprove the
Visitorclass, to make it easier altering the original treeProperly handle nested lists in the serialization of AST Node
3.0.dev2 (2021-05-22)¶
Fix bug in
CreateStmtprinter (issue #79)Make it possible to pass also concrete
ast.Nodes toRawStream`
Breaking changes¶
To reduce confusion, the
printermodule has been removed: print-specific stuff is now directly exposed by theprinterssubpackage while serialization classes are now in the newstreammoduleThe default value for the
safety_beltoption of theprintify()function is nowFalse
3.0.dev1 (2021-05-16)¶
Fix
AT_SetIdentity,AT_EnableReplicaTrigandAlterSubscriptionStmtprintersImprove
AlterTSConfigTypeandIntoClauseprintersNew generic “visitor pattern” (issue #51) exemplified by a new
referenced_relations()function (issue #66)Refine printing of SQL comments
Implement
AlterExtensionStmtprinter
3.0.dev0 (2021-05-03)¶
Expose the new
pg_query_scan()function asparser.scan()Expose the
pg_query_parse()function asparser.parse_sql_json()Expose the new
pg_query_parse_protobuf()function asparser.parse_sql_protobuf()Expose the new
pg_query_deparse_protobuf()function asparser.deparse_protobuf()Honor the
catalognameof aRangeVarif present (issue #71)Cover almost all
SQLstatements, testing against the wholePostgreSQLregression suite (issue #68, PR #72 and PR #77), thanks to Ronan Dunklau and Hong ChengNew rudimentary support for the preserve comments feature (issue #23)
Breaking changes¶
Target PostgreSQL 13
The
pglast.parsermodule exposes alllibpg_queryentry points, even the newpg_query_deparse_protobuf()function that is basically equivalent toRawStream-based printerThe
split()function is now based on the lower levelpg_query_split_with_xxx()functionsThe
parse_sql()function returns native Python objects, not aJSONstring as before: all PG nodes are now represented by subclasses ofpglast.ast.Node, without exception, evenExprandValueare there. The latter impacts onpglast.node.Scalar: for example it now may contains aast.Integerinstance instead of a PythonintThe
pgpp --parse-treeoutput is a pprint represention of theAST, not aJSONstring as beforeThe
ParseErrorexception does not expose thelocationas an instance member anymore, although its still there, as the second argument (ie.args[1]); furthermore, its value now corresponds to the index in the original Unicode string, instead of the offset in theUTF-8representation passed to the underlying C function
Version 2¶
2.0.dev3 (2021-02-20)¶
Handle
INCLUDEclause inIndexStmt(PR #67), thanks to Ronan Dunklau
2.0.dev2 (2020-10-24)¶
Merge new
fingerprintfunctionality fromv1(i.e.master) branch
2.0.dev1 (2020-09-26)¶
Require Python 3.6 or greater
Handle
ALTER TYPE .. RENAME VALUEinAlterEnumStmt(PR #52), thanks to Ronan DunklauAdd support for Create / Alter / Drop PROCEDURE (PR #48), thanks to Ronan Dunklau
Use Ronan’s fork of libpg_query, targeting PostgreSQL 12.1 (PR #36)
Change get_postgresql_version() to return a
(major, minor)tuple (issue #38)Handle
ALTER TABLE ... ALTER COLUMN ... SET STORAGE ...Handle PG12 materialized CTEs (issue #57)
Support column numbers in
ALTER INDEX(PR #58), thanks to Ronan DunklauHandle
SET LOGGEDandSET UNLOGGEDinALTER TABLE(PR #59), thanks to Ronan DunklauHandle
ALTER TYPE ... RENAME(PR #62), , thanks to Ronan Dunklau
Version 1¶
1.18 (2021-06-01)¶
Fix exclusion constraint printer (issue #81)
1.17 (2021-02-20)¶
Fix the generic case in the
RenameStmtprinter
1.16 (2021-02-20)¶
Promote to the stable state
Move the job of building and uploading binary wheels from TravisCI to GitHub Actions
1.15 (2021-02-19)¶
Fix
IF EXISTSvariant ofRenameStmtprinter (PR #70), thanks to Jonathan MortensenUpdate libpg_query to 10-1.0.5
1.14 (2020-10-24)¶
Produce Python 3.9 wheels, thanks to
cibuildwheel1.6.3Expose the
libpg_query’s fingerprint functionality (PR #64), thanks to Yiming Wang
1.13 (2020-09-26)¶
Handle
SELECT FROM foo
1.12 (2020-06-08)¶
1.11 (2020-05-08)¶
1.10 (2020-01-25)¶
Fix collation name printer (PR #44), thanks to Ronan Dunklau
Implement
CreatePLangStmtprinter (PR #42), thanks to Bennie SwartFix privileges printer (PR #41), thanks to Bennie Swart
Handle
TRUNCATEevent inCreateTrigStmtprinter (PR #40), thanks to Bennie SwartFix function body dollar quoting (PR #39), thanks to Bennie Swart
1.9 (2019-12-20)¶
Prettier
INSERTrepresentation
1.8 (2019-12-07)¶
Prettier
CASErepresentationNew option to emit a semicolon after the last statement (issue #24)
1.7 (2019-12-01)¶
Implement
NotifyStmtprinterImplement
RuleStmtprinter, thanks to Gavin M. Roy for his PR #28Fix
RenameStmt, properly handling object nameProduce Python 3.8 wheels, thanks to cibuildwheel 1.0.0
Support
ALTER TABLE RENAME CONSTRAINT(PR #35), thanks to Ronan Dunklau
1.6 (2019-09-04)¶
1.5 (2019-06-04)¶
1.4 (2019-04-06)¶
1.3 (2019-03-28)¶
1.2 (2019-02-13)¶
1.1 (2018-07-20)¶
No visible changes, but now PyPI carries binary wheels for Python 3.7.
1.0 (2018-06-16)¶
Important
The name of the package has been changed from pg_query to pglast, to
satisfy the request made by the author of libpg_query in issue #9.
This affects both the main repository on GitHub, that from now on is
https://github.com/lelit/pglast, and the ReadTheDocs project that hosts the
documentation, http://pglast.readthedocs.io/en/latest/.
I’m sorry for any inconvenience this may cause.
0.28 (2018-06-06)¶
Update libpg_query to 10-1.0.2
Support the ‘?’-style parameter placeholder variant allowed by libpg_query (details)
0.27 (2018-04-15)¶
Prettier JOINs representation, aligning them with the starting relation
0.26 (2018-04-03)¶
Fix cosmetic issue with ANY() and ALL()
0.25 (2018-03-31)¶
Fix issue in the safety belt check performed by
pgpp(issue #4)
0.24 (2018-03-02)¶
Implement
Nullprinter
0.23 (2017-12-28)¶
Implement some other DDL statements printers
New alternative style to print comma-separated-values lists, activated by a new
--comma-at-eolnoption onpgpp
0.22 (2017-12-03)¶
Implement
TransactionStmtand almost allDROP xxxprinters
0.21 (2017-11-22)¶
Implement
NamedArgExprprinterNew alternative printers for a set of special functions, activated by a new
--special-functionsoption onpgpp(issue #2)
0.20 (2017-11-21)¶
Handle special de-reference (
A_Indirection) cases
0.19 (2017-11-16)¶
Fix serialization of column labels containing double quotes
Fix corner issues surfaced implementing some more DDL statement printers
0.18 (2017-11-14)¶
Fix endless loop due to sloppy conversion of command line option
Install the command line tool as
pgpp
0.17 (2017-11-12)¶
Rename printers.sql to printers.dml (backward incompatibility)
List printer functions in the documentation, referencing the definition of related node type
Fix inconsistent spacing in JOIN condition inside a nested expression
Fix representation of unbound arrays
Fix representation of
intervaldata typeInitial support for DDL statements
Fix representation of string literals containing single quotes
0.16 (2017-10-31)¶
Update libpg_query to 10-1.0.0
0.15 (2017-10-12)¶
Fix indentation of boolean expressions in SELECT’s targets (issue #3)
0.14 (2017-10-09)¶
Update to latest libpg_query’s 10-latest branch, targeting PostgreSQL 10.0 final
0.13 (2017-09-17)¶
Fix representation of subselects requiring surrounding parens
0.12 (2017-08-22)¶
New option
--versionon the command line toolBetter enums documentation
Release the GIL while calling libpg_query functions
0.11 (2017-08-11)¶
Nicer indentation for JOINs, making OUTER JOINs stand out
Minor tweaks to lists rendering, with less spurious whitespaces
New option
--no-locationon the command line tool
0.10 (2017-08-11)¶
Support Python 3.4 and Python 3.5 as well as Python 3.6
0.9 (2017-08-10)¶
Fix spacing before the $ character
Handle type modifiers
New option
--plpgsqlon the command line tool, just for fun
0.8 (2017-08-10)¶
Add enums subpackages to the documentation with references to their related headers
New
compact_lists_marginoption to produce a more compact representation when possible (see issue #1)
0.7 (2017-08-10)¶
Fix sdist including the Sphinx documentation
0.6 (2017-08-10)¶
New option
--parse-treeon the command line tool to show just the parse treeSphinx documentation, available online
0.5 (2017-08-09)¶
Handle some more cases when a name must be double-quoted
Complete the serialization of the WindowDef node, handling its frame options
0.4 (2017-08-09)¶
Expose the actual PostgreSQL version the underlying libpg_query libray is built on thru a new
get_postgresql_version()functionNew option safety_belt for the
prettify()function, to protect the innocentsHandle serialization of
CoalesceExprandMinMaxExpr
0.3 (2017-08-07)¶
Handle serialization of
ParamRefnodesExpose a
prettify()helper function
0.2 (2017-08-07)¶
Test coverage at 99%
First attempt at automatic wheel upload to PyPI, let’s see…
0.1 (2017-08-07)¶
First release (“Hi daddy!”, as my soul would tag it)