XML Todo

From PostgreSQL Wiki

Jump to: navigation, search

These are the issues that need to be or should be worked on for the XML type support in PostgreSQL. Some of these ideas are for functionality that might be good to have available but which is not covered by the SQL/XML standard. Maybe some of these can be collected in an "XML toolbox" on PgFoundry or in contrib.

Add your own ideas here.

Contents

Build

--with-libxslt
Add smth like "(for contrib only)" notice to configure's help (AFAIK, --with-ossp-uuid needs such a notice too)

Validation

XMLVALIDATEDTD
The current name of this function is XMLVALIDATE, which is not correct (see XMLVALIDATE definition in the standard paper)
Allow passing DTDs via URIs?
There is no words regarding XMLVALIDATEDTD in the documentation
XML Schema
XSD validation. (Nikolay)
XML_SCHEMAS view in the information schema. (Nikolay)
Relax-NG
Also a useful way to validate XML data. libxml2 supports this.
DTD and XSD validation
There is currently an implementation of XMLVALIDATE that does this. But note that XMLVALIDATE should work on XML schemas, not DTDs. The current implementation is all wrong. (Peter)
Allow passing DTD to XMLVALIDATE as a simple VARCHAR string, not only as an URI. (Nikolay)

Indexes

Indexes
Simplify creating btree and GIN indexes for XML data
Index-optimized XPath
Effective XPath (Idea: use GiST/Gin to build a kind of index, supporting some numbering scheme to allow fast performance of simple XPath expressions evaluation). Function can be called as XMLPATH (non-standard). (Nikolay)

Internals

Data structure
Native structure for XML type (implement Infoset, XDM and SQL/XML aspects). (Nikolay)

More SQL/XML Features

Extra SQL/XML 2006 functions
XMLDOCUMENT (instead of XMLROOT, which is from SQL/XML:2003) (Nikolay)
Add XMLCAST, XMLTEXT (Nikolay)
Inline ORDER BY for XMLAGG
Example: "... XMLAGG(XMLELEMENT(...) ORDER BY col1) ...". (Nikolay)
Namespaces
XMLNAMESPACES support in XMLELEMENT and elsewhere

Interfaces

JDBC support
http://archives.postgresql.org/pgsql-jdbc/2007-01/msg00156.php

Misc. Features

XSLT
Already available in contrib/xml2, but needs API fixes and adaptation to xml type.
XML Canonical
Convert XML documents to canonical form to compare them. libxml2 has support for this.
Pretty-printing XML
Parse a document and serialize it back in some indented form. libxml2 might support this.

XML Database Utopia

XQuery
XMLQUERY (from SQL/XML standard) - big task, entire langugage embedded in SQL. (Nikolay)
Shredding
In some cases shredding could be better option (if there is no need in keeping XML docs entirely; if we have already developed tools that understand only relational data; etc) -- it would be a separate module that implements annotated schema decomposition technique, similar to DB2 and SQL Server functionality. (Nikolay)

XPath

The current (PostgreSQL 8.3.3) XPath support has some problems. Collect info and create a solution in this section.

Namespaces
Nested or repeated xpath() apparently mess up namespaces [1] [2] [3] [4] [5]
<x> root
Adding the <x> at the root causes problems [6] [7] [8]
xpath_table
Needs to be implemented to get rid of contrib/xml2 [9]
data types
better handling of XPath data types [10] [11]

Other XPath features:

xpath_exists()
xpath_exists() is needed. It checks, whether or not the path specified exists in the XML value. (W/o this function we need to use weird "array_dims(xpath(...)) IS NOT NULL" syntax.)
Personal tools