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? 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&bar <el/> <foo>42</foo><bar>73</bar> (4 rows) Thanks! Best, Jim