Re: XMLDocument (SQL/XML X030) - Mailing list pgsql-hackers

From Pavel Stehule
Subject Re: XMLDocument (SQL/XML X030)
Date
Msg-id CAFj8pRD1zE9FT_HFfrnWxPNED_yZRi889h9uwQ3+W4GTDcPeCw@mail.gmail.com
Whole thread Raw
In response to Re: XMLDocument (SQL/XML X030)  (Jim Jones <jim.jones@uni-muenster.de>)
List pgsql-hackers


pá 24. 1. 2025 v 14:48 odesílatel Jim Jones <jim.jones@uni-muenster.de> napsal:

On 24.01.25 13:48, Pavel Stehule wrote:
> Lot of users use XML functions without XMLDOCUMENT now. The doc should to
> help with a reply to question where and when I need (I can) use this
> function. This should
> be in context of Postgres where every XML expr returns XML value, so
> sentence
> creates an XML value from XML expression is still very confusing
>
> What some like
>
> "SQL/XML introduces XMLDOCUMENT function to  returns a document node
> from XML tree of some XML value.
> This has not any sense (because XML in Postgres is always materialized
> to string) in PostgreSQL implementation of XML, and the function just
> returns
> input value". Or some like that.


I see. I tried to incorporate your suggestion in the text:

In the SQL/XML specification, the XMLDocument (X030) function is
designed to return a document node from a given XML value expression.
Since PostgreSQL handles XML values as materialized strings rather than
tree structures, this function does not produce a document node
structure but instead returns the validated input <type>xml</type> value
as-is. The input <type>xml</type> value can include any valid XML
content, such as elements, text, or a mixture of both. This function
does not require the input to have a single root element and does not
wrap the result in one. Validation of the <type>xml</type> input value
depends on the current <xref linkend="guc-xmloption"/> setting. If the
input <type>xml</type> value is NULL, the function returns NULL. This
function ensures compatibility with the SQL/XML specification, making it
particularly useful when migrating SQL queries from other database
systems that also implement this standard.

Let me know if it is still confusing ...

it is ok for me now. Thank you

Pavel
 

Thanks!

Best, Jim

pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: why -Fdance archive format option works with ./pg_restore but not with ./pg_dump?
Next
From: Nazir Bilal Yavuz
Date:
Subject: Re: Show WAL write and fsync stats in pg_stat_io