BUG #15155: table_to_xmlschema() ignores string restriction when generating XSD

From: PG Bug reporting form <noreply(at)postgresql(dot)org>
To: pgsql-bugs(at)lists(dot)postgresql(dot)org
Cc: hjonck(at)gmail(dot)com
Subject: BUG #15155: table_to_xmlschema() ignores string restriction when generating XSD
Date: 2018-04-14 10:39:21
Message-ID: 152370236149.31225.14973357154592262776@wrigleys.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

The following bug has been logged on the website:

Bug reference: 15155
Logged by: Hardy Jonck
Email address: hjonck(at)gmail(dot)com
PostgreSQL version: 10.3
Operating system: macOS 10.13.2 (17C67b) Kernel Version: Darwin 17
Description:

The *_to_xmlschema() functions correctly export restrictions for other types
but not for string.

For String, it exports and empty
<xsd:restriction base="xsd:string"></xsd:restriction>

To Reproduce:

CREATE DATABASE xsd_test;

\c xsd_test

CREATE TABLE if not exists to_xsd_test
(
_int INT,
_float FLOAT,
_varchar VARCHAR(10),
_date DATE
);

SELECT table_to_xmlschema('to_xsd_test',true,true,'');

Output (see string definition) - expecting a maxLength restriction:

<xsd:schema

xmlns:xsd="http://www.w3.org/2001/XMLSchema">



<xsd:simpleType name="INTEGER">

<xsd:restriction base="xsd:int">

<xsd:maxInclusive value="2147483647"/>

<xsd:minInclusive value="-2147483648"/>

</xsd:restriction>

</xsd:simpleType>



<xsd:simpleType name="DOUBLE">

<xsd:restriction base="xsd:double"></xsd:restriction>

</xsd:simpleType>



<xsd:simpleType name="VARCHAR">

<xsd:restriction base="xsd:string">

</xsd:restriction>

</xsd:simpleType>



<xsd:simpleType name="DATE">

<xsd:restriction base="xsd:date">

<xsd:pattern value="\p{Nd}{4}-\p{Nd}{2}-\p{Nd}{2}"/>

</xsd:restriction>

</xsd:simpleType>



<xsd:complexType name="RowType.xsd_test.public.to_x005F_xsd_test">

<xsd:sequence>

<xsd:element name="_int" type="INTEGER" nillable="true"></xsd:element>

<xsd:element name="_float" type="DOUBLE" nillable="true"></xsd:element>

<xsd:element name="_varchar" type="VARCHAR"
nillable="true"></xsd:element>
<xsd:element name="_date" type="DATE" nillable="true"></xsd:element>

</xsd:sequence>

</xsd:complexType>



<xsd:element name="to_x005F_xsd_test"
type="RowType.xsd_test.public.to_x005F_xsd_test"/>


</xsd:schema>

Browse pgsql-bugs by date

  From Date Subject
Next Message Tomas Vondra 2018-04-14 17:38:49 Re: Standby corruption after master is restarted
Previous Message Arthur Zakirov 2018-04-13 19:05:30 Re: BUG #15150: Reading uninitialised value in NISortAffixes (tsearch/spell.c)