]> granicus.if.org Git - postgresql/commitdiff
Add regression tests for XML mapping of domains
authorPeter Eisentraut <peter_e@gmx.net>
Thu, 14 Mar 2013 02:42:57 +0000 (22:42 -0400)
committerPeter Eisentraut <peter_e@gmx.net>
Thu, 14 Mar 2013 02:42:57 +0000 (22:42 -0400)
Pavel StÄ›hule

src/test/regress/expected/xmlmap.out
src/test/regress/expected/xmlmap_1.out
src/test/regress/sql/xmlmap.sql

index d54410b2310968127143840e5445b39e7e4a8a2a..b50396face9d56a0810dfa7649c0e2f597aef5b1 100644 (file)
@@ -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)
+
index 932122f6be0fc1bce7143703fe5998f684dfb60a..d67ef6d3e24c3068b8c335156577c3340ba517ac 100644 (file)
@@ -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.
index df1f98046d31e584aa3c617d097fb0daa672f36e..8f8d680813975b04d324ad930af9f955f0a8a669 100644 (file)
@@ -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, '');