Fix incorrect xmlschema output for types timetz and timestamptz.
authorTom Lane
Fri, 18 Mar 2022 20:01:42 +0000 (16:01 -0400)
committerTom Lane
Fri, 18 Mar 2022 20:01:42 +0000 (16:01 -0400)
The output of table_to_xmlschema() and allied functions includes
a regex describing valid values for these types ... but the regex
was itself invalid, as it failed to escape a literal "+" sign.

Report and fix by Renan Soares Lopes.  Back-patch to all
supported branches.

Discussion: https://postgr.es/m/7f6fabaa-3f8f-49ab-89ca-59fbfe633105@me.com

src/backend/utils/adt/xml.c
src/test/regress/expected/xmlmap.out
src/test/regress/expected/xmlmap_1.out
src/test/regress/sql/xmlmap.sql

index 51773db8901fb3c1feaddf60f6ab27fcc55caf53..801ad8fa4ecdda28ab5e4e56692e4e351398f2f2 100644 (file)
@@ -3659,7 +3659,7 @@ map_sql_type_to_xmlschema_type(Oid typeoid, int typmod)
            case TIMEOID:
            case TIMETZOID:
                {
-                   const char *tz = (typeoid == TIMETZOID ? "(+|-)\\p{Nd}{2}:\\p{Nd}{2}" : "");
+                   const char *tz = (typeoid == TIMETZOID ? "(\\+|-)\\p{Nd}{2}:\\p{Nd}{2}" : "");
 
                    if (typmod == -1)
                        appendStringInfo(&result,
@@ -3682,7 +3682,7 @@ map_sql_type_to_xmlschema_type(Oid typeoid, int typmod)
            case TIMESTAMPOID:
            case TIMESTAMPTZOID:
                {
-                   const char *tz = (typeoid == TIMESTAMPTZOID ? "(+|-)\\p{Nd}{2}:\\p{Nd}{2}" : "");
+                   const char *tz = (typeoid == TIMESTAMPTZOID ? "(\\+|-)\\p{Nd}{2}:\\p{Nd}{2}" : "");
 
                    if (typmod == -1)
                        appendStringInfo(&result,
index c08f8a0d9c17a466c63a83150ce2baa49445f971..ccc5460663019bcfe280802567c73f3214b8d561 100644 (file)
@@ -2,9 +2,15 @@ CREATE SCHEMA testxmlschema;
 CREATE TABLE testxmlschema.test1 (a int, b text);
 INSERT INTO testxmlschema.test1 VALUES (1, 'one'), (2, 'two'), (-1, null);
 CREATE DOMAIN testxmldomain AS varchar;
-CREATE TABLE testxmlschema.test2 (z int, y varchar(500), x char(6), w numeric(9,2), v smallint, u bigint, t real, s time, r timestamp, q date, p xml, o testxmldomain, n bool, m bytea, aaa text);
+CREATE TABLE testxmlschema.test2 (z int, y varchar(500), x char(6),
+    w numeric(9,2), v smallint, u bigint, t real,
+    s time, stz timetz, r timestamp, rtz timestamptz, q date,
+    p xml, o testxmldomain, n bool, m bytea, aaa text);
 ALTER TABLE testxmlschema.test2 DROP COLUMN aaa;
-INSERT INTO testxmlschema.test2 VALUES (55, 'abc', 'def', 98.6, 2, 999, 0, '21:07', '2009-06-08 21:07:30', '2009-06-08', NULL, 'ABC', true, 'XYZ');
+INSERT INTO testxmlschema.test2 VALUES (55, 'abc', 'def',
+    98.6, 2, 999, 0,
+    '21:07', '21:11 +05', '2009-06-08 21:07:30', '2009-06-08 21:07:30 -07', '2009-06-08',
+    NULL, 'ABC', true, 'XYZ');
 SELECT table_to_xml('testxmlschema.test1', false, false, '');
                          table_to_xml                          
 ---------------------------------------------------------------
@@ -107,7 +113,9 @@ SELECT table_to_xml('testxmlschema.test2', false, false, '');
    999                                                 +
    0                                                   +
    21:07:00                                            +
+   21:11:00+05                                     +
    2009-06-08T21:07:30                                 +
+   2009-06-08T21:07:30-07:00                       +
    2009-06-08                                          +
    ABC                                                 +
    true                                                +
@@ -253,113 +261,127 @@ SELECT table_to_xmlschema('testxmlschema.test1', true, true, '');
 (1 row)
 
 SELECT table_to_xmlschema('testxmlschema.test2', false, false, '');
-                                               table_to_xmlschema                                                
------------------------------------------------------------------------------------------------------------------
-     xmlns:xsd="http://www.w3.org/2001/XMLSchema">                                                              +
-                                                                                                                +
                                                                                +
-                                                                                +
-                                                                          +
-                                                                         +
-                                                                                              +
-                                                                                               +
-                                                                                                                +
                                                                                +
-                                                                             +
-                                                                                              +
-                                                                                               +
-                                                                                                                +
                                                                                   +
-                                                                             +
-                                                                                              +
-                                                                                               +
-                                                                                                                +
                                                                                +
-                                                                                               +
-                                                                                                                +
                                                                               +
-                                                                              +
-                                                                               +
-                                                                              +
-                                                                                              +
-                                                                                               +
-                                                                                                                +
                                                                                 +
-                                                                               +
-                                                                 +
-                                                                +
-                                                                                              +
-                                                                                               +
-                                                                                                                +
                                                                                   +
-                                                            +
-                                                                                               +
-                                                                                                                +
                                                                                   +
-                                                                               +
-                                                 +
-                                                                                              +
-                                                                                               +
-                                                                                                                +
                                                                              +
-                                                                           +
-                   +
-                                                                                              +
-                                                                                               +
-                                                                                                                +
                                                                                   +
-                                                                               +
-                                                            +
-                                                                                              +
-                                                                                               +
-                                                                                                                +
                                                                                 +
-                                                                                                  +
-                            +
-                                                                                                 +
-                                                                                              +
-                                                                                                                +
                                                 +
-                                                                               +
-                                                                                               +
-                                                                                                                +
                                                                                +
-                                                          +
-                                                                                               +
-                                                                                                                +
                                                        +
-                                                                       +
-                                                                                              +
-                                                                                               +
-                                                                                                                +
                                                +
-                                                                                                  +
-                                               +
-                                               +
-                                                  +
-                                               +
-                                              +
-                                                +
-                                                  +
-                                                  +
-                                             +
-                                                  +
-                                                   +
-                +
-                                               +
-                       +
-                                                                                                 +
-                                                                                              +
-                                                                                                                +
                                              +
-                                                                                                  +
-     +
-                                                                                                 +
-                                                                                              +
-                                                                                                                +
                                    +
-                                                                                                                +
+                                                     table_to_xmlschema                                                     
+----------------------------------------------------------------------------------------------------------------------------
+     xmlns:xsd="http://www.w3.org/2001/XMLSchema">                                                                         +
+                                                                                                                           +
                                                                                           +
+                                                                                           +
+                                                                                     +
+                                                                                    +
+                                                                                                         +
+                                                                                                          +
+                                                                                                                           +
                                                                                           +
+                                                                                        +
+                                                                                                         +
+                                                                                                          +
+                                                                                                                           +
                                                                                              +
+                                                                                        +
+                                                                                                         +
+                                                                                                          +
+                                                                                                                           +
                                                                                           +
+                                                                                                          +
+                                                                                                                           +
                                                                                          +
+                                                                                         +
+                                                                                          +
+                                                                                         +
+                                                                                                         +
+                                                                                                          +
+                                                                                                                           +
                                                                                            +
+                                                                                          +
+                                                                            +
+                                                                           +
+                                                                                                         +
+                                                                                                          +
+                                                                                                                           +
                                                                                              +
+                                                                       +
+                                                                                                          +
+                                                                                                                           +
                                                                                              +
+                                                                                          +
+                                                            +
+                                                                                                         +
+                                                                                                          +
+                                                                                                                           +
                                                                                          +
+                                                                                          +
+                                   +
+                                                                                                         +
+                                                                                                          +
+                                                                                                                           +
                                                                                         +
+                                                                                      +
+                              +
+                                                                                                         +
+                                                                                                          +
+                                                                                                                           +
                                                                                     +
+                                                                                      +
+     +
+                                                                                                         +
+                                                                                                          +
+                                                                                                                           +
                                                                                              +
+                                                                                          +
+                                                                       +
+                                                                                                         +
+                                                                                                          +
+                                                                                                                           +
                                                                                            +
+                                                                                                             +
+                                       +
+                                                                                                            +
+                                                                                                         +
+                                                                                                                           +
                                                            +
+                                                                                          +
+                                                                                                          +
+                                                                                                                           +
                                                                                           +
+                                                                     +
+                                                                                                          +
+                                                                                                                           +
                                                                   +
+                                                                                  +
+                                                                                                         +
+                                                                                                          +
+                                                                                                                           +
                                                           +
+                                                                                                             +
+                                                          +
+                                                          +
+                                                             +
+                                                          +
+                                                         +
+                                                           +
+                                                             +
+                                                             +
+                                                       +
+                                                        +
+                                                  +
+                                                             +
+                                                              +
+                           +
+                                                          +
+                                  +
+                                                                                                            +
+                                                                                                         +
+                                                                                                                           +
                                                         +
+                                                                                                             +
+                +
+                                                                                                            +
+                                                                                                         +
+                                                                                                                           +
                                               +
+                                                                                                                           +
  
 (1 row)
 
@@ -816,7 +838,9 @@ SELECT schema_to_xml('testxmlschema', false, true, '');
    999                                                         +
    0                                                           +
    21:07:00                                                    +
+   21:11:00+05                                             +
    2009-06-08T21:07:30                                         +
+   2009-06-08T21:07:30-07:00                               +
    2009-06-08                                                  +
    ABC                                                         +
    true                                                        +
@@ -863,7 +887,9 @@ SELECT schema_to_xml('testxmlschema', true, false, '');
    999                                                         +
    0                                                           +
    21:07:00                                                    +
+   21:11:00+05                                             +
    2009-06-08T21:07:30                                         +
+   2009-06-08T21:07:30-07:00                               +
    2009-06-08                                                  +
                                                    +
    ABC                                                         +
@@ -878,337 +904,375 @@ SELECT schema_to_xml('testxmlschema', true, false, '');
 (1 row)
 
 SELECT schema_to_xmlschema('testxmlschema', false, true, '');
-                                                schema_to_xmlschema                                                
--------------------------------------------------------------------------------------------------------------------
-     xmlns:xsd="http://www.w3.org/2001/XMLSchema">                                                                +
-                                                                                                                  +
                                                                                  +
-                                                                                  +
-                                                                            +
-                                                                           +
-                                                                                                +
-                                                                                                 +
-                                                                                                                  +
                                                           +
-                                                                               +
-                                                                                                +
-                                                                                                 +
-                                                                                                                  +
                                                                                  +
-                                                                               +
-                                                                                                +
-                                                                                                 +
-                                                                                                                  +
                                                                                     +
-                                                                               +
-                                                                                                +
-                                                                                                 +
-                                                                                                                  +
                                                                                  +
-                                                                                                 +
-                                                                                                                  +
                                                                                 +
-                                                                                +
-                                                                                 +
-                                                                                +
-                                                                                                +
-                                                                                                 +
-                                                                                                                  +
                                                                                   +
-                                                                                 +
-                                                                   +
-                                                                  +
-                                                                                                +
-                                                                                                 +
-                                                                                                                  +
                                                                                     +
-                                                              +
-                                                                                                 +
-                                                                                                                  +
                                                                                     +
-                                                                                 +
-                                                   +
-                                                                                                +
-                                                                                                 +
-                                                                                                                  +
                                                                                +
-                                                                             +
-                     +
-                                                                                                +
-                                                                                                 +
-                                                                                                                  +
                                                                                     +
-                                                                                 +
-                                                              +
-                                                                                                +
-                                                                                                 +
-                                                                                                                  +
                                                                                   +
-                                                                                                    +
-                              +
-                                                                                                   +
-                                                                                                +
-                                                                                                                  +
                                                   +
-                                                                                 +
-                                                                                                 +
-                                                                                                                  +
                                                                                  +
-                                                            +
-                                                                                                 +
-                                                                                                                  +
                                                          +
-                                                                         +
-                                                                                                +
-                                                                                                 +
-                                                                                                                  +
                                                     +
-                                                                                                    +
-     +
-     +
-                                                                                                   +
-                                                                                                +
-                                                                                                                  +
                                   +
-                                                                                                                  +
+                                                    schema_to_xmlschema                                                     
+----------------------------------------------------------------------------------------------------------------------------
+     xmlns:xsd="http://www.w3.org/2001/XMLSchema">                                                                         +
+                                                                                                                           +
                                                                                           +
+                                                                                           +
+                                                                                     +
+                                                                                    +
+                                                                                                         +
+                                                                                                          +
+                                                                                                                           +
                                                                    +
+                                                                                        +
+                                                                                                         +
+                                                                                                          +
+                                                                                                                           +
                                                                                           +
+                                                                                        +
+                                                                                                         +
+                                                                                                          +
+                                                                                                                           +
                                                                                              +
+                                                                                        +
+                                                                                                         +
+                                                                                                          +
+                                                                                                                           +
                                                                                           +
+                                                                                                          +
+                                                                                                                           +
                                                                                          +
+                                                                                         +
+                                                                                          +
+                                                                                         +
+                                                                                                         +
+                                                                                                          +
+                                                                                                                           +
                                                                                            +
+                                                                                          +
+                                                                            +
+                                                                           +
+                                                                                                         +
+                                                                                                          +
+                                                                                                                           +
                                                                                              +
+                                                                       +
+                                                                                                          +
+                                                                                                                           +
                                                                                              +
+                                                                                          +
+                                                            +
+                                                                                                         +
+                                                                                                          +
+                                                                                                                           +
                                                                                          +
+                                                                                          +
+                                   +
+                                                                                                         +
+                                                                                                          +
+                                                                                                                           +
                                                                                         +
+                                                                                      +
+                              +
+                                                                                                         +
+                                                                                                          +
+                                                                                                                           +
                                                                                     +
+                                                                                      +
+     +
+                                                                                                         +
+                                                                                                          +
+                                                                                                                           +
                                                                                              +
+                                                                                          +
+                                                                       +
+                                                                                                         +
+                                                                                                          +
+                                                                                                                           +
                                                                                            +
+                                                                                                             +
+                                       +
+                                                                                                            +
+                                                                                                         +
+                                                                                                                           +
                                                            +
+                                                                                          +
+                                                                                                          +
+                                                                                                                           +
                                                                                           +
+                                                                     +
+                                                                                                          +
+                                                                                                                           +
                                                                   +
+                                                                                  +
+                                                                                                         +
+                                                                                                          +
+                                                                                                                           +
                                                              +
+                                                                                                             +
+              +
+              +
+                                                                                                            +
+                                                                                                         +
+                                                                                                                           +
                                            +
+                                                                                                                           +
  
 (1 row)
 
 SELECT schema_to_xmlschema('testxmlschema', true, false, '');
-                                        schema_to_xmlschema                                        
----------------------------------------------------------------------------------------------------
-     xmlns:xsd="http://www.w3.org/2001/XMLSchema">                                                +
-                                                                                                  +
                                                                  +
-                                                                  +
-                                                            +
-                                                           +
-                                                                                +
-                                                                                 +
-                                                                                                  +
                                           +
-                                                               +
-                                                                                +
-                                                                                 +
-                                                                                                  +
                                                                  +
-                                                               +
-                                                                                +
-                                                                                 +
-                                                                                                  +
                                                                     +
-                                                               +
-                                                                                +
-                                                                                 +
-                                                                                                  +
                                                                  +
-                                                                                 +
-                                                                                                  +
                                                                 +
-                                                                +
-                                                                 +
-                                                                +
-                                                                                +
-                                                                                 +
-                                                                                                  +
                                                                   +
-                                                                 +
-                                                   +
-                                                  +
-                                                                                +
-                                                                                 +
-                                                                                                  +
                                                                     +
-                                              +
-                                                                                 +
-                                                                                                  +
                                                                     +
-                                                                 +
-                                   +
-                                                                                +
-                                                                                 +
-                                                                                                  +
                                                                +
-                                                             +
-     +
-                                                                                +
-                                                                                 +
-                                                                                                  +
                                                                     +
-                                                                 +
-                                              +
-                                                                                +
-                                                                                 +
-                                                                                                  +
                                                                   +
-                                                                                    +
-              +
-                                                                                   +
-                                                                                +
-                                                                                                  +
                                   +
-                                                                 +
-                                                                                 +
-                                                                                                  +
                                                                  +
-                                            +
-                                                                                 +
-                                                                                                  +
                                          +
-                                                         +
-                                                                                +
-                                                                                 +
-                                                                                                  +
                                     +
-                                                                                         +
-                       +
-                       +
-                                                                                        +
-                                                                                +
-                                                                                                  +
                   +
-                                                                                                  +
+                                                    schema_to_xmlschema                                                     
+----------------------------------------------------------------------------------------------------------------------------
+     xmlns:xsd="http://www.w3.org/2001/XMLSchema">                                                                         +
+                                                                                                                           +
                                                                                           +
+                                                                                           +
+                                                                                     +
+                                                                                    +
+                                                                                                         +
+                                                                                                          +
+                                                                                                                           +
                                                                    +
+                                                                                        +
+                                                                                                         +
+                                                                                                          +
+                                                                                                                           +
                                                                                           +
+                                                                                        +
+                                                                                                         +
+                                                                                                          +
+                                                                                                                           +
                                                                                              +
+                                                                                        +
+                                                                                                         +
+                                                                                                          +
+                                                                                                                           +
                                                                                           +
+                                                                                                          +
+                                                                                                                           +
                                                                                          +
+                                                                                         +
+                                                                                          +
+                                                                                         +
+                                                                                                         +
+                                                                                                          +
+                                                                                                                           +
                                                                                            +
+                                                                                          +
+                                                                            +
+                                                                           +
+                                                                                                         +
+                                                                                                          +
+                                                                                                                           +
                                                                                              +
+                                                                       +
+                                                                                                          +
+                                                                                                                           +
                                                                                              +
+                                                                                          +
+                                                            +
+                                                                                                         +
+                                                                                                          +
+                                                                                                                           +
                                                                                          +
+                                                                                          +
+                                   +
+                                                                                                         +
+                                                                                                          +
+                                                                                                                           +
                                                                                         +
+                                                                                      +
+                              +
+                                                                                                         +
+                                                                                                          +
+                                                                                                                           +
                                                                                     +
+                                                                                      +
+     +
+                                                                                                         +
+                                                                                                          +
+                                                                                                                           +
                                                                                              +
+                                                                                          +
+                                                                       +
+                                                                                                         +
+                                                                                                          +
+                                                                                                                           +
                                                                                            +
+                                                                                                             +
+                                       +
+                                                                                                            +
+                                                                                                         +
+                                                                                                                           +
                                                            +
+                                                                                          +
+                                                                                                          +
+                                                                                                                           +
                                                                                           +
+                                                                     +
+                                                                                                          +
+                                                                                                                           +
                                                                   +
+                                                                                  +
+                                                                                                         +
+                                                                                                          +
+                                                                                                                           +
                                                              +
+                                                                                                                  +
+                                                +
+                                                +
+                                                                                                                 +
+                                                                                                         +
+                                                                                                                           +
                                            +
+                                                                                                                           +
  
 (1 row)
 
 SELECT schema_to_xml_and_xmlschema('testxmlschema', true, true, 'foo');
-                                            schema_to_xml_and_xmlschema                                            
--------------------------------------------------------------------------------------------------------------------
     +
-                                                                                                                  +
-     xmlns:xsd="http://www.w3.org/2001/XMLSchema"                                                                 +
-     targetNamespace="foo"                                                                                        +
-     elementFormDefault="qualified">                                                                              +
-                                                                                                                  +
                                                                                  +
-                                                                                  +
-                                                                            +
-                                                                           +
-                                                                                                +
-                                                                                                 +
-                                                                                                                  +
                                                           +
-                                                                               +
-                                                                                                +
-                                                                                                 +
-                                                                                                                  +
                                                                                  +
-                                                                               +
-                                                                                                +
-                                                                                                 +
-                                                                                                                  +
                                                                                     +
-                                                                               +
-                                                                                                +
-                                                                                                 +
-                                                                                                                  +
                                                                                  +
-                                                                                                 +
-                                                                                                                  +
                                                                                 +
-                                                                                +
-                                                                                 +
-                                                                                +
-                                                                                                +
-                                                                                                 +
-                                                                                                                  +
                                                                                   +
-                                                                                 +
-                                                                   +
-                                                                  +
-                                                                                                +
-                                                                                                 +
-                                                                                                                  +
                                                                                     +
-                                                              +
-                                                                                                 +
-                                                                                                                  +
                                                                                     +
-                                                                                 +
-                                                   +
-                                                                                                +
-                                                                                                 +
-                                                                                                                  +
                                                                                +
-                                                                             +
-                     +
-                                                                                                +
-                                                                                                 +
-                                                                                                                  +
                                                                                     +
-                                                                                 +
-                                                              +
-                                                                                                +
-                                                                                                 +
-                                                                                                                  +
                                                                                   +
-                                                                                                    +
-                              +
-                                                                                                   +
-                                                                                                +
-                                                                                                                  +
                                                   +
-                                                                                 +
-                                                                                                 +
-                                                                                                                  +
                                                                                  +
-                                                            +
-                                                                                                 +
-                                                                                                                  +
                                                          +
-                                                                         +
-                                                                                                +
-                                                                                                 +
-                                                                                                                  +
                                                     +
-                                                                                                    +
-     +
-     +
-                                                                                                   +
-                                                                                                +
-                                                                                                                  +
                                   +
-                                                                                                                  +
-                                                                                                     +
-                                                                                                                  +
                                                                                                          +
-   1                                                                                                       +
-   one                                                                                                     +
-                                                                                                          +
-                                                                                                                  +
                                                                                                          +
-   2                                                                                                       +
-   two                                                                                                     +
-                                                                                                          +
-                                                                                                                  +
                                                                                                          +
-   -1                                                                                                      +
-                                                                                               +
-                                                                                                          +
-                                                                                                                  +
-                                                                                                                  +
                                                                                                          +
-   55                                                                                                      +
-   abc                                                                                                     +
-   def                                                                                                     +
-   98.60                                                                                                   +
-   2                                                                                                       +
-   999                                                                                                     +
-   0                                                                                                       +
-   21:07:00                                                                                                +
-   2009-06-08T21:07:30                                                                                     +
-   2009-06-08                                                                                              +
-                                                                                               +
-   ABC                                                                                                     +
-   true                                                                                                    +
-   WFla                                                                                                    +
-                                                                                                          +
-                                                                                                                  +
-                                                                                                                  +
-                                                                                                  +
+                                                schema_to_xml_and_xmlschema                                                 
+----------------------------------------------------------------------------------------------------------------------------
              +
+                                                                                                                           +
+     xmlns:xsd="http://www.w3.org/2001/XMLSchema"                                                                          +
+     targetNamespace="foo"                                                                                                 +
+     elementFormDefault="qualified">                                                                                       +
+                                                                                                                           +
                                                                                           +
+                                                                                           +
+                                                                                     +
+                                                                                    +
+                                                                                                         +
+                                                                                                          +
+                                                                                                                           +
                                                                    +
+                                                                                        +
+                                                                                                         +
+                                                                                                          +
+                                                                                                                           +
                                                                                           +
+                                                                                        +
+                                                                                                         +
+                                                                                                          +
+                                                                                                                           +
                                                                                              +
+                                                                                        +
+                                                                                                         +
+                                                                                                          +
+                                                                                                                           +
                                                                                           +
+                                                                                                          +
+                                                                                                                           +
                                                                                          +
+                                                                                         +
+                                                                                          +
+                                                                                         +
+                                                                                                         +
+                                                                                                          +
+                                                                                                                           +
                                                                                            +
+                                                                                          +
+                                                                            +
+                                                                           +
+                                                                                                         +
+                                                                                                          +
+                                                                                                                           +
                                                                                              +
+                                                                       +
+                                                                                                          +
+                                                                                                                           +
                                                                                              +
+                                                                                          +
+                                                            +
+                                                                                                         +
+                                                                                                          +
+                                                                                                                           +
                                                                                          +
+                                                                                          +
+                                   +
+                                                                                                         +
+                                                                                                          +
+                                                                                                                           +
                                                                                         +
+                                                                                      +
+                              +
+                                                                                                         +
+                                                                                                          +
+                                                                                                                           +
                                                                                     +
+                                                                                      +
+     +
+                                                                                                         +
+                                                                                                          +
+                                                                                                                           +
                                                                                              +
+                                                                                          +
+                                                                       +
+                                                                                                         +
+                                                                                                          +
+                                                                                                                           +
                                                                                            +
+                                                                                                             +
+                                       +
+                                                                                                            +
+                                                                                                         +
+                                                                                                                           +
                                                            +
+                                                                                          +
+                                                                                                          +
+                                                                                                                           +
                                                                                           +
+                                                                     +
+                                                                                                          +
+                                                                                                                           +
                                                                   +
+                                                                                  +
+                                                                                                         +
+                                                                                                          +
+                                                                                                                           +
                                                              +
+                                                                                                             +
+              +
+              +
+                                                                                                            +
+                                                                                                         +
+                                                                                                                           +
                                            +
+                                                                                                                           +
+                                                                                                              +
+                                                                                                                           +
                                                                                                                   +
+   1                                                                                                                +
+   one                                                                                                              +
+                                                                                                                   +
+                                                                                                                           +
                                                                                                                   +
+   2                                                                                                                +
+   two                                                                                                              +
+                                                                                                                   +
+                                                                                                                           +
                                                                                                                   +
+   -1                                                                                                               +
+                                                                                                        +
+                                                                                                                   +
+                                                                                                                           +
+                                                                                                                           +
                                                                                                                   +
+   55                                                                                                               +
+   abc                                                                                                              +
+   def                                                                                                              +
+   98.60                                                                                                            +
+   2                                                                                                                +
+   999                                                                                                              +
+   0                                                                                                                +
+   21:07:00                                                                                                         +
+   21:11:00+05                                                                                                  +
+   2009-06-08T21:07:30                                                                                              +
+   2009-06-08T21:07:30-07:00                                                                                    +
+   2009-06-08                                                                                                       +
+                                                                                                        +
+   ABC                                                                                                              +
+   true                                                                                                             +
+   WFla                                                                                                             +
+                                                                                                                   +
+                                                                                                                           +
+                                                                                                                           +
+                                                                                                           +
  
 (1 row)
 
index f6dbf81666aa213d7df92dfab311c12fef0b712d..4504acd3778bc2698dbfe6006a384c19c50f7d86 100644 (file)
@@ -2,9 +2,15 @@ CREATE SCHEMA testxmlschema;
 CREATE TABLE testxmlschema.test1 (a int, b text);
 INSERT INTO testxmlschema.test1 VALUES (1, 'one'), (2, 'two'), (-1, null);
 CREATE DOMAIN testxmldomain AS varchar;
-CREATE TABLE testxmlschema.test2 (z int, y varchar(500), x char(6), w numeric(9,2), v smallint, u bigint, t real, s time, r timestamp, q date, p xml, o testxmldomain, n bool, m bytea, aaa text);
+CREATE TABLE testxmlschema.test2 (z int, y varchar(500), x char(6),
+    w numeric(9,2), v smallint, u bigint, t real,
+    s time, stz timetz, r timestamp, rtz timestamptz, q date,
+    p xml, o testxmldomain, n bool, m bytea, aaa text);
 ALTER TABLE testxmlschema.test2 DROP COLUMN aaa;
-INSERT INTO testxmlschema.test2 VALUES (55, 'abc', 'def', 98.6, 2, 999, 0, '21:07', '2009-06-08 21:07:30', '2009-06-08', NULL, 'ABC', true, 'XYZ');
+INSERT INTO testxmlschema.test2 VALUES (55, 'abc', 'def',
+    98.6, 2, 999, 0,
+    '21:07', '21:11 +05', '2009-06-08 21:07:30', '2009-06-08 21:07:30 -07', '2009-06-08',
+    NULL, 'ABC', true, 'XYZ');
 SELECT table_to_xml('testxmlschema.test1', false, false, '');
 ERROR:  unsupported XML feature
 DETAIL:  This functionality requires the server to be built with libxml support.
index fde1b9eb597f2d94d9122f5db237f4fb0f057c31..16582bf6abd8aa1667a050087134377b558b066b 100644 (file)
@@ -3,9 +3,15 @@ CREATE SCHEMA testxmlschema;
 CREATE TABLE testxmlschema.test1 (a int, b text);
 INSERT INTO testxmlschema.test1 VALUES (1, 'one'), (2, 'two'), (-1, null);
 CREATE DOMAIN testxmldomain AS varchar;
-CREATE TABLE testxmlschema.test2 (z int, y varchar(500), x char(6), w numeric(9,2), v smallint, u bigint, t real, s time, r timestamp, q date, p xml, o testxmldomain, n bool, m bytea, aaa text);
+CREATE TABLE testxmlschema.test2 (z int, y varchar(500), x char(6),
+    w numeric(9,2), v smallint, u bigint, t real,
+    s time, stz timetz, r timestamp, rtz timestamptz, q date,
+    p xml, o testxmldomain, n bool, m bytea, aaa text);
 ALTER TABLE testxmlschema.test2 DROP COLUMN aaa;
-INSERT INTO testxmlschema.test2 VALUES (55, 'abc', 'def', 98.6, 2, 999, 0, '21:07', '2009-06-08 21:07:30', '2009-06-08', NULL, 'ABC', true, 'XYZ');
+INSERT INTO testxmlschema.test2 VALUES (55, 'abc', 'def',
+    98.6, 2, 999, 0,
+    '21:07', '21:11 +05', '2009-06-08 21:07:30', '2009-06-08 21:07:30 -07', '2009-06-08',
+    NULL, 'ABC', true, 'XYZ');
 
 SELECT table_to_xml('testxmlschema.test1', false, false, '');
 SELECT table_to_xml('testxmlschema.test1', true, false, 'foo');