summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Eisentraut2013-03-14 02:42:57 +0000
committerPeter Eisentraut2013-03-14 02:42:57 +0000
commit788bce13d3249ddbcdf3443ee078145f4888ab45 (patch)
tree97653c8b4720465868e2f5316ddba879c83650d3
parenta18b72adcd3632aa21ebf84cc6ed1caf46ba43da (diff)
Add regression tests for XML mapping of domains
Pavel Stěhule
-rw-r--r--src/test/regress/expected/xmlmap.out27
-rw-r--r--src/test/regress/expected/xmlmap_1.out16
-rw-r--r--src/test/regress/sql/xmlmap.sql15
3 files changed, 58 insertions, 0 deletions
diff --git a/src/test/regress/expected/xmlmap.out b/src/test/regress/expected/xmlmap.out
index d54410b231..b50396face 100644
--- a/src/test/regress/expected/xmlmap.out
+++ b/src/test/regress/expected/xmlmap.out
@@ -1174,3 +1174,30 @@ SELECT schema_to_xml_and_xmlschema('testxmlschema', true, true, 'foo');
(1 row)
+-- test that domains are transformed like their base types
+CREATE DOMAIN testboolxmldomain AS bool;
+CREATE DOMAIN testdatexmldomain AS date;
+CREATE TABLE testxmlschema.test3
+ AS SELECT true c1,
+ true::testboolxmldomain c2,
+ '2013-02-21'::date c3,
+ '2013-02-21'::testdatexmldomain c4;
+SELECT xmlforest(c1, c2, c3, c4) FROM testxmlschema.test3;
+ xmlforest
+------------------------------------------------------------------
+ <c1>true</c1><c2>true</c2><c3>2013-02-21</c3><c4>2013-02-21</c4>
+(1 row)
+
+SELECT table_to_xml('testxmlschema.test3', true, true, '');
+ table_to_xml
+---------------------------------------------------------------
+ <test3 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">+
+ <c1>true</c1> +
+ <c2>true</c2> +
+ <c3>2013-02-21</c3> +
+ <c4>2013-02-21</c4> +
+ </test3> +
+ +
+
+(1 row)
+
diff --git a/src/test/regress/expected/xmlmap_1.out b/src/test/regress/expected/xmlmap_1.out
index 932122f6be..d67ef6d3e2 100644
--- a/src/test/regress/expected/xmlmap_1.out
+++ b/src/test/regress/expected/xmlmap_1.out
@@ -107,3 +107,19 @@ SELECT schema_to_xml_and_xmlschema('testxmlschema', true, true, 'foo');
ERROR: unsupported XML feature
DETAIL: This functionality requires the server to be built with libxml support.
HINT: You need to rebuild PostgreSQL using --with-libxml.
+-- test that domains are transformed like their base types
+CREATE DOMAIN testboolxmldomain AS bool;
+CREATE DOMAIN testdatexmldomain AS date;
+CREATE TABLE testxmlschema.test3
+ AS SELECT true c1,
+ true::testboolxmldomain c2,
+ '2013-02-21'::date c3,
+ '2013-02-21'::testdatexmldomain c4;
+SELECT xmlforest(c1, c2, c3, c4) FROM testxmlschema.test3;
+ERROR: unsupported XML feature
+DETAIL: This functionality requires the server to be built with libxml support.
+HINT: You need to rebuild PostgreSQL using --with-libxml.
+SELECT table_to_xml('testxmlschema.test3', true, true, '');
+ERROR: unsupported XML feature
+DETAIL: This functionality requires the server to be built with libxml support.
+HINT: You need to rebuild PostgreSQL using --with-libxml.
diff --git a/src/test/regress/sql/xmlmap.sql b/src/test/regress/sql/xmlmap.sql
index df1f98046d..8f8d680813 100644
--- a/src/test/regress/sql/xmlmap.sql
+++ b/src/test/regress/sql/xmlmap.sql
@@ -39,3 +39,18 @@ SELECT schema_to_xml('testxmlschema', true, false, '');
SELECT schema_to_xmlschema('testxmlschema', false, true, '');
SELECT schema_to_xmlschema('testxmlschema', true, false, '');
SELECT schema_to_xml_and_xmlschema('testxmlschema', true, true, 'foo');
+
+
+-- test that domains are transformed like their base types
+
+CREATE DOMAIN testboolxmldomain AS bool;
+CREATE DOMAIN testdatexmldomain AS date;
+
+CREATE TABLE testxmlschema.test3
+ AS SELECT true c1,
+ true::testboolxmldomain c2,
+ '2013-02-21'::date c3,
+ '2013-02-21'::testdatexmldomain c4;
+
+SELECT xmlforest(c1, c2, c3, c4) FROM testxmlschema.test3;
+SELECT table_to_xml('testxmlschema.test3', true, true, '');