Hi, Thank you for the patch, Jim.
I tested v1-0001 on current master (8303f2e), built with --with-libxml and --enable-cassert. The patch applied cleanly. Without the patch, I could reproduce the problem. With your example, column c2 (domain over xml) returns "x", while the xml column c1 returns "<a>x</a>". With the patch, both columns return "<a>x</a>". The SQL from your new regression test fails on master with "more than one value returned by column XPath expression" and works with the patch. I also tried a few variations. With the patch: * A domain over another domain over xml behaves like xml. * A domain over xml with CHECK (value IS DOCUMENT) returns the document for path '.', and raises the check constraint error when the path returns two elements. * An empty element <a/> and a comment() result in a domain column look the same as in an xml column. * Columns of type text, varchar, and domains over text and int gave the same result as without the patch. * A "default" clause and a no-match path gave the same result as without the patch. * FOR ORDINALITY together with a domain column works. I read the change in XmlTableGetValue(). It looks small and clear to me. The domain's own input function is still used, so the domain constraints still run. What I did not test: * make check or make check-world, and the TAP tests. * The xml regression test itself against an unpatched tree. * Other platforms, or builds without libxml. * Domain over xml with a typmod, or domain over an array of xml. * Whether other places in xml.c need the same getBaseType() change. Thank you again for working on this. Best regards, Joao Rito
