From b4c8d49036b971d892b2dfe1c71d3f0cee116e7f Mon Sep 17 00:00:00 2001 From: Peter Eisentraut Date: Sat, 20 Jan 2007 09:27:20 +0000 Subject: Fix xmlconcat by properly merging the XML declarations. Add aggregate function xmlagg. --- src/test/regress/expected/xml.out | 26 +++++++++++++++++++++++++- src/test/regress/expected/xml_1.out | 16 ++++++++++++++++ src/test/regress/sql/xml.sql | 6 ++++++ 3 files changed, 47 insertions(+), 1 deletion(-) (limited to 'src/test') diff --git a/src/test/regress/expected/xml.out b/src/test/regress/expected/xml.out index cfac9105d9..df625c90bb 100644 --- a/src/test/regress/expected/xml.out +++ b/src/test/regress/expected/xml.out @@ -55,6 +55,12 @@ ERROR: argument of XMLCONCAT must be type xml, not type integer SELECT xmlconcat('bad', '' +SELECT xmlconcat('', NULL, ''); + xmlconcat +--------------------------------------------------- + +(1 row) + SELECT xmlelement(name element, xmlattributes (1 as one, 'deuce' as two), 'content'); @@ -190,7 +196,7 @@ SELECT xmlpi(name foo, ' bar'); (1 row) SELECT xmlroot(xml '', version no value, standalone no value); - xmlroot + xmlroot --------- @@ -268,6 +274,24 @@ SELECT xml 'abc' IS NOT DOCUMENT; SELECT '<>' IS NOT DOCUMENT; ERROR: invalid XML content DETAIL: Element name not found +SELECT xmlagg(data) FROM xmltest; + xmlagg +-------------------------------------- + onetwo +(1 row) + +SELECT xmlagg(data) FROM xmltest WHERE id > 10; + xmlagg +-------- + +(1 row) + +SELECT xmlelement(name employees, xmlagg(xmlelement(name name, name))) FROM emp; + xmlelement +-------------------------------------------------------------------------------------------------------------------------------- + sharonsambilljeffcimlinda +(1 row) + -- Check mapping SQL identifier to XML name SELECT xmlpi(name ":::_xml_abc135.%-&_"); xmlpi diff --git a/src/test/regress/expected/xml_1.out b/src/test/regress/expected/xml_1.out index b25df3d24b..dd35f1bf4e 100644 --- a/src/test/regress/expected/xml_1.out +++ b/src/test/regress/expected/xml_1.out @@ -33,6 +33,8 @@ SELECT xmlconcat(1, 2); ERROR: argument of XMLCONCAT must be type xml, not type integer SELECT xmlconcat('bad', '', NULL, ''); +ERROR: no XML support in this installation SELECT xmlelement(name element, xmlattributes (1 as one, 'deuce' as two), 'content'); @@ -123,6 +125,20 @@ SELECT xml 'abc' IS NOT DOCUMENT; ERROR: no XML support in this installation SELECT '<>' IS NOT DOCUMENT; ERROR: no XML support in this installation +SELECT xmlagg(data) FROM xmltest; + xmlagg +-------- + +(1 row) + +SELECT xmlagg(data) FROM xmltest WHERE id > 10; + xmlagg +-------- + +(1 row) + +SELECT xmlelement(name employees, xmlagg(xmlelement(name name, name))) FROM emp; +ERROR: no XML support in this installation -- Check mapping SQL identifier to XML name SELECT xmlpi(name ":::_xml_abc135.%-&_"); ERROR: no XML support in this installation diff --git a/src/test/regress/sql/xml.sql b/src/test/regress/sql/xml.sql index 804cd2c2d6..8e32183159 100644 --- a/src/test/regress/sql/xml.sql +++ b/src/test/regress/sql/xml.sql @@ -24,6 +24,7 @@ SELECT xmlconcat(xmlcomment('hello'), SELECT xmlconcat('hello', 'you'); SELECT xmlconcat(1, 2); SELECT xmlconcat('bad', '', NULL, ''); SELECT xmlelement(name element, @@ -97,6 +98,11 @@ SELECT xml 'abc' IS NOT DOCUMENT; SELECT '<>' IS NOT DOCUMENT; +SELECT xmlagg(data) FROM xmltest; +SELECT xmlagg(data) FROM xmltest WHERE id > 10; +SELECT xmlelement(name employees, xmlagg(xmlelement(name name, name))) FROM emp; + + -- Check mapping SQL identifier to XML name SELECT xmlpi(name ":::_xml_abc135.%-&_"); -- cgit v1.2.1