pá 24. 1. 2025 v 13:21 odesílatel Jim Jones <jim.jo...@uni-muenster.de> napsal:
> > On 24.01.25 12:31, Pavel Stehule wrote: > > 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. > > > I see. I borrowed document node from the XML standard. > > Perhaps it is more palatable like this? > > > The <function>xmldocument</function> function creates an XML value from > the given <type>xml</type> expression. The input can include any valid > XML content, such as elements, text, or a mixture of elements and text. > If the <type>xml</type> expression is NULL, the function returns NULL. > This function does not require the input to have a single root element > and does not wrap the result in one - instead, it returns an exact XML > representation of the input <type>xml</type> expression. The validation > of the <type>xml</type> expression depends on the current <xref > linkend="guc-xmloption"/> setting. > It is still confusing (and I understand so it can be hard to describe a function that does nothing). As a PostgreSQL user, and reader documentation, I have question what is difference between XMLDOCUMENT( some xml expr) and just xml expr Is there different result SELECT XMLDOCUMENT(XMLELEMENT(name a, 10)) and SELECT XMLELEMENT(name a, 10) ? Lot of users use XML functions without XMLDOCUMENT now. The doc should to help with a reply to question where and when I need (I can) use this function. This should be in context of Postgres where every XML expr returns XML value, so sentence creates an XML value from XML expression is still very confusing What some like "SQL/XML introduces XMLDOCUMENT function to returns a document node from XML tree of some XML value. This has not any sense (because XML in Postgres is always materialized to string) in PostgreSQL implementation of XML, and the function just returns input value". Or some like that. > > > Best, Jim > > >