Skip site navigation (1) Skip section navigation (2)

Re: remove contrib/xml2

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Andrew Dunstan <andrew(at)dunslane(dot)net>
Cc: Robert Haas <robertmhaas(at)gmail(dot)com>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: remove contrib/xml2
Date: 2010-03-01 04:03:36
Message-ID: 22643.1267416216@sss.pgh.pa.us (view raw or flat)
Thread:
Lists: pgsql-hackers
Andrew Dunstan <andrew(at)dunslane(dot)net> writes:
> Tom Lane wrote:
>> ... The reason for that behavior is that xpath_table runs through
>> the XPATH_NODESET results generated by the various XPaths and dumps the
>> k'th one of each into the k'th output row generated for the current
>> input row.

> Damn that's ugly.

Yup :-(

> ISTM the missing piece is really in our API. We need to be able to 
> specify a nodeset to iterate over, and then for each node take the first 
> value produced by each xpath expression. So the example above would look 
> something like:

>     SELECT * FROM xpath_table('id', 't', 'xpath_test',
>     '/rowlist/row', '@a|@b', 'true') as t(id int4, a text, b text);

Hm.  It seems like that still leaves you open to the possibility of
out-of-sync results.  If you consider the current behavior as what
you'd get with an empty root nodeset spec, then restricting it to
produce only the first output row doesn't help at all -- it would still
associate "1" with "oops".  In general if the nodeset spec doesn't
select a unique subnode then you're at risk of bogus answers.
Maybe that could be defined as user error but it sure seems like it
would be error-prone to use.

> Maybe we could approximate that with the current API by factoring out 
> the common root of the xpath expressions, but that's likely to be 
> extremely fragile and error prone, and we've already got bad experience 
> of trying to be too cute with xpath expressions.

Agreed, we do not want to be doing textual manipulations of XPaths,
which is what burnt us before.  But does libxml2 offer any more
abstract path representation we could work on?

			regards, tom lane

In response to

Responses

pgsql-hackers by date

Next:From: David FetterDate: 2010-03-01 04:06:05
Subject: Re: psql with "Function Type" in \df
Previous:From: Robert HaasDate: 2010-03-01 04:02:39
Subject: Re: dedebugging and a functions that just don't work on debian flavour

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group