From: | Ali Akbar <the(dot)apaan(at)gmail(dot)com> |
---|---|
To: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
Cc: | Peter Eisentraut <peter_e(at)gmx(dot)net>, Michael Paquier <michael(dot)paquier(at)gmail(dot)com>, "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: [REVIEW] Re: Fix xpath() to return namespace definitions |
Date: | 2015-01-08 01:51:31 |
Message-ID: | CACQjQLotP6K+HcnZk9PbPzQc6HUo8mDZDHoY8zEGkoVdDHbuBg@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
>
> Peter Eisentraut <peter_e(at)gmx(dot)net> writes:
> > committed version 7
>
Thanks!
2015-01-07 13:28 GMT+07:00 Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)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
From | Date | Subject | |
---|---|---|---|
Next Message | Peter Geoghegan | 2015-01-08 01:55:18 | Re: INSERT ... ON CONFLICT UPDATE and RLS |
Previous Message | David Fetter | 2015-01-08 01:33:43 | Re: INSERT ... ON CONFLICT UPDATE and RLS |