Thanks for the patch Peter.
- I applied the patch but wasn't able to compile postgre on windows, but
i'll try again a bit later on linux
- For checking we can use http://www.w3.org/2001/03/webdata/xsv
- One more thing I'd like to point out is what happens in situations
like the following:
if there's a varchar of length 20 and another of length 30,
Two separate XSD types should be declared VARCHAR_20 and VARCHAR_30
as i saw in xml.c map_sql_type_to_xml_name()
However the output is currently just a VARCHAR type:
CREATE TABLE t1
(
cv30 character varying(30),
cv10 character varying(10),
cv10notnull character varying(10) NOT NULL,
numeric_10_3 numeric(10,3),
numeric_10_5 numeric(10,5)
)
WITH (OIDS=FALSE);
-- Then query:
select table_to_xmlschema('t1', true, true, 'test');
-- Expected are simpleTypes with VARCHAR_30 and VARCHAR_10
-- The output in the current beta version is just VARCHAR:
xsd:schema
xmlns:xsd=http://www.w3.org/2001/XMLSchema;
targetNamespace=test
elementFormDefault=qualified
xsd:simpleType name=VARCHAR
/xsd:simpleType
xsd:simpleType name=NUMERIC
/xsd:simpleType
xsd:complexType name=RowType.test.public.t1
xsd:sequence
xsd:element name=cv30 type=VARCHAR nillable=true/xsd:element
xsd:element name=cv10 type=VARCHAR nillable=true/xsd:element
xsd:element name=cv10notnull type=VARCHAR
nillable=true/xsd:element
xsd:element name=numeric_10_3 type=NUMERIC
nillable=true/xsd:element
xsd:element name=numeric_10_5 type=NUMERIC
nillable=true/xsd:element
/xsd:sequence
/xsd:complexType
xsd:element name=t1 type=RowType.test.public.t1/
/xsd:schema
I'm going to start compiling the postgre and then let you know how it went!
Dragos
Peter Eisentraut wrote:
Am Dienstag, 27. November 2007 schrieb Dragos Ionita:
I'm having a problem with table_to_xmlschema, for VARCHAR fields the
function returns:
xsd:simpleType name=VARCHAR
/xsd:simpleType
And parsers don't seem to like this:
Invalid XML schema: 'Further elements required under element
xsd:simpleType.'
The simpleType should have a child element. Is this a bug or am I missing
something?
Oh yes, I didn't consider the XML Schema specification well enough. Please
try the attached patch.
Do you know of an XML Schema checker that we could use to check this?
---(end of broadcast)---
TIP 4: Have you searched our list archives?
http://archives.postgresql.org