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-24 11:31:58
Message-ID: CAFj8pRB=Rv8tByf3TWTooO7MBVM2F=xCNMAgOTK6BM1e0uq-DQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

pá 24. 1. 2025 v 9:12 odesílatel Jim Jones <jim(dot)jones(at)uni-muenster(dot)de>
napsal:

> Hi
>
> On 24.01.25 07:28, Pavel Stehule wrote:
> > I think documentation should be strongly enhanced. This is probably
> > the hardest part of this patch - explain well what this function does
> > and what it doesn't.
>
> You mean something like this? Or perhaps something more technical?
>

I don't know what it means - `function returns a document node` in the
context of Postgres implementation of XML.
I miss the information so it returns an input argument without changing
anything, because in a system, where XML expression
holds a complete string (not graph like some other systems), it just does
nothing.

If somebody looks the source code, then he should be in panic mode, because
the doc talks about returning "document node",
and it is just an argument. So it should be explained more in PostgreSQL
XML design, and less in SQL/XML description. Because
In this case, SQL/XML description (in postgresql context) is absolutely
confusing.

Regards

Pavel

> The <function>xmldocument</function> function returns a document node,
> representing an XML document, from the provided <type>xml</type>
> expression. The input expression can represent any valid XML content,
> including elements, text, or a sequence of nodes. If the
> <type>xml</type> expression is NULL, the function returns NULL. This
> function does not require the input to have a single root node or
> encapsulate the result in a root element. The validation of the
> <type>xml</type> expression depends on the current <xref
> linkend="guc-xmloption"/> setting.
>

> Example:
>
> WITH xmldata (val) AS (
> VALUES
> (xmlparse(DOCUMENT '<root><foo>bar</foo></root>')),
> (xmltext('foo&bar')),
> (xmlelement(NAME el)),
> (xmlforest(42 AS foo, 73 AS bar))
> )
> SELECT xmldocument(val) FROM xmldata;
>
> xmldocument
> -----------------------------
> <root><foo>bar</foo></root>
> foo&amp;bar
> <el/>
> <foo>42</foo><bar>73</bar>
> (4 rows)
>
>
> Thanks!
>
> Best, Jim
>
>

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Frédéric Yhuel 2025-01-24 11:34:08 Re: doc: explain pgstatindex fragmentation
Previous Message Amul Sul 2025-01-24 10:50:00 Re: Allow NOT VALID foreign key constraints on partitioned tables.