Re: XMLDocument (SQL/XML X030)

From: Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>
To: Jim Jones <jim(dot)jones(at)uni-muenster(dot)de>
Cc: Chapman Flack <jcflack(at)acm(dot)org>, Robert Treat <rob(at)xzilla(dot)net>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: XMLDocument (SQL/XML X030)
Date: 2025-01-25 07:16:34
Message-ID: CAFj8pRBWSZ1iyvaYy53x2R1JxCUbv2qUEY4ePLRSzeivgqWZ7Q@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

pá 24. 1. 2025 v 23:11 odesílatel Jim Jones <jim(dot)jones(at)uni-muenster(dot)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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Peter Eisentraut 2025-01-25 07:18:53 Re: Index AM API cleanup
Previous Message Akshat Jaimini 2025-01-25 05:28:49 Re: New process of getting changes into the commitfest app