README / HISTORY
This work is a part of Google Summer of Code 2006.
The patch provides:
* XML type based on text (during creation, XML values are parsed with help of libxml2);
* XML validation against DTD - XMLVALIDATE function (at the moment, non-standard);
* Subset of SQL/XML:2003 standard: XMLFOREST, XMLELEMENT, XMLATTRIBUTES, XMLAGG, XMLCOMMENT,
XMLCONCAT, XMLPI, XMLROOT and XMLSERIALIZE (based on the patch by Pavel Stehule);
* XML domains support (CREATE DOMAIN ... CHECK(XMLVALIDATE(value)) ...);
* XPath support (several functions, some ported from contrib/xml2);
* XPath value indexes (functional indexes created on the results for xpath_* functions) for
selection of XML values by the value of some XPath expression.
... TODO: EXAMPLES HERE ...
ADDITIONAL LINKS
SQL/XML papers: http://www.wiscorp.com/SQLStandards.html#xsqlstandards
SQL/XML examples: http://www-128.ibm.com/developerworks/db2/library/techarticle/dm-0511melnyk/
Google Summer of code proposal: http://chernowiki.ru/index.php?node=87
NOTES / HISTORY:
2006-08-22
Some classification for 'XML in RDBMS' functionality usage created:
http://nikolay.samokhvalov.com/2006/08/23/xml-and-relational/, with
examples. Working on documentations, thinking of problems...
2006-08-20
xpath_array() created; some xpath_* from contrib/xml2 ported; SQL/XML
patch applied and slightly changes. Have difficulties with integration
of SQL/XML constructions with XML type...
2006-08-10
Now we have good support for XPath evaluation against XML fragments.
Makefile.in and configure.in changed, but it turned out that there is
normal way to propagate USE_XML to BKI-files. Left this task for the
future (possible but ugly solution - plain SQL definition stmts in
initdb) :-(
2006-07-29
Using xmlParseBalancedChunkMemory() leads to own libxml's errcodes
processing... Well, I always dislike libxml's err messages (messed up,
with '\n' at the end, but not always, etc) - will fill them up manyally,
one by one.
2006-07-28
Daniel suggested using xmlParseBalancedChunkMemory() for parsing XML
chunks. Started to use it... Works good, but from now on, to have ability
to parse both XML docs and chunks, we should use dual approach (1. try to
parse as a doc; 2. if failed, try to parse as a chunk... smth like that)
...Postponed. In interim, use xmlParseBalancedChunkMemory() only.
2006-07-25
BKI files learned. Basic functions moved to the core (step forward to
patch, away from contrib module). Now we can integrate Pavel's work,
contrib/xml2 and XML type together.
2006-07-23
Encoding issues are almost resolved. Libxml2 offers good abilities (such
as guessing, convertion, etc). Actually, we have following states:
(initial) ==> (libxml's parsed state) ==> (server storage)
And there are 4 (!) different encoding values: initial (may be given
as explicit value in document prolog, but this may be not the case); libxml
internal representation (utf8); client_encoding param; server_encoding
param.
Another thing is that Postgres has good abilities for enconding convertion.
But to have use of them, we need to be able to resolve different enconding
names (such as 'cp1251' VS 'windows-1251'). Some useful code is in
src/bin/initdb/initdb.c, but this is standalone subproect... So, I've
copy-pasted some code from them and leave an open Q to pg-community
("Is it worth to move convertion struct-s from initdb.c to the core?").
...Postponed. Work only with UTF8 now.
2006-07-20
Error reporting improved (there were troubles with formatting of
libxml's error messages).
2006-06-22
Functions that are not SQL/XML-compatible (but may serve as protos
for corresponding functions) are renamed so that their names now
start with '_'. Some redesign for performance reasons (do not work
with C strings, VarChar is better; some code cleenup and comments).
Attempt to migrate contrib/xml2's code for XPath queries; postponed
due to bad design. (I'm going to redesign that code and improve it.)
2006-06-21
What is done:
- creation of XML value from string constant ('blah'::xml);
documents w/ and w/o prologue are being supported; DTD (inernal
and external) validation during XML value creation;
- parsing a string as an XML value - XMLPARSE (SQL/XML:6.15,
10.16, partially);
- casting XML value to text/varchar as simple CAST WITHOUT
FUNCTION;
- DTD validation (DTD is given by its URI);
Now it's clear that proper implementation of current version of
SQL/XML needs support of XQuery Data Model...
2006-06-14
Stop using libxml2:xmlreader API. Why? 1. It's much newer and may
be buggy; 2. Had have a look at the code... A lot of 'goto:'. Pfff.
Daniel started to learn BASIC? :-) (maybe I'm wrong and he had to go
this way...) Anyway, old code moved to xmltype_reader.c temporary.
2006-06-12
Name of type changed to 'XML' (was 'XMLTYPE') according to SQL/XML. Note,
that MS has 'XML', while ORA has 'XMLTYPE'.
2006-06-11
Start coding. Simple varchar wrapper with xml processing created - XMLTYPE.
2620
|