On 16.01.25 08:21, Jim Jones wrote:
> On 16.01.25 07:11, Pavel Stehule wrote:
>> It is better.
> v2 attached updates the documentation.
>> My note was related to a very different description of this
>> functionality in DB2. So if you propose this function for better
>> compatibility (and this function is implemented only by db2), it is
>> surprising to see that this functionality is described (and probably
>> implemented) very differently. Because I do not have db2 and I miss
>> db2 knowledge, I don't know if differences in implementation and
>> description are based on different technology (XML like graph or XML
>> like string) or if it is something that is missing in this patch.
> I suppose it's mostly because PostgreSQL and DB2 have different
> structures for the XML data type; DB2 stores it in its native
> hierarchical format rather than as text.
>
> Thanks for the review.
>
> Best, Jim


The DB2 "Document node constructors" might provide some insights into
its behavior regarding well-formed XML documents [1]:

"No validation is performed on the constructed document node. The XQuery
document node constructor does not enforce the XML 1.0 rules that govern
the structure of an XML document. For example, a document node is not
required to have exactly one child that is an element node."

This suggests that DB2's design reflects a different approach to
handling XML, focusing less on enforcing XML 1.0 constraints. It appears
to be more of a design philosophy regarding how XML is integrated into
the database system as a whole, rather than just a difference in the
implementation of the XMLDocument function.

PostgreSQL does not support the RETURNING SEQUENCE or RETURNING CONTENT
clauses explicitly. Instead, it implicitly uses RETURNING CONTENT[2] in
functions that require it. Since RETURNING CONTENT implies that the
output is a well-formed XML document (e.g., single-rooted), I would
argue that the behavior of this patch is more intuitive and aligns best
with the expectations of XML document structure.

Any thoughts?

Best, Jim

1 - https://www.ibm.com/docs/en/db2/11.1?topic=constructors-document-node
2 - https://www.postgresql.org/docs/17/xml-limits-conformance.html


Reply via email to