From: Stefan Kaltenbrunner <stefan@kaltenbrunner.cc>
To: Bruce Momjian <bruce@momjian.us>
To: dennis.noordsij@helsinki.fi
Cc: pgsql-bugs@postgresql.org
Subject: Re: BUG #8469: Xpath behaviour unintuitive / arguably wrong
Date: Fri, 04 Oct 2013 22:20:46 +0200
Message-ID: <524F231E.5010001@kaltenbrunner.cc> (raw)
In-Reply-To: <20131002161946.GB5960@momjian.us>
References: <E1VOXZv-0008Q9-0Z@wrigleys.postgresql.org>
<20131002161946.GB5960@momjian.us>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-bugs>
On 10/02/2013 06:19 PM, Bruce Momjian wrote:
> On Tue, Sep 24, 2013 at 06:43:19PM +0000, dennis.noordsij@helsinki.fi wrote:
>> The following bug has been logged on the website:
>>
>> Bug reference: 8469
>> Logged by: Dennis
>> Email address: dennis.noordsij@helsinki.fi
>> PostgreSQL version: 9.3.0
>> Operating system: FreeBSD 9.2-RC4
>> Description:
>>
>> Hi,
>>
>>
>> After upgrading an 8.1 version to 9.3.0 I am suddenly seeing text fields
>> containing "&" where they are populated from XML. This may be a
>> coincidence and the problem may have existed earlier, in any case, now I
>> noticed.
>>
>>
>> I extract the text content of XML nodes using xpath, from something like:
>>
>>
>> <name>Jones & Smith</name>
>>
>>
>> The reason I end up with "&" is the IMHO rather odd xpath behaviour:
>>
>>
>> # select xpath('/a/text()', (select xmlelement(name "a", 'A & B')));
>>
>>
>> xpath
>> ---------------
>> {"A & B"}
>>
>>
>> The canonical contents of "a" is "A & B". At first search I've found some
>> rather heated debates about this with bits of name calling; I certainly do
>> not want to get into that and I apologize in advance to those who feel very
>> strongly about this.
>>
>>
>> I've seen one "fix" describe the problem as:
>>
>>
>> ""DESCRIPTION: Submitter invokes following statement:
>> SELECT (XPATH('/*/text()', '<root><</root>'))[1].
>> He expect (escaped) result "<", but gets "<"
>> """
>>
>>
>> With respect, this "bug" makes no sense as this produces in fact the right
>> result. The actual value of <root> is "<", it's just escaped when serialized
>> to XML. If <root> were to actually contain "<", it'd be serialized as
>> "&lt;". It should not be possible to be blindly cast to a text type, but
>> explicitly serialized as such.
>>
>>
>> At least the reviewer at:
>>
>>
>> http://www.postgresql.org/message-id/201106291934.23089.rsmogura@softperience.eu
>
> There are two other similar bug reports on this from February and March
> of this year:
>
> http://www.postgresql.org/message-id/E1U1FKL-0002rD-RO@wrihigleys.postgresql.org
I think that should be:
http://www.postgresql.org/message-id/E1U1FKL-0002rD-RO@wrigleys.postgresql.org> http://www.postgresql.org/message-id/E1UHyUw-0001oj-HE@wrigleys.postgresql.org
>
> Someone who knows XML needs to take leadership on this and propose a
> patch.
agreed
Stefan
--
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-bugs@postgresql.org
Cc: stefan@kaltenbrunner.cc, bruce@momjian.us, dennis.noordsij@helsinki.fi
Subject: Re: BUG #8469: Xpath behaviour unintuitive / arguably wrong
In-Reply-To: <524F231E.5010001@kaltenbrunner.cc>
References: <E1VOXZv-0008Q9-0Z@wrigleys.postgresql.org> <20131002161946.GB5960@momjian.us> <524F231E.5010001@kaltenbrunner.cc>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox