pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: PG Bug reporting form <noreply@postgresql.org>
To: pgsql-bugs@lists.postgresql.org
Cc: hjonck@gmail.com
Subject: BUG #15155: table_to_xmlschema() ignores string restriction when generating XSD
Date: Sat, 14 Apr 2018 10:39:21 +0000
Message-ID: <152370236149.31225.14973357154592262776@wrigleys.postgresql.org> (raw)

The following bug has been logged on the website:

Bug reference:      15155
Logged by:          Hardy Jonck
Email address:      hjonck@gmail.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>



Message-ID: <152370236149.31225.14973357154592262776@wrigleys.postgresql.org>
Permalink:  ../152370236149.31225.14973357154592262776@wrigleys.postgresql.org/
Also on:    postgresql.org/message-id/152370236149.31225.14973357154592262776@wrigleys.postgresql.org

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-bugs@postgresql.org
  Cc: noreply@postgresql.org, hjonck@gmail.com
  Subject: Re: BUG #15155: table_to_xmlschema() ignores string restriction when generating XSD
  In-Reply-To: <152370236149.31225.14973357154592262776@wrigleys.postgresql.org>
  References: <152370236149.31225.14973357154592262776@wrigleys.postgresql.org>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox