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

Re: BUG #4294: XML support: name() xpath function not working

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "Enrico Sirola" <enrico(dot)sirola(at)gmail(dot)com>
Cc: pgsql-bugs(at)postgresql(dot)org, Peter Eisentraut <peter_e(at)gmx(dot)net>
Subject: Re: BUG #4294: XML support: name() xpath function not working
Date: 2008-07-11 04:28:14
Message-ID: 24419.1215750494@sss.pgh.pa.us (view raw or flat)
Thread:
Lists: pgsql-bugs
"Enrico Sirola" <enrico(dot)sirola(at)gmail(dot)com> writes:
> -- bad
> select xpath('name(/my:a/*[last()])', test, ARRAY[ARRAY['my',
> 'http://myns.com/ns']]) from test;

You could barely swat a fly with what I know about XPath ... but I'm
thinking that the culprit here is the crock at lines 3254-3288 of
xml.c, which explains itself thus:

    /*
     * To handle both documents and fragments, regardless of the fact whether
     * the XML datum has a single root (XML well-formedness), we wrap the XML
     * datum in a dummy element (<x>...</x>) and extend the XPath expression
     * accordingly.  To do it, throw away the XML prolog, if any.
     */

This code prefixes the given path expression with "/x", which of course
is going to break any expression that starts with a function name.  It
would have to stick the /x inside the function argument to have any
chance of working.  In general, I think this has zero chance of working
without implementing a pretty complete XPath parser.  We need to find
another way.

			regards, tom lane

In response to

Responses

pgsql-bugs by date

Next:From: Fred PernissDate: 2008-07-11 07:34:16
Subject: BUG #4295: DELETE WHERE Condition
Previous:From: Simon RiggsDate: 2008-07-10 16:57:36
Subject: Re: BUG #4294: XML support: name() xpath function notworking

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