BUG #3734: Invalid XML schema output.

Поиск
Список
Период
Сортировка
От Ben Leslie
Тема BUG #3734: Invalid XML schema output.
Дата
Msg-id 200711091131.lA9BVTbJ003233@wwwmaster.postgresql.org
обсуждение исходный текст
Ответы Re: BUG #3734: Invalid XML schema output.  (Euler Taveira de Oliveira <euler@timbira.com>)
Список pgsql-bugs
The following bug has been logged online:

Bug reference:      3734
Logged by:          Ben Leslie
Email address:      benno@benno.id.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>

В списке pgsql-bugs по дате отправления:

Предыдущее
От: Alvaro Herrera
Дата:
Сообщение: Re: BUG #3732: Select returns 0 rows for varchar field
Следующее
От: Peter Eisentraut
Дата:
Сообщение: Re: BUG #3735: Can't create xml-stylesheet processing instruction