BUG #3734: Invalid XML schema output.

From: "Ben Leslie" <benno(at)benno(dot)id(dot)au>
To: pgsql-bugs(at)postgresql(dot)org
Subject: BUG #3734: Invalid XML schema output.
Date: 2007-11-09 11:31:29
Message-ID: 200711091131.lA9BVTbJ003233@wwwmaster.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs


The following bug has been logged online:

Bug reference: 3734
Logged by: Ben Leslie
Email address: benno(at)benno(dot)id(dot)au
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>

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Heikki Linnakangas 2007-11-09 11:41:38 Re: BUG #3732: Select returns 0 rows for varchar field
Previous Message Zdenek Kotala 2007-11-09 11:17:42 Re: BUG #3728: pthread autoconf hangs