Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1VSBs1-00005H-D2 for pgsql-bugs@arkaria.postgresql.org; Fri, 04 Oct 2013 20:21:05 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.80) (envelope-from ) id 1VSBs0-0001LD-Ia for pgsql-bugs@arkaria.postgresql.org; Fri, 04 Oct 2013 20:21:04 +0000 Received: from makus.postgresql.org ([2001:4800:7903:4::125]) by malur.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1VSBrz-0001L6-JP for pgsql-bugs@postgresql.org; Fri, 04 Oct 2013 20:21:03 +0000 Received: from cronos.madness.at ([2a02:16a8:dc41::10]) by makus.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1VSBrv-0001HG-NJ for pgsql-bugs@postgresql.org; Fri, 04 Oct 2013 20:21:02 +0000 Received: from mastermind.kaltenbrunner.cc ([2001:470:7a2d::22]) by cronos.madness.at with esmtpsa (TLS1.0:DHE_RSA_CAMELLIA_256_CBC_SHA1:256) (Exim 4.80) (envelope-from ) id 1VSBrn-0008Jk-1i; Fri, 04 Oct 2013 22:20:53 +0200 Message-ID: <524F231E.5010001@kaltenbrunner.cc> Date: Fri, 04 Oct 2013 22:20:46 +0200 From: Stefan Kaltenbrunner User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.0 MIME-Version: 1.0 To: Bruce Momjian , dennis.noordsij@helsinki.fi CC: pgsql-bugs@postgresql.org Subject: Re: BUG #8469: Xpath behaviour unintuitive / arguably wrong References: <20131002161946.GB5960@momjian.us> In-Reply-To: <20131002161946.GB5960@momjian.us> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Pg-Spam-Score: -1.9 (-) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-bugs Precedence: bulk Sender: pgsql-bugs-owner@postgresql.org 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: >> >> >> Jones & Smith >> >> >> 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()', '<'))[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 is "<", it's just escaped when serialized >> to XML. If 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