>
> Peter Eisentraut <pete...@gmx.net> writes:
> > committed version 7
>
Thanks!

2015-01-07 13:28 GMT+07:00 Tom Lane <t...@sss.pgh.pa.us>:

> Isn't that a back-patchable bug fix?
>

Upthread, i noted:

> For back versions, i think because this patch changes xpath() behavior, we
> will only apply this to future versions. The old behavior is wrong
> (according to XPath standard) for not including namespaces, but maybe there
> are some application that depends on the old behavior.
>

Reviewing the behavior on 9.3, now i think the old behavior isn't usable
(the resulting xml is not even processable in postgres):

# select unnest(xpath('//a:b', '<b:a
xmlns:b="http://test.com/a";><b:b>1</b:b><b:b>2</b:b></b:a>'::xml,
array[array['a','http://test.com/a']]));
    unnest
--------------
 <b:b>1</b:b>
 <b:b>2</b:b>
(2 rows)

# select xpath('//b:b', unnest(xpath('//a:b', '<b:a xmlns:b="
http://test.com/a";><b:b>1</b:b><b:b>2</b:b></b:a>'::xml, array[array['a','
http://test.com/a']])));
ERROR:  could not parse XML document
DETAIL:  line 1: Namespace prefix b on b is not defined
<b:b>1</b:b>

Maybe some application uses the result directly, but correct xml-using
applications should handle namespace correctly, so if '<b:b>1</b:b>'
becomes '<b:b xmlns:b="http://test.com/a' >1</b:b>', there should be no
issue in those applications.


So now +1 for back-patching this.

Regards,
-- 
Ali Akbar

Reply via email to