On 23.01.25 07:50, Pavel Stehule wrote: > I think so in this form (just forward input to output) I have no > objection. > > There is a benefit with a) possible zero work with migration from db2, > b) nobody needs to repeat a work which is a correct implementation of > XMLDOCUMENT function. > > Maybe opened question can be implementation like classic scalar > function or via XmlExpr > > In this moment I prefer to use XmlExpr from consistency reasons
To keep it consistent with the existing code, I think this function is in the right place. There are similar functions in xml.c, e.g. xmltotext, texttoxml.
These functions are cast functions - they should be V1 functions only - casting cannot work with pseudo functions.
But it is true, so xmlcomment is not a pseudo function either. So minimally this function is precedent, so there is not strong dependency on XmlExp, which I expected.
I updated the function comment and commit message (v4 attached) to make things clearer.
Since the status of this patch is waiting on author, is there anything else I should take a look / improve?