Skip to content

Postgres: Support XML functions (XMLELEMENT, XMLPI, XMLROOT, XMLSERIALIZE, XMLEXISTS) - #2507

Open
BenSatori wants to merge 1 commit into
apache:mainfrom
BenSatori:postgres-xml-functions
Open

Postgres: Support XML functions (XMLELEMENT, XMLPI, XMLROOT, XMLSERIALIZE, XMLEXISTS)#2507
BenSatori wants to merge 1 commit into
apache:mainfrom
BenSatori:postgres-xml-functions

Conversation

@BenSatori

Copy link
Copy Markdown
Contributor

Adds support for PostgreSQL XML function syntaxes:

  • XMLELEMENT(NAME name [, XMLATTRIBUTES(...) ] [, content [, ...]])
  • XMLPI(NAME name [, content ])
  • XMLROOT(xml, VERSION {text | NO VALUE} [, STANDALONE {YES | NO | NO VALUE} ])
  • XMLSERIALIZE({ DOCUMENT | CONTENT } value AS type [ [ NO ] INDENT ])
  • XMLEXISTS(text PASSING [BY {REF|VALUE}] xml [BY {REF|VALUE}])

Example

SELECT XMLELEMENT(NAME foo, 'bar'), * FROM customers;
SELECT XMLELEMENT(NAME foo, XMLATTRIBUTES('v' AS attr), 'bar');
SELECT XMLROOT('<a/>'::xml, VERSION '1.0');
SELECT XMLSERIALIZE(DOCUMENT '<a/>'::xml AS TEXT);
SELECT XMLEXISTS('/a' PASSING BY REF '<a/>');

Docs:

AI Assistance: Code authored and validated with GitHub Copilot.

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