From: | Markus Winand <markus(dot)winand(at)winand(dot)at> |
---|---|
To: | Chapman Flack <chap(at)anastigmatix(dot)net> |
Cc: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, mostafa_bit0108(at)hotmail(dot)com, pgsql-bugs(at)lists(dot)postgresql(dot)org, Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com> |
Subject: | Re: BUG #16046: xpath returns CDATA tag along with the value in postgres 12 |
Date: | 2019-10-25 17:16:52 |
Message-ID: | 66578EEF-C7B2-493A-B88F-0FB0A833629A@winand.at |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-bugs |
> On 25 Oct 2019, at 01:34, Chapman Flack <chap(at)anastigmatix(dot)net> wrote:
>
> On 10/24/19 19:14, Chapman Flack wrote:
>> <![CDATA[select 5 & 6 <yahoo!>]]>
>> select 5 & 6 <yahoo!>
>>
>> Either form of result is correct, and having it respect the form that was
>> used in the input might even be delightfully smart.
>>
>> I haven't looked in the code just now to see if it is intentionally being
>> delightfully smart, or more simplistic-and-lucky.
>
> It appears to be probably unintentional-but-ok: libxml tags a CDATA
> section differently (XML_CDATA_SECTION_NODE) than a text node
> (XML_TEXT_NODE), so a CDATA node falls into the catch-all branch of
>
> if (cur->type != XML_ATTRIBUTE_NODE && cur->type != XML_TEXT_NODE)
This was intentional. Earlier versions of the patch had the CDATA explicitly listed[0]. I suggested to reverse the logic later [1].
My concern at that time was about xmltable but I think the current behavior is fine for xpath too. If you pick fragment(s) out of an XML document the most reasonable thing to do is to return that part(s) of the XML as it actually appears in the input.
> We could choose to say that's
> what we meant it to do all along.
+1
-markus
[0] https://www.postgresql.org/message-id/attachment/63467/0001-XML-XPath-comments-processing-instructions-array-ind.patch <https://www.postgresql.org/message-id/attachment/63467/0001-XML-XPath-comments-processing-instructions-array-ind.patch>
[1] https://www.postgresql.org/message-id/FB592C2F-E2F3-42FD-A342-EE41BECD3771%40winand.at <https://www.postgresql.org/message-id/FB592C2F-E2F3-42FD-A342-EE41BECD3771@winand.at>
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2019-10-25 17:27:52 | Re: BUG #16046: xpath returns CDATA tag along with the value in postgres 12 |
Previous Message | PG Bug reporting form | 2019-10-25 08:01:45 | BUG #16078: Problems starting and running the app stack builder |