Adding support for PostgreSQL's XML functions#2252
Adding support for PostgreSQL's XML functions#2252LucaCappelletti94 wants to merge 3 commits intoapache:mainfrom
Conversation
| // an unary negation `NOT ('a' LIKE 'b')`. To solve this, we don't accept the | ||
| // `type 'string'` syntax for the custom data types at all. | ||
| DataType::Custom(type_name, modifiers) | ||
| if dialect_of!(self is PostgreSqlDialect | GenericDialect) |
There was a problem hiding this comment.
Can we use a dialect method for this?
yoavcloud
left a comment
There was a problem hiding this comment.
Hey @LucaCappelletti94. There are many more changes in this PR than are required to address the missing functionality, which makes code review harder.
I'm all for using coding agents to speed up the development of the project, but the bottleneck now becomes reviewing the PRs.
We should come up with guidelines for the proper usage of coding agents and I will do my best to advance this with the project members. In the meantime, can you please prepare a lighter version of this change?
|
TLDR: I was trying to add these missing features as fast as the postgres differential fuzzer I had was finding them, and I ended up rushing bad code. Then the fuzzer found some goldmine of hundreds of missing things (which I decided to not look into it for the time) and I gave up with the PR series. I will explode this PR in tiny focused ones. I will publish that fuzzer in another repo so that it can be used to gauge completes. It is nothing fancy, just honggfuzzer seeded with Postgres corpus of statements. |
This PR adds PostgreSQL XML expression support to
sqlparser-rsby introducing dedicated AST variants (Expr::Xml*) and parser paths forXMLCONCAT,XMLELEMENT,XMLFOREST,XMLPARSE,XMLPI,XMLROOT, andXMLSERIALIZE, aligned with PostgreSQL XML function syntax (PostgreSQL XML functions)Implementation is intentionally enabled for both
PostgreSqlDialectandGenericDialect, while non-target dialects keep treatingxml*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.