Re: Add XMLNamespaces to XMLElement
newtglobal postgresql_contributors <postgresql_contributors@newtglobalcorp.com>
From: newtglobal postgresql_contributors
<postgresql_contributors@newtglobalcorp.com>
To: pgsql-hackers@lists.postgresql.org
Cc: Pavel Stehule <pavel.stehule@gmail.com>,
Jim Jones <jim.jones@uni-muenster.de>
Date: 2025-03-13T06:51:40Z
Lists: pgsql-hackers
The following review has been posted through the commitfest application:
make installcheck-world: not tested
Implements feature: not tested
Spec compliant: not tested
Documentation: not tested
Hi Pavel,
I have tested this patch, and it proves to be highly useful when handling XMLNAMESPACES() with both DEFAULT and NO DEFAULT options. The following test cases confirm its correctness:
SELECT xmlelement(
NAME "foo",
XMLNAMESPACES('http://x.y' AS xy, 'http://a.b' AS ab, DEFAULT 'http://d.e'),
xmlelement(NAME "foot",
xmlelement(NAME "xy:shoe"),
xmlelement(NAME "ab:lace")
)
);
SELECT xmlelement(
NAME "foo",
XMLNAMESPACES('http://x.y' AS xy, 'http://a.b' AS ab, NO DEFAULT),
xmlelement(NAME "foot",
xmlelement(NAME "xy:shoe"),
xmlelement(NAME "ab:lace")
)
);
Additionally, I verified that the patch correctly supports multiple namespaces when using both DEFAULT and NO DEFAULT, ensuring expected behavior across different use cases.
Great work on this improvement!