From 19749fb0cf16dbb3a3e71b0c387edef907ea5d6b Mon Sep 17 00:00:00 2001 From: Peter Eisentraut Date: Sat, 6 Jan 2007 19:18:36 +0000 Subject: Replace xmlroot with a properly functioning version that parses the value, sets the items, and serializes the value back (rather than adding an arbitrary number of XML preambles as before). The libxml memory management via palloc had to be disabled because it crashes when libxml tries to access memory that was helpfully freed earlier by PostgreSQL. This needs further thought. --- src/test/regress/expected/xml.out | 32 +++++++++++++++++++++++++++++--- src/test/regress/expected/xml_1.out | 6 ++++++ src/test/regress/sql/xml.sql | 3 +++ 3 files changed, 38 insertions(+), 3 deletions(-) (limited to 'src/test') diff --git a/src/test/regress/expected/xml.out b/src/test/regress/expected/xml.out index 1474465612..9ebef1404b 100644 --- a/src/test/regress/expected/xml.out +++ b/src/test/regress/expected/xml.out @@ -124,6 +124,30 @@ SELECT xmlpi(name foo, 'bar'); SELECT xmlpi(name foo, 'in?>valid'); ERROR: invalid XML processing instruction DETAIL: XML processing instruction cannot contain "?>". +SELECT xmlroot(xml '', version no value, standalone no value); + xmlroot +----------------------- + + + +(1 row) + +SELECT xmlroot(xml '', version '2.0'); + xmlroot +----------------------- + + + +(1 row) + +SELECT xmlroot(xmlroot(xml '', version '1.0'), version '1.1', standalone no); + xmlroot +--------------------------------------- + + + +(1 row) + SELECT xmlroot ( xmlelement ( name gazonk, @@ -139,9 +163,11 @@ SELECT xmlroot ( version '1.0', standalone yes ); - xmlroot ------------------------------------------------------------------------------------------- - foo + xmlroot +---------------------------------------------------- + + foo + (1 row) SELECT xmlserialize(content data as character varying) FROM xmltest; diff --git a/src/test/regress/expected/xml_1.out b/src/test/regress/expected/xml_1.out index 259bccbf4b..662c0e236a 100644 --- a/src/test/regress/expected/xml_1.out +++ b/src/test/regress/expected/xml_1.out @@ -62,6 +62,12 @@ SELECT xmlpi(name foo, 'bar'); ERROR: no XML support in this installation SELECT xmlpi(name foo, 'in?>valid'); ERROR: no XML support in this installation +SELECT xmlroot(xml '', version no value, standalone no value); +ERROR: no XML support in this installation +SELECT xmlroot(xml '', version '2.0'); +ERROR: no XML support in this installation +SELECT xmlroot(xmlroot(xml '', version '1.0'), version '1.1', standalone no); +ERROR: no XML support in this installation SELECT xmlroot ( xmlelement ( name gazonk, diff --git a/src/test/regress/sql/xml.sql b/src/test/regress/sql/xml.sql index 11db4905c7..cf96beab06 100644 --- a/src/test/regress/sql/xml.sql +++ b/src/test/regress/sql/xml.sql @@ -52,6 +52,9 @@ SELECT xmlpi(name xmlstuff); SELECT xmlpi(name foo, 'bar'); SELECT xmlpi(name foo, 'in?>valid'); +SELECT xmlroot(xml '', version no value, standalone no value); +SELECT xmlroot(xml '', version '2.0'); +SELECT xmlroot(xmlroot(xml '', version '1.0'), version '1.1', standalone no); SELECT xmlroot ( xmlelement ( -- cgit v1.2.1