Обсуждение: XML Support related questions

Поиск
Список
Период
Сортировка

XML Support related questions

От
"Brijesh Shrivastav"
Дата:

Hello PostgreSQL XML Experts,

 

I was exploring xml support in postgreSQL and ran into few questions answer to which I couldn’t find easily in the documentation. I would appreciate responses to following queries:

 

1)      Can xml column be constrained to be DOCUMENT or CONTENT type?

XMLPARSE/XMLSERIALIZE functions allows to set XML option DOCUMENT or CONTENT type. Can we do the same when defining an xml column level?

2)      Is there plan in near future to support XML schema validation i.e to ensure inserted xml document conforms to a preregistered set of XML schemas.

3)      Support for XQuery – I know it is asking for too much but when do you see it happening in the future.

4)      Support for xml indexes – Is it something that is being worked upon for next release?

 

Our application support many underlying databases and I would hate to list out the stuff users cannot do when using xml datatype in postgresql. So far for non-xml functionality we haven’t had to this and I hope I don’t need to do it for xml as well.

 

Thanks,

Brijesh

 

 

Re: XML Support related questions

От
Stephane Bortzmeyer
Дата:
On Thu, May 22, 2008 at 11:49:38AM -0700,
 Brijesh Shrivastav <Bshrivastav@esri.com> wrote
 a message of 251 lines which said:

> 2) Is there plan in near future to support XML schema validation i.e
> to ensure inserted xml document conforms to a preregistered set of
> XML schemas.

It seems quite heavy to put this into PostgreSQL. There are at least
three commonly used XML schema languages (four if you consider
Schematron) and the existing free code in C/C++ is far from perfect.

May be starting with a server-side function, as a proof of concept?


Re: XML Support related questions

От
Craig Ringer
Дата:
Brijesh Shrivastav wrote:

> 1)      Can xml column be constrained to be DOCUMENT or CONTENT type?
>
> XMLPARSE/XMLSERIALIZE functions allows to set XML option DOCUMENT or
> CONTENT type. Can we do the same when defining an xml column level?

Maybe this could be done with a PL trigger ? Ideally you'd do it with a
domain type of XML so you could make domains like "XHTML", but as
PostgreSQL doesn't support adding triggers as part of a domain type
that's not going to work well.

It'd fit in fairly well with the next point:

> 2)      Is there plan in near future to support XML schema validation
> i.e to ensure inserted xml document conforms to a preregistered set of
> XML schemas.

This seems like a reasonable thing to tackle with PL/Perl, PL/Python,
etc. It's a pity PL/Java doesn't get the same level of attention
(especially from Linux distros) as Java's XML support is excellent and
it would be an ideal fit.

With Java going GPL and soon all-GPL with no binary only bits, maybe
PL/Java will start getting more interest from the free software crowd.

> 4)      Support for xml indexes - Is it something that is being worked
> upon for next release?

How would you index an XML document - by an XQuery result?

Maybe GiST can be used to build an XML index. That might be an
interesting SoC project.

You may also want to read this:


http://209.85.141.104/search?q=cache:mzlb8WfZ2eIJ:www.pgcon.org/2007/schedule/attachments/16-xml_in_postgresql.ps+postgresql+gist+xml&hl=en&ct=clnk&cd=1&gl=au&client=firefox-a

(early hit in a search for `postgresql gist xml')

--
Craig Ringer

Re: XML Support related questions

От
Peter Eisentraut
Дата:
Am Donnerstag, 22. Mai 2008 schrieb Brijesh Shrivastav:
> 1)      Can xml column be constrained to be DOCUMENT or CONTENT type?

Using a check constraint that does IS [NOT] DOCUMENT on the value.

> 2)      Is there plan in near future to support XML schema validation
> i.e to ensure inserted xml document conforms to a preregistered set of
> XML schemas.

Plans yes, but I don't think anyone is working on it at the moment.

> 3)      Support for XQuery - I know it is asking for too much but when
> do you see it happening in the future.

See #2.

> 4)      Support for xml indexes - Is it something that is being worked
> upon for next release?

See #3. ;-)  Of course this question is a bit underspecified, because indexes
depend on some operators, and XML does not have any operators at the moment,
so what do you want to index?

Re: XML Support related questions

От
"Brijesh Shrivastav"
Дата:
Thanks Peter for your responses. I will try constraint for # 1 but I
think it
probably will still make sense to include that as part of XML column
definition.
I assume the default xml data type is of CONTENT type.

For #4 I was looking to be able to index some or all of the tags in the
xml document. Most of our applications query very few tags in a Xml
document
and a smaller index on few tags will help with query performance.

Any guess on timeframe for #2, #3 and #4?

Thanks,
Brijesh


-----Original Message-----
From: Peter Eisentraut [mailto:peter_e@gmx.net]
Sent: Saturday, May 24, 2008 4:32 AM
To: pgsql-general@postgresql.org
Cc: Brijesh Shrivastav
Subject: Re: [GENERAL] XML Support related questions

Am Donnerstag, 22. Mai 2008 schrieb Brijesh Shrivastav:
> 1)      Can xml column be constrained to be DOCUMENT or CONTENT type?

Using a check constraint that does IS [NOT] DOCUMENT on the value.

> 2)      Is there plan in near future to support XML schema validation
> i.e to ensure inserted xml document conforms to a preregistered set of
> XML schemas.

Plans yes, but I don't think anyone is working on it at the moment.

> 3)      Support for XQuery - I know it is asking for too much but when
> do you see it happening in the future.

See #2.

> 4)      Support for xml indexes - Is it something that is being worked
> upon for next release?

See #3. ;-)  Of course this question is a bit underspecified, because
indexes
depend on some operators, and XML does not have any operators at the
moment,
so what do you want to index?


Re: XML Support related questions

От
Peter Eisentraut
Дата:
Brijesh Shrivastav wrote:
> For #4 I was looking to be able to index some or all of the tags in the
> xml document. Most of our applications query very few tags in a Xml
> document
> and a smaller index on few tags will help with query performance.

Expression indexes on xpath are probably what you should look at.

> Any guess on timeframe for #2, #3 and #4?

No.