Commit 96ee6ff5 authored by Peter Eisentraut's avatar Peter Eisentraut

Fix XML Schema structure for char types without length (bug #3782)

parent 2609345c
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
* Portions Copyright (c) 1996-2007, PostgreSQL Global Development Group * Portions Copyright (c) 1996-2007, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California * Portions Copyright (c) 1994, Regents of the University of California
* *
* $PostgreSQL: pgsql/src/backend/utils/adt/xml.c,v 1.62 2007/11/27 18:13:01 tgl Exp $ * $PostgreSQL: pgsql/src/backend/utils/adt/xml.c,v 1.63 2007/11/28 14:01:51 petere Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -2984,12 +2984,14 @@ map_sql_type_to_xmlschema_type(Oid typeoid, int typmod) ...@@ -2984,12 +2984,14 @@ map_sql_type_to_xmlschema_type(Oid typeoid, int typmod)
case BPCHAROID: case BPCHAROID:
case VARCHAROID: case VARCHAROID:
case TEXTOID: case TEXTOID:
appendStringInfo(&result,
" <xsd:restriction base=\"xsd:string\">\n");
if (typmod != -1) if (typmod != -1)
appendStringInfo(&result, appendStringInfo(&result,
" <xsd:restriction base=\"xsd:string\">\n" " <xsd:maxLength value=\"%d\"/>\n",
" <xsd:maxLength value=\"%d\"/>\n"
" </xsd:restriction>\n",
typmod - VARHDRSZ); typmod - VARHDRSZ);
appendStringInfo(&result,
" </xsd:restriction>\n");
break; break;
case BYTEAOID: case BYTEAOID:
...@@ -2997,6 +2999,7 @@ map_sql_type_to_xmlschema_type(Oid typeoid, int typmod) ...@@ -2997,6 +2999,7 @@ map_sql_type_to_xmlschema_type(Oid typeoid, int typmod)
" <xsd:restriction base=\"xsd:%s\">\n" " <xsd:restriction base=\"xsd:%s\">\n"
" </xsd:restriction>\n", " </xsd:restriction>\n",
xmlbinary == XMLBINARY_BASE64 ? "base64Binary" : "hexBinary"); xmlbinary == XMLBINARY_BASE64 ? "base64Binary" : "hexBinary");
break;
case NUMERICOID: case NUMERICOID:
if (typmod != -1) if (typmod != -1)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment