mirror of
https://github.com/postgres/postgres.git
synced 2025-05-03 22:24:49 +03:00
Fix incorrect xmlschema output for types timetz and timestamptz.
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
This commit is contained in:
parent
1d072bd203
commit
ae8ec7feba
@ -3659,7 +3659,7 @@ map_sql_type_to_xmlschema_type(Oid typeoid, int typmod)
|
|||||||
case TIMEOID:
|
case TIMEOID:
|
||||||
case TIMETZOID:
|
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)
|
if (typmod == -1)
|
||||||
appendStringInfo(&result,
|
appendStringInfo(&result,
|
||||||
@ -3682,7 +3682,7 @@ map_sql_type_to_xmlschema_type(Oid typeoid, int typmod)
|
|||||||
case TIMESTAMPOID:
|
case TIMESTAMPOID:
|
||||||
case TIMESTAMPTZOID:
|
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)
|
if (typmod == -1)
|
||||||
appendStringInfo(&result,
|
appendStringInfo(&result,
|
||||||
|
@ -2,9 +2,15 @@ CREATE SCHEMA testxmlschema;
|
|||||||
CREATE TABLE testxmlschema.test1 (a int, b text);
|
CREATE TABLE testxmlschema.test1 (a int, b text);
|
||||||
INSERT INTO testxmlschema.test1 VALUES (1, 'one'), (2, 'two'), (-1, null);
|
INSERT INTO testxmlschema.test1 VALUES (1, 'one'), (2, 'two'), (-1, null);
|
||||||
CREATE DOMAIN testxmldomain AS varchar;
|
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;
|
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', false, false, '');
|
||||||
table_to_xml
|
table_to_xml
|
||||||
---------------------------------------------------------------
|
---------------------------------------------------------------
|
||||||
@ -107,7 +113,9 @@ SELECT table_to_xml('testxmlschema.test2', false, false, '');
|
|||||||
<u>999</u> +
|
<u>999</u> +
|
||||||
<t>0</t> +
|
<t>0</t> +
|
||||||
<s>21:07:00</s> +
|
<s>21:07:00</s> +
|
||||||
|
<stz>21:11:00+05</stz> +
|
||||||
<r>2009-06-08T21:07:30</r> +
|
<r>2009-06-08T21:07:30</r> +
|
||||||
|
<rtz>2009-06-08T21:07:30-07:00</rtz> +
|
||||||
<q>2009-06-08</q> +
|
<q>2009-06-08</q> +
|
||||||
<o>ABC</o> +
|
<o>ABC</o> +
|
||||||
<n>true</n> +
|
<n>true</n> +
|
||||||
@ -253,113 +261,127 @@ SELECT table_to_xmlschema('testxmlschema.test1', true, true, '');
|
|||||||
(1 row)
|
(1 row)
|
||||||
|
|
||||||
SELECT table_to_xmlschema('testxmlschema.test2', false, false, '');
|
SELECT table_to_xmlschema('testxmlschema.test2', false, false, '');
|
||||||
table_to_xmlschema
|
table_to_xmlschema
|
||||||
-----------------------------------------------------------------------------------------------------------------
|
----------------------------------------------------------------------------------------------------------------------------
|
||||||
<xsd:schema +
|
<xsd:schema +
|
||||||
xmlns:xsd="http://www.w3.org/2001/XMLSchema"> +
|
xmlns:xsd="http://www.w3.org/2001/XMLSchema"> +
|
||||||
+
|
+
|
||||||
<xsd:simpleType name="INTEGER"> +
|
<xsd:simpleType name="INTEGER"> +
|
||||||
<xsd:restriction base="xsd:int"> +
|
<xsd:restriction base="xsd:int"> +
|
||||||
<xsd:maxInclusive value="2147483647"/> +
|
<xsd:maxInclusive value="2147483647"/> +
|
||||||
<xsd:minInclusive value="-2147483648"/> +
|
<xsd:minInclusive value="-2147483648"/> +
|
||||||
</xsd:restriction> +
|
</xsd:restriction> +
|
||||||
</xsd:simpleType> +
|
</xsd:simpleType> +
|
||||||
+
|
+
|
||||||
<xsd:simpleType name="VARCHAR"> +
|
<xsd:simpleType name="VARCHAR"> +
|
||||||
<xsd:restriction base="xsd:string"> +
|
<xsd:restriction base="xsd:string"> +
|
||||||
</xsd:restriction> +
|
</xsd:restriction> +
|
||||||
</xsd:simpleType> +
|
</xsd:simpleType> +
|
||||||
+
|
+
|
||||||
<xsd:simpleType name="CHAR"> +
|
<xsd:simpleType name="CHAR"> +
|
||||||
<xsd:restriction base="xsd:string"> +
|
<xsd:restriction base="xsd:string"> +
|
||||||
</xsd:restriction> +
|
</xsd:restriction> +
|
||||||
</xsd:simpleType> +
|
</xsd:simpleType> +
|
||||||
+
|
+
|
||||||
<xsd:simpleType name="NUMERIC"> +
|
<xsd:simpleType name="NUMERIC"> +
|
||||||
</xsd:simpleType> +
|
</xsd:simpleType> +
|
||||||
+
|
+
|
||||||
<xsd:simpleType name="SMALLINT"> +
|
<xsd:simpleType name="SMALLINT"> +
|
||||||
<xsd:restriction base="xsd:short"> +
|
<xsd:restriction base="xsd:short"> +
|
||||||
<xsd:maxInclusive value="32767"/> +
|
<xsd:maxInclusive value="32767"/> +
|
||||||
<xsd:minInclusive value="-32768"/> +
|
<xsd:minInclusive value="-32768"/> +
|
||||||
</xsd:restriction> +
|
</xsd:restriction> +
|
||||||
</xsd:simpleType> +
|
</xsd:simpleType> +
|
||||||
+
|
+
|
||||||
<xsd:simpleType name="BIGINT"> +
|
<xsd:simpleType name="BIGINT"> +
|
||||||
<xsd:restriction base="xsd:long"> +
|
<xsd:restriction base="xsd:long"> +
|
||||||
<xsd:maxInclusive value="9223372036854775807"/> +
|
<xsd:maxInclusive value="9223372036854775807"/> +
|
||||||
<xsd:minInclusive value="-9223372036854775808"/> +
|
<xsd:minInclusive value="-9223372036854775808"/> +
|
||||||
</xsd:restriction> +
|
</xsd:restriction> +
|
||||||
</xsd:simpleType> +
|
</xsd:simpleType> +
|
||||||
+
|
+
|
||||||
<xsd:simpleType name="REAL"> +
|
<xsd:simpleType name="REAL"> +
|
||||||
<xsd:restriction base="xsd:float"></xsd:restriction> +
|
<xsd:restriction base="xsd:float"></xsd:restriction> +
|
||||||
</xsd:simpleType> +
|
</xsd:simpleType> +
|
||||||
+
|
+
|
||||||
<xsd:simpleType name="TIME"> +
|
<xsd:simpleType name="TIME"> +
|
||||||
<xsd:restriction base="xsd:time"> +
|
<xsd:restriction base="xsd:time"> +
|
||||||
<xsd:pattern value="\p{Nd}{2}:\p{Nd}{2}:\p{Nd}{2}(.\p{Nd}+)?"/> +
|
<xsd:pattern value="\p{Nd}{2}:\p{Nd}{2}:\p{Nd}{2}(.\p{Nd}+)?"/> +
|
||||||
</xsd:restriction> +
|
</xsd:restriction> +
|
||||||
</xsd:simpleType> +
|
</xsd:simpleType> +
|
||||||
+
|
+
|
||||||
<xsd:simpleType name="TIMESTAMP"> +
|
<xsd:simpleType name="TIME_WTZ"> +
|
||||||
<xsd:restriction base="xsd:dateTime"> +
|
<xsd:restriction base="xsd:time"> +
|
||||||
<xsd:pattern value="\p{Nd}{4}-\p{Nd}{2}-\p{Nd}{2}T\p{Nd}{2}:\p{Nd}{2}:\p{Nd}{2}(.\p{Nd}+)?"/> +
|
<xsd:pattern value="\p{Nd}{2}:\p{Nd}{2}:\p{Nd}{2}(.\p{Nd}+)?(\+|-)\p{Nd}{2}:\p{Nd}{2}"/> +
|
||||||
</xsd:restriction> +
|
</xsd:restriction> +
|
||||||
</xsd:simpleType> +
|
</xsd:simpleType> +
|
||||||
+
|
+
|
||||||
<xsd:simpleType name="DATE"> +
|
<xsd:simpleType name="TIMESTAMP"> +
|
||||||
<xsd:restriction base="xsd:date"> +
|
<xsd:restriction base="xsd:dateTime"> +
|
||||||
<xsd:pattern value="\p{Nd}{4}-\p{Nd}{2}-\p{Nd}{2}"/> +
|
<xsd:pattern value="\p{Nd}{4}-\p{Nd}{2}-\p{Nd}{2}T\p{Nd}{2}:\p{Nd}{2}:\p{Nd}{2}(.\p{Nd}+)?"/> +
|
||||||
</xsd:restriction> +
|
</xsd:restriction> +
|
||||||
</xsd:simpleType> +
|
</xsd:simpleType> +
|
||||||
+
|
+
|
||||||
<xsd:complexType mixed="true"> +
|
<xsd:simpleType name="TIMESTAMP_WTZ"> +
|
||||||
<xsd:sequence> +
|
<xsd:restriction base="xsd:dateTime"> +
|
||||||
<xsd:any name="element" minOccurs="0" maxOccurs="unbounded" processContents="skip"/> +
|
<xsd:pattern value="\p{Nd}{4}-\p{Nd}{2}-\p{Nd}{2}T\p{Nd}{2}:\p{Nd}{2}:\p{Nd}{2}(.\p{Nd}+)?(\+|-)\p{Nd}{2}:\p{Nd}{2}"/>+
|
||||||
</xsd:sequence> +
|
</xsd:restriction> +
|
||||||
</xsd:complexType> +
|
</xsd:simpleType> +
|
||||||
+
|
+
|
||||||
<xsd:simpleType name="Domain.regression.public.testxmldomain"> +
|
<xsd:simpleType name="DATE"> +
|
||||||
<xsd:restriction base="VARCHAR"/> +
|
<xsd:restriction base="xsd:date"> +
|
||||||
</xsd:simpleType> +
|
<xsd:pattern value="\p{Nd}{4}-\p{Nd}{2}-\p{Nd}{2}"/> +
|
||||||
+
|
</xsd:restriction> +
|
||||||
<xsd:simpleType name="BOOLEAN"> +
|
</xsd:simpleType> +
|
||||||
<xsd:restriction base="xsd:boolean"></xsd:restriction> +
|
+
|
||||||
</xsd:simpleType> +
|
<xsd:complexType mixed="true"> +
|
||||||
+
|
<xsd:sequence> +
|
||||||
<xsd:simpleType name="UDT.regression.pg_catalog.bytea"> +
|
<xsd:any name="element" minOccurs="0" maxOccurs="unbounded" processContents="skip"/> +
|
||||||
<xsd:restriction base="xsd:base64Binary"> +
|
</xsd:sequence> +
|
||||||
</xsd:restriction> +
|
</xsd:complexType> +
|
||||||
</xsd:simpleType> +
|
+
|
||||||
+
|
<xsd:simpleType name="Domain.regression.public.testxmldomain"> +
|
||||||
<xsd:complexType name="RowType.regression.testxmlschema.test2"> +
|
<xsd:restriction base="VARCHAR"/> +
|
||||||
<xsd:sequence> +
|
</xsd:simpleType> +
|
||||||
<xsd:element name="z" type="INTEGER" minOccurs="0"></xsd:element> +
|
+
|
||||||
<xsd:element name="y" type="VARCHAR" minOccurs="0"></xsd:element> +
|
<xsd:simpleType name="BOOLEAN"> +
|
||||||
<xsd:element name="x" type="CHAR" minOccurs="0"></xsd:element> +
|
<xsd:restriction base="xsd:boolean"></xsd:restriction> +
|
||||||
<xsd:element name="w" type="NUMERIC" minOccurs="0"></xsd:element> +
|
</xsd:simpleType> +
|
||||||
<xsd:element name="v" type="SMALLINT" minOccurs="0"></xsd:element> +
|
+
|
||||||
<xsd:element name="u" type="BIGINT" minOccurs="0"></xsd:element> +
|
<xsd:simpleType name="UDT.regression.pg_catalog.bytea"> +
|
||||||
<xsd:element name="t" type="REAL" minOccurs="0"></xsd:element> +
|
<xsd:restriction base="xsd:base64Binary"> +
|
||||||
<xsd:element name="s" type="TIME" minOccurs="0"></xsd:element> +
|
</xsd:restriction> +
|
||||||
<xsd:element name="r" type="TIMESTAMP" minOccurs="0"></xsd:element> +
|
</xsd:simpleType> +
|
||||||
<xsd:element name="q" type="DATE" minOccurs="0"></xsd:element> +
|
+
|
||||||
<xsd:element name="p" type="XML" minOccurs="0"></xsd:element> +
|
<xsd:complexType name="RowType.regression.testxmlschema.test2"> +
|
||||||
<xsd:element name="o" type="Domain.regression.public.testxmldomain" minOccurs="0"></xsd:element> +
|
<xsd:sequence> +
|
||||||
<xsd:element name="n" type="BOOLEAN" minOccurs="0"></xsd:element> +
|
<xsd:element name="z" type="INTEGER" minOccurs="0"></xsd:element> +
|
||||||
<xsd:element name="m" type="UDT.regression.pg_catalog.bytea" minOccurs="0"></xsd:element> +
|
<xsd:element name="y" type="VARCHAR" minOccurs="0"></xsd:element> +
|
||||||
</xsd:sequence> +
|
<xsd:element name="x" type="CHAR" minOccurs="0"></xsd:element> +
|
||||||
</xsd:complexType> +
|
<xsd:element name="w" type="NUMERIC" minOccurs="0"></xsd:element> +
|
||||||
+
|
<xsd:element name="v" type="SMALLINT" minOccurs="0"></xsd:element> +
|
||||||
<xsd:complexType name="TableType.regression.testxmlschema.test2"> +
|
<xsd:element name="u" type="BIGINT" minOccurs="0"></xsd:element> +
|
||||||
<xsd:sequence> +
|
<xsd:element name="t" type="REAL" minOccurs="0"></xsd:element> +
|
||||||
<xsd:element name="row" type="RowType.regression.testxmlschema.test2" minOccurs="0" maxOccurs="unbounded"/>+
|
<xsd:element name="s" type="TIME" minOccurs="0"></xsd:element> +
|
||||||
</xsd:sequence> +
|
<xsd:element name="stz" type="TIME_WTZ" minOccurs="0"></xsd:element> +
|
||||||
</xsd:complexType> +
|
<xsd:element name="r" type="TIMESTAMP" minOccurs="0"></xsd:element> +
|
||||||
+
|
<xsd:element name="rtz" type="TIMESTAMP_WTZ" minOccurs="0"></xsd:element> +
|
||||||
<xsd:element name="test2" type="TableType.regression.testxmlschema.test2"/> +
|
<xsd:element name="q" type="DATE" minOccurs="0"></xsd:element> +
|
||||||
+
|
<xsd:element name="p" type="XML" minOccurs="0"></xsd:element> +
|
||||||
|
<xsd:element name="o" type="Domain.regression.public.testxmldomain" minOccurs="0"></xsd:element> +
|
||||||
|
<xsd:element name="n" type="BOOLEAN" minOccurs="0"></xsd:element> +
|
||||||
|
<xsd:element name="m" type="UDT.regression.pg_catalog.bytea" minOccurs="0"></xsd:element> +
|
||||||
|
</xsd:sequence> +
|
||||||
|
</xsd:complexType> +
|
||||||
|
+
|
||||||
|
<xsd:complexType name="TableType.regression.testxmlschema.test2"> +
|
||||||
|
<xsd:sequence> +
|
||||||
|
<xsd:element name="row" type="RowType.regression.testxmlschema.test2" minOccurs="0" maxOccurs="unbounded"/> +
|
||||||
|
</xsd:sequence> +
|
||||||
|
</xsd:complexType> +
|
||||||
|
+
|
||||||
|
<xsd:element name="test2" type="TableType.regression.testxmlschema.test2"/> +
|
||||||
|
+
|
||||||
</xsd:schema>
|
</xsd:schema>
|
||||||
(1 row)
|
(1 row)
|
||||||
|
|
||||||
@ -816,7 +838,9 @@ SELECT schema_to_xml('testxmlschema', false, true, '');
|
|||||||
<u>999</u> +
|
<u>999</u> +
|
||||||
<t>0</t> +
|
<t>0</t> +
|
||||||
<s>21:07:00</s> +
|
<s>21:07:00</s> +
|
||||||
|
<stz>21:11:00+05</stz> +
|
||||||
<r>2009-06-08T21:07:30</r> +
|
<r>2009-06-08T21:07:30</r> +
|
||||||
|
<rtz>2009-06-08T21:07:30-07:00</rtz> +
|
||||||
<q>2009-06-08</q> +
|
<q>2009-06-08</q> +
|
||||||
<o>ABC</o> +
|
<o>ABC</o> +
|
||||||
<n>true</n> +
|
<n>true</n> +
|
||||||
@ -863,7 +887,9 @@ SELECT schema_to_xml('testxmlschema', true, false, '');
|
|||||||
<u>999</u> +
|
<u>999</u> +
|
||||||
<t>0</t> +
|
<t>0</t> +
|
||||||
<s>21:07:00</s> +
|
<s>21:07:00</s> +
|
||||||
|
<stz>21:11:00+05</stz> +
|
||||||
<r>2009-06-08T21:07:30</r> +
|
<r>2009-06-08T21:07:30</r> +
|
||||||
|
<rtz>2009-06-08T21:07:30-07:00</rtz> +
|
||||||
<q>2009-06-08</q> +
|
<q>2009-06-08</q> +
|
||||||
<p xsi:nil="true"/> +
|
<p xsi:nil="true"/> +
|
||||||
<o>ABC</o> +
|
<o>ABC</o> +
|
||||||
@ -878,337 +904,375 @@ SELECT schema_to_xml('testxmlschema', true, false, '');
|
|||||||
(1 row)
|
(1 row)
|
||||||
|
|
||||||
SELECT schema_to_xmlschema('testxmlschema', false, true, '');
|
SELECT schema_to_xmlschema('testxmlschema', false, true, '');
|
||||||
schema_to_xmlschema
|
schema_to_xmlschema
|
||||||
-------------------------------------------------------------------------------------------------------------------
|
----------------------------------------------------------------------------------------------------------------------------
|
||||||
<xsd:schema +
|
<xsd:schema +
|
||||||
xmlns:xsd="http://www.w3.org/2001/XMLSchema"> +
|
xmlns:xsd="http://www.w3.org/2001/XMLSchema"> +
|
||||||
+
|
+
|
||||||
<xsd:simpleType name="INTEGER"> +
|
<xsd:simpleType name="INTEGER"> +
|
||||||
<xsd:restriction base="xsd:int"> +
|
<xsd:restriction base="xsd:int"> +
|
||||||
<xsd:maxInclusive value="2147483647"/> +
|
<xsd:maxInclusive value="2147483647"/> +
|
||||||
<xsd:minInclusive value="-2147483648"/> +
|
<xsd:minInclusive value="-2147483648"/> +
|
||||||
</xsd:restriction> +
|
</xsd:restriction> +
|
||||||
</xsd:simpleType> +
|
</xsd:simpleType> +
|
||||||
+
|
+
|
||||||
<xsd:simpleType name="UDT.regression.pg_catalog.text"> +
|
<xsd:simpleType name="UDT.regression.pg_catalog.text"> +
|
||||||
<xsd:restriction base="xsd:string"> +
|
<xsd:restriction base="xsd:string"> +
|
||||||
</xsd:restriction> +
|
</xsd:restriction> +
|
||||||
</xsd:simpleType> +
|
</xsd:simpleType> +
|
||||||
+
|
+
|
||||||
<xsd:simpleType name="VARCHAR"> +
|
<xsd:simpleType name="VARCHAR"> +
|
||||||
<xsd:restriction base="xsd:string"> +
|
<xsd:restriction base="xsd:string"> +
|
||||||
</xsd:restriction> +
|
</xsd:restriction> +
|
||||||
</xsd:simpleType> +
|
</xsd:simpleType> +
|
||||||
+
|
+
|
||||||
<xsd:simpleType name="CHAR"> +
|
<xsd:simpleType name="CHAR"> +
|
||||||
<xsd:restriction base="xsd:string"> +
|
<xsd:restriction base="xsd:string"> +
|
||||||
</xsd:restriction> +
|
</xsd:restriction> +
|
||||||
</xsd:simpleType> +
|
</xsd:simpleType> +
|
||||||
+
|
+
|
||||||
<xsd:simpleType name="NUMERIC"> +
|
<xsd:simpleType name="NUMERIC"> +
|
||||||
</xsd:simpleType> +
|
</xsd:simpleType> +
|
||||||
+
|
+
|
||||||
<xsd:simpleType name="SMALLINT"> +
|
<xsd:simpleType name="SMALLINT"> +
|
||||||
<xsd:restriction base="xsd:short"> +
|
<xsd:restriction base="xsd:short"> +
|
||||||
<xsd:maxInclusive value="32767"/> +
|
<xsd:maxInclusive value="32767"/> +
|
||||||
<xsd:minInclusive value="-32768"/> +
|
<xsd:minInclusive value="-32768"/> +
|
||||||
</xsd:restriction> +
|
</xsd:restriction> +
|
||||||
</xsd:simpleType> +
|
</xsd:simpleType> +
|
||||||
+
|
+
|
||||||
<xsd:simpleType name="BIGINT"> +
|
<xsd:simpleType name="BIGINT"> +
|
||||||
<xsd:restriction base="xsd:long"> +
|
<xsd:restriction base="xsd:long"> +
|
||||||
<xsd:maxInclusive value="9223372036854775807"/> +
|
<xsd:maxInclusive value="9223372036854775807"/> +
|
||||||
<xsd:minInclusive value="-9223372036854775808"/> +
|
<xsd:minInclusive value="-9223372036854775808"/> +
|
||||||
</xsd:restriction> +
|
</xsd:restriction> +
|
||||||
</xsd:simpleType> +
|
</xsd:simpleType> +
|
||||||
+
|
+
|
||||||
<xsd:simpleType name="REAL"> +
|
<xsd:simpleType name="REAL"> +
|
||||||
<xsd:restriction base="xsd:float"></xsd:restriction> +
|
<xsd:restriction base="xsd:float"></xsd:restriction> +
|
||||||
</xsd:simpleType> +
|
</xsd:simpleType> +
|
||||||
+
|
+
|
||||||
<xsd:simpleType name="TIME"> +
|
<xsd:simpleType name="TIME"> +
|
||||||
<xsd:restriction base="xsd:time"> +
|
<xsd:restriction base="xsd:time"> +
|
||||||
<xsd:pattern value="\p{Nd}{2}:\p{Nd}{2}:\p{Nd}{2}(.\p{Nd}+)?"/> +
|
<xsd:pattern value="\p{Nd}{2}:\p{Nd}{2}:\p{Nd}{2}(.\p{Nd}+)?"/> +
|
||||||
</xsd:restriction> +
|
</xsd:restriction> +
|
||||||
</xsd:simpleType> +
|
</xsd:simpleType> +
|
||||||
+
|
+
|
||||||
<xsd:simpleType name="TIMESTAMP"> +
|
<xsd:simpleType name="TIME_WTZ"> +
|
||||||
<xsd:restriction base="xsd:dateTime"> +
|
<xsd:restriction base="xsd:time"> +
|
||||||
<xsd:pattern value="\p{Nd}{4}-\p{Nd}{2}-\p{Nd}{2}T\p{Nd}{2}:\p{Nd}{2}:\p{Nd}{2}(.\p{Nd}+)?"/> +
|
<xsd:pattern value="\p{Nd}{2}:\p{Nd}{2}:\p{Nd}{2}(.\p{Nd}+)?(\+|-)\p{Nd}{2}:\p{Nd}{2}"/> +
|
||||||
</xsd:restriction> +
|
</xsd:restriction> +
|
||||||
</xsd:simpleType> +
|
</xsd:simpleType> +
|
||||||
+
|
+
|
||||||
<xsd:simpleType name="DATE"> +
|
<xsd:simpleType name="TIMESTAMP"> +
|
||||||
<xsd:restriction base="xsd:date"> +
|
<xsd:restriction base="xsd:dateTime"> +
|
||||||
<xsd:pattern value="\p{Nd}{4}-\p{Nd}{2}-\p{Nd}{2}"/> +
|
<xsd:pattern value="\p{Nd}{4}-\p{Nd}{2}-\p{Nd}{2}T\p{Nd}{2}:\p{Nd}{2}:\p{Nd}{2}(.\p{Nd}+)?"/> +
|
||||||
</xsd:restriction> +
|
</xsd:restriction> +
|
||||||
</xsd:simpleType> +
|
</xsd:simpleType> +
|
||||||
+
|
+
|
||||||
<xsd:complexType mixed="true"> +
|
<xsd:simpleType name="TIMESTAMP_WTZ"> +
|
||||||
<xsd:sequence> +
|
<xsd:restriction base="xsd:dateTime"> +
|
||||||
<xsd:any name="element" minOccurs="0" maxOccurs="unbounded" processContents="skip"/> +
|
<xsd:pattern value="\p{Nd}{4}-\p{Nd}{2}-\p{Nd}{2}T\p{Nd}{2}:\p{Nd}{2}:\p{Nd}{2}(.\p{Nd}+)?(\+|-)\p{Nd}{2}:\p{Nd}{2}"/>+
|
||||||
</xsd:sequence> +
|
</xsd:restriction> +
|
||||||
</xsd:complexType> +
|
</xsd:simpleType> +
|
||||||
+
|
+
|
||||||
<xsd:simpleType name="Domain.regression.public.testxmldomain"> +
|
<xsd:simpleType name="DATE"> +
|
||||||
<xsd:restriction base="VARCHAR"/> +
|
<xsd:restriction base="xsd:date"> +
|
||||||
</xsd:simpleType> +
|
<xsd:pattern value="\p{Nd}{4}-\p{Nd}{2}-\p{Nd}{2}"/> +
|
||||||
+
|
</xsd:restriction> +
|
||||||
<xsd:simpleType name="BOOLEAN"> +
|
</xsd:simpleType> +
|
||||||
<xsd:restriction base="xsd:boolean"></xsd:restriction> +
|
+
|
||||||
</xsd:simpleType> +
|
<xsd:complexType mixed="true"> +
|
||||||
+
|
<xsd:sequence> +
|
||||||
<xsd:simpleType name="UDT.regression.pg_catalog.bytea"> +
|
<xsd:any name="element" minOccurs="0" maxOccurs="unbounded" processContents="skip"/> +
|
||||||
<xsd:restriction base="xsd:base64Binary"> +
|
</xsd:sequence> +
|
||||||
</xsd:restriction> +
|
</xsd:complexType> +
|
||||||
</xsd:simpleType> +
|
+
|
||||||
+
|
<xsd:simpleType name="Domain.regression.public.testxmldomain"> +
|
||||||
<xsd:complexType name="SchemaType.regression.testxmlschema"> +
|
<xsd:restriction base="VARCHAR"/> +
|
||||||
<xsd:sequence> +
|
</xsd:simpleType> +
|
||||||
<xsd:element name="test1" type="RowType.regression.testxmlschema.test1" minOccurs="0" maxOccurs="unbounded"/>+
|
+
|
||||||
<xsd:element name="test2" type="RowType.regression.testxmlschema.test2" minOccurs="0" maxOccurs="unbounded"/>+
|
<xsd:simpleType name="BOOLEAN"> +
|
||||||
</xsd:sequence> +
|
<xsd:restriction base="xsd:boolean"></xsd:restriction> +
|
||||||
</xsd:complexType> +
|
</xsd:simpleType> +
|
||||||
+
|
+
|
||||||
<xsd:element name="testxmlschema" type="SchemaType.regression.testxmlschema"/> +
|
<xsd:simpleType name="UDT.regression.pg_catalog.bytea"> +
|
||||||
+
|
<xsd:restriction base="xsd:base64Binary"> +
|
||||||
|
</xsd:restriction> +
|
||||||
|
</xsd:simpleType> +
|
||||||
|
+
|
||||||
|
<xsd:complexType name="SchemaType.regression.testxmlschema"> +
|
||||||
|
<xsd:sequence> +
|
||||||
|
<xsd:element name="test1" type="RowType.regression.testxmlschema.test1" minOccurs="0" maxOccurs="unbounded"/> +
|
||||||
|
<xsd:element name="test2" type="RowType.regression.testxmlschema.test2" minOccurs="0" maxOccurs="unbounded"/> +
|
||||||
|
</xsd:sequence> +
|
||||||
|
</xsd:complexType> +
|
||||||
|
+
|
||||||
|
<xsd:element name="testxmlschema" type="SchemaType.regression.testxmlschema"/> +
|
||||||
|
+
|
||||||
</xsd:schema>
|
</xsd:schema>
|
||||||
(1 row)
|
(1 row)
|
||||||
|
|
||||||
SELECT schema_to_xmlschema('testxmlschema', true, false, '');
|
SELECT schema_to_xmlschema('testxmlschema', true, false, '');
|
||||||
schema_to_xmlschema
|
schema_to_xmlschema
|
||||||
---------------------------------------------------------------------------------------------------
|
----------------------------------------------------------------------------------------------------------------------------
|
||||||
<xsd:schema +
|
<xsd:schema +
|
||||||
xmlns:xsd="http://www.w3.org/2001/XMLSchema"> +
|
xmlns:xsd="http://www.w3.org/2001/XMLSchema"> +
|
||||||
+
|
+
|
||||||
<xsd:simpleType name="INTEGER"> +
|
<xsd:simpleType name="INTEGER"> +
|
||||||
<xsd:restriction base="xsd:int"> +
|
<xsd:restriction base="xsd:int"> +
|
||||||
<xsd:maxInclusive value="2147483647"/> +
|
<xsd:maxInclusive value="2147483647"/> +
|
||||||
<xsd:minInclusive value="-2147483648"/> +
|
<xsd:minInclusive value="-2147483648"/> +
|
||||||
</xsd:restriction> +
|
</xsd:restriction> +
|
||||||
</xsd:simpleType> +
|
</xsd:simpleType> +
|
||||||
+
|
+
|
||||||
<xsd:simpleType name="UDT.regression.pg_catalog.text"> +
|
<xsd:simpleType name="UDT.regression.pg_catalog.text"> +
|
||||||
<xsd:restriction base="xsd:string"> +
|
<xsd:restriction base="xsd:string"> +
|
||||||
</xsd:restriction> +
|
</xsd:restriction> +
|
||||||
</xsd:simpleType> +
|
</xsd:simpleType> +
|
||||||
+
|
+
|
||||||
<xsd:simpleType name="VARCHAR"> +
|
<xsd:simpleType name="VARCHAR"> +
|
||||||
<xsd:restriction base="xsd:string"> +
|
<xsd:restriction base="xsd:string"> +
|
||||||
</xsd:restriction> +
|
</xsd:restriction> +
|
||||||
</xsd:simpleType> +
|
</xsd:simpleType> +
|
||||||
+
|
+
|
||||||
<xsd:simpleType name="CHAR"> +
|
<xsd:simpleType name="CHAR"> +
|
||||||
<xsd:restriction base="xsd:string"> +
|
<xsd:restriction base="xsd:string"> +
|
||||||
</xsd:restriction> +
|
</xsd:restriction> +
|
||||||
</xsd:simpleType> +
|
</xsd:simpleType> +
|
||||||
+
|
+
|
||||||
<xsd:simpleType name="NUMERIC"> +
|
<xsd:simpleType name="NUMERIC"> +
|
||||||
</xsd:simpleType> +
|
</xsd:simpleType> +
|
||||||
+
|
+
|
||||||
<xsd:simpleType name="SMALLINT"> +
|
<xsd:simpleType name="SMALLINT"> +
|
||||||
<xsd:restriction base="xsd:short"> +
|
<xsd:restriction base="xsd:short"> +
|
||||||
<xsd:maxInclusive value="32767"/> +
|
<xsd:maxInclusive value="32767"/> +
|
||||||
<xsd:minInclusive value="-32768"/> +
|
<xsd:minInclusive value="-32768"/> +
|
||||||
</xsd:restriction> +
|
</xsd:restriction> +
|
||||||
</xsd:simpleType> +
|
</xsd:simpleType> +
|
||||||
+
|
+
|
||||||
<xsd:simpleType name="BIGINT"> +
|
<xsd:simpleType name="BIGINT"> +
|
||||||
<xsd:restriction base="xsd:long"> +
|
<xsd:restriction base="xsd:long"> +
|
||||||
<xsd:maxInclusive value="9223372036854775807"/> +
|
<xsd:maxInclusive value="9223372036854775807"/> +
|
||||||
<xsd:minInclusive value="-9223372036854775808"/> +
|
<xsd:minInclusive value="-9223372036854775808"/> +
|
||||||
</xsd:restriction> +
|
</xsd:restriction> +
|
||||||
</xsd:simpleType> +
|
</xsd:simpleType> +
|
||||||
+
|
+
|
||||||
<xsd:simpleType name="REAL"> +
|
<xsd:simpleType name="REAL"> +
|
||||||
<xsd:restriction base="xsd:float"></xsd:restriction> +
|
<xsd:restriction base="xsd:float"></xsd:restriction> +
|
||||||
</xsd:simpleType> +
|
</xsd:simpleType> +
|
||||||
+
|
+
|
||||||
<xsd:simpleType name="TIME"> +
|
<xsd:simpleType name="TIME"> +
|
||||||
<xsd:restriction base="xsd:time"> +
|
<xsd:restriction base="xsd:time"> +
|
||||||
<xsd:pattern value="\p{Nd}{2}:\p{Nd}{2}:\p{Nd}{2}(.\p{Nd}+)?"/> +
|
<xsd:pattern value="\p{Nd}{2}:\p{Nd}{2}:\p{Nd}{2}(.\p{Nd}+)?"/> +
|
||||||
</xsd:restriction> +
|
</xsd:restriction> +
|
||||||
</xsd:simpleType> +
|
</xsd:simpleType> +
|
||||||
+
|
+
|
||||||
<xsd:simpleType name="TIMESTAMP"> +
|
<xsd:simpleType name="TIME_WTZ"> +
|
||||||
<xsd:restriction base="xsd:dateTime"> +
|
<xsd:restriction base="xsd:time"> +
|
||||||
<xsd:pattern value="\p{Nd}{4}-\p{Nd}{2}-\p{Nd}{2}T\p{Nd}{2}:\p{Nd}{2}:\p{Nd}{2}(.\p{Nd}+)?"/>+
|
<xsd:pattern value="\p{Nd}{2}:\p{Nd}{2}:\p{Nd}{2}(.\p{Nd}+)?(\+|-)\p{Nd}{2}:\p{Nd}{2}"/> +
|
||||||
</xsd:restriction> +
|
</xsd:restriction> +
|
||||||
</xsd:simpleType> +
|
</xsd:simpleType> +
|
||||||
+
|
+
|
||||||
<xsd:simpleType name="DATE"> +
|
<xsd:simpleType name="TIMESTAMP"> +
|
||||||
<xsd:restriction base="xsd:date"> +
|
<xsd:restriction base="xsd:dateTime"> +
|
||||||
<xsd:pattern value="\p{Nd}{4}-\p{Nd}{2}-\p{Nd}{2}"/> +
|
<xsd:pattern value="\p{Nd}{4}-\p{Nd}{2}-\p{Nd}{2}T\p{Nd}{2}:\p{Nd}{2}:\p{Nd}{2}(.\p{Nd}+)?"/> +
|
||||||
</xsd:restriction> +
|
</xsd:restriction> +
|
||||||
</xsd:simpleType> +
|
</xsd:simpleType> +
|
||||||
+
|
+
|
||||||
<xsd:complexType mixed="true"> +
|
<xsd:simpleType name="TIMESTAMP_WTZ"> +
|
||||||
<xsd:sequence> +
|
<xsd:restriction base="xsd:dateTime"> +
|
||||||
<xsd:any name="element" minOccurs="0" maxOccurs="unbounded" processContents="skip"/> +
|
<xsd:pattern value="\p{Nd}{4}-\p{Nd}{2}-\p{Nd}{2}T\p{Nd}{2}:\p{Nd}{2}:\p{Nd}{2}(.\p{Nd}+)?(\+|-)\p{Nd}{2}:\p{Nd}{2}"/>+
|
||||||
</xsd:sequence> +
|
</xsd:restriction> +
|
||||||
</xsd:complexType> +
|
</xsd:simpleType> +
|
||||||
+
|
+
|
||||||
<xsd:simpleType name="Domain.regression.public.testxmldomain"> +
|
<xsd:simpleType name="DATE"> +
|
||||||
<xsd:restriction base="VARCHAR"/> +
|
<xsd:restriction base="xsd:date"> +
|
||||||
</xsd:simpleType> +
|
<xsd:pattern value="\p{Nd}{4}-\p{Nd}{2}-\p{Nd}{2}"/> +
|
||||||
+
|
</xsd:restriction> +
|
||||||
<xsd:simpleType name="BOOLEAN"> +
|
</xsd:simpleType> +
|
||||||
<xsd:restriction base="xsd:boolean"></xsd:restriction> +
|
+
|
||||||
</xsd:simpleType> +
|
<xsd:complexType mixed="true"> +
|
||||||
+
|
<xsd:sequence> +
|
||||||
<xsd:simpleType name="UDT.regression.pg_catalog.bytea"> +
|
<xsd:any name="element" minOccurs="0" maxOccurs="unbounded" processContents="skip"/> +
|
||||||
<xsd:restriction base="xsd:base64Binary"> +
|
</xsd:sequence> +
|
||||||
</xsd:restriction> +
|
</xsd:complexType> +
|
||||||
</xsd:simpleType> +
|
+
|
||||||
+
|
<xsd:simpleType name="Domain.regression.public.testxmldomain"> +
|
||||||
<xsd:complexType name="SchemaType.regression.testxmlschema"> +
|
<xsd:restriction base="VARCHAR"/> +
|
||||||
<xsd:all> +
|
</xsd:simpleType> +
|
||||||
<xsd:element name="test1" type="TableType.regression.testxmlschema.test1"/> +
|
+
|
||||||
<xsd:element name="test2" type="TableType.regression.testxmlschema.test2"/> +
|
<xsd:simpleType name="BOOLEAN"> +
|
||||||
</xsd:all> +
|
<xsd:restriction base="xsd:boolean"></xsd:restriction> +
|
||||||
</xsd:complexType> +
|
</xsd:simpleType> +
|
||||||
+
|
+
|
||||||
<xsd:element name="testxmlschema" type="SchemaType.regression.testxmlschema"/> +
|
<xsd:simpleType name="UDT.regression.pg_catalog.bytea"> +
|
||||||
+
|
<xsd:restriction base="xsd:base64Binary"> +
|
||||||
|
</xsd:restriction> +
|
||||||
|
</xsd:simpleType> +
|
||||||
|
+
|
||||||
|
<xsd:complexType name="SchemaType.regression.testxmlschema"> +
|
||||||
|
<xsd:all> +
|
||||||
|
<xsd:element name="test1" type="TableType.regression.testxmlschema.test1"/> +
|
||||||
|
<xsd:element name="test2" type="TableType.regression.testxmlschema.test2"/> +
|
||||||
|
</xsd:all> +
|
||||||
|
</xsd:complexType> +
|
||||||
|
+
|
||||||
|
<xsd:element name="testxmlschema" type="SchemaType.regression.testxmlschema"/> +
|
||||||
|
+
|
||||||
</xsd:schema>
|
</xsd:schema>
|
||||||
(1 row)
|
(1 row)
|
||||||
|
|
||||||
SELECT schema_to_xml_and_xmlschema('testxmlschema', true, true, 'foo');
|
SELECT schema_to_xml_and_xmlschema('testxmlschema', true, true, 'foo');
|
||||||
schema_to_xml_and_xmlschema
|
schema_to_xml_and_xmlschema
|
||||||
-------------------------------------------------------------------------------------------------------------------
|
----------------------------------------------------------------------------------------------------------------------------
|
||||||
<testxmlschema xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="foo" xsi:schemaLocation="foo #"> +
|
<testxmlschema xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="foo" xsi:schemaLocation="foo #"> +
|
||||||
+
|
+
|
||||||
<xsd:schema +
|
<xsd:schema +
|
||||||
xmlns:xsd="http://www.w3.org/2001/XMLSchema" +
|
xmlns:xsd="http://www.w3.org/2001/XMLSchema" +
|
||||||
targetNamespace="foo" +
|
targetNamespace="foo" +
|
||||||
elementFormDefault="qualified"> +
|
elementFormDefault="qualified"> +
|
||||||
+
|
+
|
||||||
<xsd:simpleType name="INTEGER"> +
|
<xsd:simpleType name="INTEGER"> +
|
||||||
<xsd:restriction base="xsd:int"> +
|
<xsd:restriction base="xsd:int"> +
|
||||||
<xsd:maxInclusive value="2147483647"/> +
|
<xsd:maxInclusive value="2147483647"/> +
|
||||||
<xsd:minInclusive value="-2147483648"/> +
|
<xsd:minInclusive value="-2147483648"/> +
|
||||||
</xsd:restriction> +
|
</xsd:restriction> +
|
||||||
</xsd:simpleType> +
|
</xsd:simpleType> +
|
||||||
+
|
+
|
||||||
<xsd:simpleType name="UDT.regression.pg_catalog.text"> +
|
<xsd:simpleType name="UDT.regression.pg_catalog.text"> +
|
||||||
<xsd:restriction base="xsd:string"> +
|
<xsd:restriction base="xsd:string"> +
|
||||||
</xsd:restriction> +
|
</xsd:restriction> +
|
||||||
</xsd:simpleType> +
|
</xsd:simpleType> +
|
||||||
+
|
+
|
||||||
<xsd:simpleType name="VARCHAR"> +
|
<xsd:simpleType name="VARCHAR"> +
|
||||||
<xsd:restriction base="xsd:string"> +
|
<xsd:restriction base="xsd:string"> +
|
||||||
</xsd:restriction> +
|
</xsd:restriction> +
|
||||||
</xsd:simpleType> +
|
</xsd:simpleType> +
|
||||||
+
|
+
|
||||||
<xsd:simpleType name="CHAR"> +
|
<xsd:simpleType name="CHAR"> +
|
||||||
<xsd:restriction base="xsd:string"> +
|
<xsd:restriction base="xsd:string"> +
|
||||||
</xsd:restriction> +
|
</xsd:restriction> +
|
||||||
</xsd:simpleType> +
|
</xsd:simpleType> +
|
||||||
+
|
+
|
||||||
<xsd:simpleType name="NUMERIC"> +
|
<xsd:simpleType name="NUMERIC"> +
|
||||||
</xsd:simpleType> +
|
</xsd:simpleType> +
|
||||||
+
|
+
|
||||||
<xsd:simpleType name="SMALLINT"> +
|
<xsd:simpleType name="SMALLINT"> +
|
||||||
<xsd:restriction base="xsd:short"> +
|
<xsd:restriction base="xsd:short"> +
|
||||||
<xsd:maxInclusive value="32767"/> +
|
<xsd:maxInclusive value="32767"/> +
|
||||||
<xsd:minInclusive value="-32768"/> +
|
<xsd:minInclusive value="-32768"/> +
|
||||||
</xsd:restriction> +
|
</xsd:restriction> +
|
||||||
</xsd:simpleType> +
|
</xsd:simpleType> +
|
||||||
+
|
+
|
||||||
<xsd:simpleType name="BIGINT"> +
|
<xsd:simpleType name="BIGINT"> +
|
||||||
<xsd:restriction base="xsd:long"> +
|
<xsd:restriction base="xsd:long"> +
|
||||||
<xsd:maxInclusive value="9223372036854775807"/> +
|
<xsd:maxInclusive value="9223372036854775807"/> +
|
||||||
<xsd:minInclusive value="-9223372036854775808"/> +
|
<xsd:minInclusive value="-9223372036854775808"/> +
|
||||||
</xsd:restriction> +
|
</xsd:restriction> +
|
||||||
</xsd:simpleType> +
|
</xsd:simpleType> +
|
||||||
+
|
+
|
||||||
<xsd:simpleType name="REAL"> +
|
<xsd:simpleType name="REAL"> +
|
||||||
<xsd:restriction base="xsd:float"></xsd:restriction> +
|
<xsd:restriction base="xsd:float"></xsd:restriction> +
|
||||||
</xsd:simpleType> +
|
</xsd:simpleType> +
|
||||||
+
|
+
|
||||||
<xsd:simpleType name="TIME"> +
|
<xsd:simpleType name="TIME"> +
|
||||||
<xsd:restriction base="xsd:time"> +
|
<xsd:restriction base="xsd:time"> +
|
||||||
<xsd:pattern value="\p{Nd}{2}:\p{Nd}{2}:\p{Nd}{2}(.\p{Nd}+)?"/> +
|
<xsd:pattern value="\p{Nd}{2}:\p{Nd}{2}:\p{Nd}{2}(.\p{Nd}+)?"/> +
|
||||||
</xsd:restriction> +
|
</xsd:restriction> +
|
||||||
</xsd:simpleType> +
|
</xsd:simpleType> +
|
||||||
+
|
+
|
||||||
<xsd:simpleType name="TIMESTAMP"> +
|
<xsd:simpleType name="TIME_WTZ"> +
|
||||||
<xsd:restriction base="xsd:dateTime"> +
|
<xsd:restriction base="xsd:time"> +
|
||||||
<xsd:pattern value="\p{Nd}{4}-\p{Nd}{2}-\p{Nd}{2}T\p{Nd}{2}:\p{Nd}{2}:\p{Nd}{2}(.\p{Nd}+)?"/> +
|
<xsd:pattern value="\p{Nd}{2}:\p{Nd}{2}:\p{Nd}{2}(.\p{Nd}+)?(\+|-)\p{Nd}{2}:\p{Nd}{2}"/> +
|
||||||
</xsd:restriction> +
|
</xsd:restriction> +
|
||||||
</xsd:simpleType> +
|
</xsd:simpleType> +
|
||||||
+
|
+
|
||||||
<xsd:simpleType name="DATE"> +
|
<xsd:simpleType name="TIMESTAMP"> +
|
||||||
<xsd:restriction base="xsd:date"> +
|
<xsd:restriction base="xsd:dateTime"> +
|
||||||
<xsd:pattern value="\p{Nd}{4}-\p{Nd}{2}-\p{Nd}{2}"/> +
|
<xsd:pattern value="\p{Nd}{4}-\p{Nd}{2}-\p{Nd}{2}T\p{Nd}{2}:\p{Nd}{2}:\p{Nd}{2}(.\p{Nd}+)?"/> +
|
||||||
</xsd:restriction> +
|
</xsd:restriction> +
|
||||||
</xsd:simpleType> +
|
</xsd:simpleType> +
|
||||||
+
|
+
|
||||||
<xsd:complexType mixed="true"> +
|
<xsd:simpleType name="TIMESTAMP_WTZ"> +
|
||||||
<xsd:sequence> +
|
<xsd:restriction base="xsd:dateTime"> +
|
||||||
<xsd:any name="element" minOccurs="0" maxOccurs="unbounded" processContents="skip"/> +
|
<xsd:pattern value="\p{Nd}{4}-\p{Nd}{2}-\p{Nd}{2}T\p{Nd}{2}:\p{Nd}{2}:\p{Nd}{2}(.\p{Nd}+)?(\+|-)\p{Nd}{2}:\p{Nd}{2}"/>+
|
||||||
</xsd:sequence> +
|
</xsd:restriction> +
|
||||||
</xsd:complexType> +
|
</xsd:simpleType> +
|
||||||
+
|
+
|
||||||
<xsd:simpleType name="Domain.regression.public.testxmldomain"> +
|
<xsd:simpleType name="DATE"> +
|
||||||
<xsd:restriction base="VARCHAR"/> +
|
<xsd:restriction base="xsd:date"> +
|
||||||
</xsd:simpleType> +
|
<xsd:pattern value="\p{Nd}{4}-\p{Nd}{2}-\p{Nd}{2}"/> +
|
||||||
+
|
</xsd:restriction> +
|
||||||
<xsd:simpleType name="BOOLEAN"> +
|
</xsd:simpleType> +
|
||||||
<xsd:restriction base="xsd:boolean"></xsd:restriction> +
|
+
|
||||||
</xsd:simpleType> +
|
<xsd:complexType mixed="true"> +
|
||||||
+
|
<xsd:sequence> +
|
||||||
<xsd:simpleType name="UDT.regression.pg_catalog.bytea"> +
|
<xsd:any name="element" minOccurs="0" maxOccurs="unbounded" processContents="skip"/> +
|
||||||
<xsd:restriction base="xsd:base64Binary"> +
|
</xsd:sequence> +
|
||||||
</xsd:restriction> +
|
</xsd:complexType> +
|
||||||
</xsd:simpleType> +
|
+
|
||||||
+
|
<xsd:simpleType name="Domain.regression.public.testxmldomain"> +
|
||||||
<xsd:complexType name="SchemaType.regression.testxmlschema"> +
|
<xsd:restriction base="VARCHAR"/> +
|
||||||
<xsd:sequence> +
|
</xsd:simpleType> +
|
||||||
<xsd:element name="test1" type="RowType.regression.testxmlschema.test1" minOccurs="0" maxOccurs="unbounded"/>+
|
+
|
||||||
<xsd:element name="test2" type="RowType.regression.testxmlschema.test2" minOccurs="0" maxOccurs="unbounded"/>+
|
<xsd:simpleType name="BOOLEAN"> +
|
||||||
</xsd:sequence> +
|
<xsd:restriction base="xsd:boolean"></xsd:restriction> +
|
||||||
</xsd:complexType> +
|
</xsd:simpleType> +
|
||||||
+
|
+
|
||||||
<xsd:element name="testxmlschema" type="SchemaType.regression.testxmlschema"/> +
|
<xsd:simpleType name="UDT.regression.pg_catalog.bytea"> +
|
||||||
+
|
<xsd:restriction base="xsd:base64Binary"> +
|
||||||
</xsd:schema> +
|
</xsd:restriction> +
|
||||||
+
|
</xsd:simpleType> +
|
||||||
<test1> +
|
+
|
||||||
<a>1</a> +
|
<xsd:complexType name="SchemaType.regression.testxmlschema"> +
|
||||||
<b>one</b> +
|
<xsd:sequence> +
|
||||||
</test1> +
|
<xsd:element name="test1" type="RowType.regression.testxmlschema.test1" minOccurs="0" maxOccurs="unbounded"/> +
|
||||||
+
|
<xsd:element name="test2" type="RowType.regression.testxmlschema.test2" minOccurs="0" maxOccurs="unbounded"/> +
|
||||||
<test1> +
|
</xsd:sequence> +
|
||||||
<a>2</a> +
|
</xsd:complexType> +
|
||||||
<b>two</b> +
|
+
|
||||||
</test1> +
|
<xsd:element name="testxmlschema" type="SchemaType.regression.testxmlschema"/> +
|
||||||
+
|
+
|
||||||
<test1> +
|
</xsd:schema> +
|
||||||
<a>-1</a> +
|
+
|
||||||
<b xsi:nil="true"/> +
|
<test1> +
|
||||||
</test1> +
|
<a>1</a> +
|
||||||
+
|
<b>one</b> +
|
||||||
+
|
</test1> +
|
||||||
<test2> +
|
+
|
||||||
<z>55</z> +
|
<test1> +
|
||||||
<y>abc</y> +
|
<a>2</a> +
|
||||||
<x>def </x> +
|
<b>two</b> +
|
||||||
<w>98.60</w> +
|
</test1> +
|
||||||
<v>2</v> +
|
+
|
||||||
<u>999</u> +
|
<test1> +
|
||||||
<t>0</t> +
|
<a>-1</a> +
|
||||||
<s>21:07:00</s> +
|
<b xsi:nil="true"/> +
|
||||||
<r>2009-06-08T21:07:30</r> +
|
</test1> +
|
||||||
<q>2009-06-08</q> +
|
+
|
||||||
<p xsi:nil="true"/> +
|
+
|
||||||
<o>ABC</o> +
|
<test2> +
|
||||||
<n>true</n> +
|
<z>55</z> +
|
||||||
<m>WFla</m> +
|
<y>abc</y> +
|
||||||
</test2> +
|
<x>def </x> +
|
||||||
+
|
<w>98.60</w> +
|
||||||
+
|
<v>2</v> +
|
||||||
</testxmlschema> +
|
<u>999</u> +
|
||||||
|
<t>0</t> +
|
||||||
|
<s>21:07:00</s> +
|
||||||
|
<stz>21:11:00+05</stz> +
|
||||||
|
<r>2009-06-08T21:07:30</r> +
|
||||||
|
<rtz>2009-06-08T21:07:30-07:00</rtz> +
|
||||||
|
<q>2009-06-08</q> +
|
||||||
|
<p xsi:nil="true"/> +
|
||||||
|
<o>ABC</o> +
|
||||||
|
<n>true</n> +
|
||||||
|
<m>WFla</m> +
|
||||||
|
</test2> +
|
||||||
|
+
|
||||||
|
+
|
||||||
|
</testxmlschema> +
|
||||||
|
|
||||||
(1 row)
|
(1 row)
|
||||||
|
|
||||||
|
@ -2,9 +2,15 @@ CREATE SCHEMA testxmlschema;
|
|||||||
CREATE TABLE testxmlschema.test1 (a int, b text);
|
CREATE TABLE testxmlschema.test1 (a int, b text);
|
||||||
INSERT INTO testxmlschema.test1 VALUES (1, 'one'), (2, 'two'), (-1, null);
|
INSERT INTO testxmlschema.test1 VALUES (1, 'one'), (2, 'two'), (-1, null);
|
||||||
CREATE DOMAIN testxmldomain AS varchar;
|
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;
|
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', false, false, '');
|
||||||
ERROR: unsupported XML feature
|
ERROR: unsupported XML feature
|
||||||
DETAIL: This functionality requires the server to be built with libxml support.
|
DETAIL: This functionality requires the server to be built with libxml support.
|
||||||
|
@ -3,9 +3,15 @@ CREATE SCHEMA testxmlschema;
|
|||||||
CREATE TABLE testxmlschema.test1 (a int, b text);
|
CREATE TABLE testxmlschema.test1 (a int, b text);
|
||||||
INSERT INTO testxmlschema.test1 VALUES (1, 'one'), (2, 'two'), (-1, null);
|
INSERT INTO testxmlschema.test1 VALUES (1, 'one'), (2, 'two'), (-1, null);
|
||||||
CREATE DOMAIN testxmldomain AS varchar;
|
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;
|
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', false, false, '');
|
||||||
SELECT table_to_xml('testxmlschema.test1', true, false, 'foo');
|
SELECT table_to_xml('testxmlschema.test1', true, false, 'foo');
|
||||||
|
Loading…
x
Reference in New Issue
Block a user