database_to_xmlschema() 是一个系统函数,它返回一个 XML Schema 文档,该文档描述了 database_to_xml() 执行的映射。
database_to_xmlschema() 添加于 PostgreSQL 8.3。
用法
database_to_xmlschema (nullsboolean,tableforestboolean,targetnstext)
→xml
当提供与调用 database_to_xml() 完全相同的参数时,database_to_xmlschema() 将返回相应的 XML Schema 文档。
函数 database_to_xml_and_schema() 结合了这两个函数(database_to_xml() 和 database_to_xmlschema())的输出。
变更历史
- PostgreSQL 8.3
- 添加于 (提交 0b75afda)
示例
database_to_xmlschema() 的基本用法示例
postgres=# SELECT database_to_xmlschema(true, true, '');
database_to_xmlschema
--------------------------------------------------------------------
<xsd:schema +
xmlns:xsd="http://www.w3.org/2001/XMLSchema"> +
+
<xsd:simpleType name="INTEGER"> +
<xsd:restriction base="xsd:int"> +
<xsd:maxInclusive value="2147483647"/> +
<xsd:minInclusive value="-2147483648"/> +
</xsd:restriction> +
</xsd:simpleType> +
+
<xsd:simpleType name="UDT.postgres.pg_catalog.text"> +
<xsd:restriction base="xsd:string"> +
</xsd:restriction> +
</xsd:simpleType> +
+
<xsd:complexType name="CatalogType.postgres"> +
<xsd:all> +
<xsd:element name="public" type="SchemaType.postgres.public"/>+
</xsd:all> +
</xsd:complexType> +
+
<xsd:element name="postgres" type="CatalogType.postgres"/> +
+
</xsd:schema>
(1 row)
参考资料
- PostgreSQL 文档: 将表映射到 XML
