diff options
author | Peter Eisentraut <peter_e@gmx.net> | 2007-01-12 16:29:24 +0000 |
---|---|---|
committer | Peter Eisentraut <peter_e@gmx.net> | 2007-01-12 16:29:24 +0000 |
commit | fc568b9d8f6b30d0a5573b73c719e23fa0a6a979 (patch) | |
tree | 2e278d8d355af1994d2ea937e7943929600fef3c /src/test | |
parent | 1b1c6ed70aff2e56c83930b5238f948e1a6c77c8 (diff) |
Allow for arbitrary data types as content in XMLELEMENT. The original
coercion to type xml was a mistake. Escape values so they are valid
XML character data.
Diffstat (limited to 'src/test')
-rw-r--r-- | src/test/regress/expected/xml.out | 38 | ||||
-rw-r--r-- | src/test/regress/expected/xml_1.out | 14 | ||||
-rw-r--r-- | src/test/regress/sql/xml.sql | 8 |
3 files changed, 55 insertions, 5 deletions
diff --git a/src/test/regress/expected/xml.out b/src/test/regress/expected/xml.out index 4179233e999..275523727b4 100644 --- a/src/test/regress/expected/xml.out +++ b/src/test/regress/expected/xml.out @@ -83,10 +83,44 @@ SELECT xmlelement(name employee, xmlforest(name, age, salary as pay)) FROM emp; <employee><name>linda</name><age>19</age><pay>100</pay></employee> (6 rows) -SELECT xmlelement(name wrong, 37); -ERROR: argument of XMLELEMENT must be type xml, not type integer SELECT xmlelement(name duplicate, xmlattributes(1 as a, 2 as b, 3 as a)); ERROR: XML attribute name "a" appears more than once +SELECT xmlelement(name num, 37); + xmlelement +--------------- + <num>37</num> +(1 row) + +SELECT xmlelement(name foo, text 'bar'); + xmlelement +---------------- + <foo>bar</foo> +(1 row) + +SELECT xmlelement(name foo, xml 'bar'); + xmlelement +---------------- + <foo>bar</foo> +(1 row) + +SELECT xmlelement(name foo, text 'b<a/>r'); + xmlelement +------------------------- + <foo>b<a/>r</foo> +(1 row) + +SELECT xmlelement(name foo, xml 'b<a/>r'); + xmlelement +------------------- + <foo>b<a/>r</foo> +(1 row) + +SELECT xmlelement(name foo, array[1, 2, 3]); + xmlelement +------------------------------------------------------------------------- + <foo><element>1</element><element>2</element><element>3</element></foo> +(1 row) + SELECT xmlparse(content 'abc'); xmlparse ---------- diff --git a/src/test/regress/expected/xml_1.out b/src/test/regress/expected/xml_1.out index 8ef963b8e9d..9ff3959160e 100644 --- a/src/test/regress/expected/xml_1.out +++ b/src/test/regress/expected/xml_1.out @@ -44,10 +44,20 @@ SELECT xmlelement(name element, xmlelement(name nested, 'stuff')); ERROR: no XML support in this installation SELECT xmlelement(name employee, xmlforest(name, age, salary as pay)) FROM emp; ERROR: no XML support in this installation -SELECT xmlelement(name wrong, 37); -ERROR: no XML support in this installation SELECT xmlelement(name duplicate, xmlattributes(1 as a, 2 as b, 3 as a)); ERROR: no XML support in this installation +SELECT xmlelement(name num, 37); +ERROR: no XML support in this installation +SELECT xmlelement(name foo, text 'bar'); +ERROR: no XML support in this installation +SELECT xmlelement(name foo, xml 'bar'); +ERROR: no XML support in this installation +SELECT xmlelement(name foo, text 'b<a/>r'); +ERROR: no XML support in this installation +SELECT xmlelement(name foo, xml 'b<a/>r'); +ERROR: no XML support in this installation +SELECT xmlelement(name foo, array[1, 2, 3]); +ERROR: no XML support in this installation SELECT xmlparse(content 'abc'); ERROR: no XML support in this installation SELECT xmlparse(content '<abc>x</abc>'); diff --git a/src/test/regress/sql/xml.sql b/src/test/regress/sql/xml.sql index d3a1e6104bb..a22c8251298 100644 --- a/src/test/regress/sql/xml.sql +++ b/src/test/regress/sql/xml.sql @@ -37,9 +37,15 @@ SELECT xmlelement(name element, xmlelement(name nested, 'stuff')); SELECT xmlelement(name employee, xmlforest(name, age, salary as pay)) FROM emp; -SELECT xmlelement(name wrong, 37); SELECT xmlelement(name duplicate, xmlattributes(1 as a, 2 as b, 3 as a)); +SELECT xmlelement(name num, 37); +SELECT xmlelement(name foo, text 'bar'); +SELECT xmlelement(name foo, xml 'bar'); +SELECT xmlelement(name foo, text 'b<a/>r'); +SELECT xmlelement(name foo, xml 'b<a/>r'); +SELECT xmlelement(name foo, array[1, 2, 3]); + SELECT xmlparse(content 'abc'); SELECT xmlparse(content '<abc>x</abc>'); |