Skip to content

Adding support for PostgreSQL's XML functions#2252

Open
LucaCappelletti94 wants to merge 3 commits intoapache:mainfrom
LucaCappelletti94:postgres-regression-7
Open

Adding support for PostgreSQL's XML functions#2252
LucaCappelletti94 wants to merge 3 commits intoapache:mainfrom
LucaCappelletti94:postgres-regression-7

Conversation

@LucaCappelletti94
Copy link
Contributor

This PR adds PostgreSQL XML expression support to sqlparser-rs by introducing dedicated AST variants (Expr::Xml*) and parser paths for XMLCONCAT, XMLELEMENT, XMLFOREST, XMLPARSE, XMLPI, XMLROOT, and XMLSERIALIZE, aligned with PostgreSQL XML function syntax (PostgreSQL XML functions)

Implementation is intentionally enabled for both PostgreSqlDialect and GenericDialect, while non-target dialects keep treating xml* names as ordinary function identifiers and reject XML-special grammar forms.

The test updates explicitly lock these dialect boundaries, add AST-shape coverage for all new XML nodes, and prefer structural assertions over formatting-sensitive string checks.

This PR DOES NOT add support for XML parsing of course, which remains something that the user should validate, since PostgreSQL itself will accept (and fail at runtime) queries with invalid XML. Whether we should raise errors there is debatable.

@LucaCappelletti94 LucaCappelletti94 marked this pull request as ready for review February 27, 2026 10:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant