This release contains a breaking change to the Error enum.
Modified:
Error::ParseErroris now a struct variant carrying both the message and the location of the error:Error::ParseError { message: String, cursorpos: i32 }(previouslyError::ParseError(String)). Thecursorposvalue is libpg_query's error cursor: a 1-based character (code point) offset into the query (not a byte offset); for an unexpected end of input it points one past the last character (character length + 1). See the rustdoc on the variant for converting it to a 0-based byte offset for caret/source-span diagnostics. TheDisplayoutput is unchanged (it still prints only the message), so consumers matching on the formatted string are unaffected.
This release upgrades libpg_query so contains breaking changes.
Modified:
- Updated
libpg_queryto 18.0.0. This bumps the embedded Postgres version to 18. Several AST changes are introduced:Node::SinglePartitionSpecwas removed.Node::ATAlterConstraint,Node::ReturningClause,Node::ReturningOption, andNode::ReturningExprwere added.AlterTableType::AT_CheckNotNullwas removed.ConstrType::CONSTR_ATTR_ENFORCEDandConstrType::CONSTR_ATTR_NOT_ENFORCEDwere added.JoinType::JOIN_RIGHT_SEMIwas added.InsertStmt,UpdateStmt, andDeleteStmtnow exposereturning_clause: Option<ReturningClause>instead of a flatreturning_list: Option<Vec<Node>>. The list of returned expressions now lives atreturning_clause.exprs.A_Exprgainedrexpr_list_startandrexpr_list_endfields.Constraintgainedis_enforced,generated_kind,without_overlaps,fk_with_period, andpk_with_period; theinhcountfield was removed.CreateStmtgained annnconstraintsfield.VariableSetStmtgainedjumble_argsandlocationfields.- Fingerprints have changed for some queries to align with Postgres 18.
build.rsnow generates theCompareTypeenum from the newaccess/cmptypesection.- The
strfeature now round-trips the new PG18 syntax:CHECK (...) [NOT] ENFORCEDcolumn constraints.- Virtual generated columns (
GENERATED ALWAYS AS (...) VIRTUAL). RETURNING WITH (OLD AS ..., NEW AS ...)onINSERT/UPDATE/DELETE.ALTER TABLE ... ALTER CONSTRAINT c [NOT] ENFORCED | [NOT] DEFERRABLE [INITIALLY DEFERRED] | [NO] INHERITvia the newATAlterConstraintnode.
Modified:
- Updated
libpg_queryto 17-6.2.2. This bumps the embedded Postgres version from 17.4 to 17.7. No AST changes are introduced. build.rsupdated so that cross-compiling to alternative targets works.
This release upgrades libpg_query so contains breaking changes.
Modified:
- Updated
libpg_queryto 17-6.1.0. - Made string generation opt-in instead of enabled by default.
- Updated dependencies.
Other:
- Bumped the project version to
2024and updated syntax accordingly.
This release upgrades libpg_query so contains breaking changes.
New:
- Introduced a
parse_debugfunction to allow for consuming functions to inspect the raw JSON output fromlibpg_query. This is likely only used internally by library authors, but a useful feature nonetheless.
Modified:
- Updated
libpg_queryto 15-4.2.2. This required a lot of refactoring to support the modified AST being generated. - String generation is now feature gated under
str. This feature is not feature complete so should be used with caution. Please note, this is currently enabled by default.
Other:
- Bumped the project version to
2021and updated syntax accordingly.
Please note that some syntax support has been dropped between Postgres version releases. For example,
the ? placeholder is no longer supported. For a full list, please see the libpg_query changelog.
Modified:
Thank you @haileys for your contribution!
Modified:
- Updated
regexlibrary to remove potential security vulnerability.
Modified:
- Updated to latest
libpg_queryversion which fixes some memory leaks. - Removed
clippybuild dependency which was subject to a potential security vulnerability.
New:
to_stringfunctionality for AST allowing you to turn the parsed tree back into SQL.
Renamed project from pg_query.rs to pg_parse. Going forward the pganalyze team will maintain the official fork
leveraging protobuf whereas this library will continue to use the JSON subsystem.
- Remove
Exprfrom generated output since it is a generic superclass.
Fixes issue when parsing some statements that would contain trailing null objects in an array. Deserialization of these
is now performed correctly. Note that this may cause some differing behavior from other libpg_query implementations
whereby a "null object" is intended to indicate the end of an array.
An example of this behaviour is SELECT DISTINCT a, b FROM c. The distinct_clause generates [{}] from
libpg_query.
pg_query.rs now parses this as vec![].
- Enums can now be compared directly.
Nullis generated with empty parameters to support JSON mapping.
Updates libpg_query dependency to 13-2.1.0.
- Fixes
Valueparsing in some situations such as fortypemod
- Adds in the
Listnode type by generatingnodes/pg_listinstructdef. - Implement
std::error::ErrorforErrortype