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

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


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

On 24.01.25 22:01, Chapman Flack wrote:
> It seems to me the key connection there is that the ISO SQL standard
> defines XMLDOCUMENT by equivalence to what `document { $expr }` means
> in the W3 XML Query standard.


It seems I missed one sentence. My bad.

Next try... :)


The <function>xmldocument</function> function returns the input argument
unchanged, or <literal>NULL</literal> if the argument is
<literal>NULL</literal>, and is provided for compatibility.

The SQL-standard <replaceable>XMLDocument</replaceable> function applied
to an XML value <literal>$EXPR</literal>, has effects equivalent to the
XML Query expression <replaceable>document { $EXPR }</replaceable>. It
replaces any document nodes in the input with their children and wraps
the whole result in a single <replaceable>document node</replaceable>.

In the XML Query standard, a <replaceable>document node</replaceable>
represents a relaxed version of an XML document structure. This
corresponds to what PostgreSQL's single XML type allows, meaning that
any valid non-null PostgreSQL XML value can be returned unchanged. Other
systems may support more permissive XML data types, such as
<literal>XML(SEQUENCE)</literal>, which allow values that do not conform
to this structure. In PostgreSQL, every valid non-null value of the XML
type already has that structure, making additional processing by this
function unnecessary.

v6 attached.

I think so doc is ok now

because the function does nothing, then it is useless to convert input to XML and force detosting

Maybe the body of the function should be just

{
#ifdef USE_LIBXML
  PG_RETURN_DATUM(PG_GETARG_DATUM(0));
#else
  NO_XML_SUPPORT();
  return 0;
#endif
}


Regards

Pavel


 

Thanks.

Best regards, Jim

pgsql-hackers by date:

Previous
From: Akshat Jaimini
Date:
Subject: Re: New process of getting changes into the commitfest app
Next
From: Jeff Davis
Date:
Subject: Re: Add CASEFOLD() function.