-
Notifications
You must be signed in to change notification settings - Fork 751
Add xmlnamespace support mssql #2361
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
bb95612
5d63c97
a903a0c
2dbfcba
7d0b184
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -248,6 +248,11 @@ impl Dialect for MsSqlDialect { | |
| _ => None, | ||
| } | ||
| } | ||
|
|
||
| // see: https://learn.microsoft.com/en-us/sql/t-sql/xml/with-xmlnamespaces | ||
| fn supports_with_xmlnamespaces_clause(&self) -> bool { | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. can we include a link to the documentation of this syntax?
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @iffyio Added documentation link |
||
| true | ||
| } | ||
| } | ||
|
|
||
| impl MsSqlDialect { | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -2925,3 +2925,10 @@ fn parse_mssql_money_constants() { | |
| expr_from_projection(only(&select.projection)), | ||
| ); | ||
| } | ||
|
|
||
| #[test] | ||
| fn parse_xmlnamespaces() { | ||
|
|
||
| ms().verified_stmt("WITH XMLNAMESPACES ('urn:test' AS ns) SELECT 1 AS [ns:Value] FOR XML PATH('ns:Root')"); | ||
|
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. merged tests and used verifies_stmt() @iffyio |
||
| ms().verified_stmt("WITH XMLNAMESPACES ('urn:example' AS ns), t AS (SELECT 1 AS id) SELECT id FROM t"); | ||
| } | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this feature looks similar to what was done here for clickhouse CSEs, such that I'm thinking we essentially want to introduce this feature in that style instead. is xml_namespaces looks like a regular expression (CSE) so that the enum changes might even be verbatim (similarly for the dialect method name)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Indeed i use the WITH keyword as done with cte_tables, i hope i understood what you have meant.