The following bug has been logged online:

Bug reference:      3734
Logged by:          Ben Leslie
Email address:      [EMAIL PROTECTED]
PostgreSQL version: 8.3 beta2
Operating system:   Mac OS X
Description:        Invalid XML schema output.
Details: 

database_to_xml_and_xmlschema creates an invalid XML in certain
circumstances.

To recreate:

CREATE DATABASE test;
\c test
CREATE DOMAIN isoweek AS date CHECK (date_trunc('week', VALUE) = VALUE);
CREATE TABLE test (x isoweek);
INSERT INTO test VALUES ('2007-01-01');

Now to see the bug:

SELECT database_to_xml_and_xmlschema('t', 'f', '');

The output is:

 <test xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
xsi:noNamespaceSchemaLocation="#">
 
 <xsd:schema
     xmlns:xsd="http://www.w3.org/2001/XMLSchema";>
 
 <xsd:simpleType name="Domain.test.public.isoweek">
   <xsd:restriction base="DATE">
 </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="CatalogType.test">
   <xsd:all>
     <xsd:element name="public" type="SchemaType.test.public" />
   </xsd:all>
 </xsd:complexType>
 
 <xsd:element name="test" type="CatalogType.test"/>
 
 </xsd:schema>
 
 <public>
 
 <test>
 
 <row>
   <x>2007-01-01</x>
 </row>
 
 </test>
 
 </public>
 
 </test>


The specific problem is that the following is malformed; the xsd:restriction
tag is never closed.

 <xsd:simpleType name="Domain.test.public.isoweek">
   <xsd:restriction base="DATE">
 </xsd:simpleType>

The correct output (as far as I can tell) should be:

 <xsd:simpleType name="Domain.test.public.isoweek">
   <xsd:restriction base="DATE" />
 </xsd:simpleType>

---------------------------(end of broadcast)---------------------------
TIP 1: if posting/reading through Usenet, please send an appropriate
       subscribe-nomail command to [EMAIL PROTECTED] so that your
       message can get through to the mailing list cleanly

Reply via email to