Andrew Gierth was just pointing out to me how badly broken our XPath processing is.

For fear of passing an ill formed fragment of xml to the processor, we strip the xml declaration if any and surround what's left with '<x>" and '</x>' and prepend '/x' to the supposed xpath. This is just horrible. It will break for every xpath expression that doesn't begin with a '/' and probably for many that do.

This whole thing is a mess, and I suspect the only fix for now is to undo all the mangling of both the xml and the xpath expression. If the programmer passes an ill formed piece of xml to the processor that is their lookout, but I think we should ensure that we give back correct results on well formed input.

The only good piece of news is that the xpath procedures in contrib/xml2 don't apparently suffer these faults.

cheers

andrew

--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

Reply via email to