Re: XMLDocument (SQL/XML X030)

Поиск
Список
Период
Сортировка
От Pavel Stehule
Тема Re: XMLDocument (SQL/XML X030)
Дата
Msg-id CAFj8pRBWSZ1iyvaYy53x2R1JxCUbv2qUEY4ePLRSzeivgqWZ7Q@mail.gmail.com
обсуждение исходный текст
Ответ на XMLDocument (SQL/XML X030)  (Jim Jones <jim.jones@uni-muenster.de>)
Ответы Re: XMLDocument (SQL/XML X030)
Список 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 по дате отправления: