Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1VdP8j-0004hp-8Z for pgsql-bugs@arkaria.postgresql.org; Mon, 04 Nov 2013 18:44:41 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.80) (envelope-from ) id 1VdP8i-0000DK-DM for pgsql-bugs@arkaria.postgresql.org; Mon, 04 Nov 2013 18:44:40 +0000 Received: from makus.postgresql.org ([2001:4800:7903:4::125]) by malur.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1VdP8h-0000CB-BL for pgsql-bugs@postgresql.org; Mon, 04 Nov 2013 18:44:39 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by makus.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1VdP8e-0000Lq-CR for pgsql-bugs@postgresql.org; Mon, 04 Nov 2013 18:44:38 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.4/8.14.4) with ESMTP id rA4IiSgC025509; Mon, 4 Nov 2013 13:44:28 -0500 From: Tom Lane To: Dan Scott cc: pgsql-bugs@postgresql.org, Bruce Momjian Subject: Re: BUG #7844: xpath missing entity decoding - bug or feature In-reply-to: References: Comments: In-reply-to Dan Scott message dated "Mon, 04 Nov 2013 12:32:04 -0500" Date: Mon, 04 Nov 2013 13:44:28 -0500 Message-ID: <25508.1383590668@sss.pgh.pa.us> 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 Dan Scott writes: > On Sept 09, 2013 Bruce Momjian wrote: >> On Fri, Feb 1, 2013 at 12:02:41PM +0000, info(at)fduerr(dot)de wrote: >>> The following bug has been logged on the website: >>> >>> Bug reference: 7844 >>> Logged by: fduerr >>> Email address: info(at)fduerr(dot)de >>> PostgreSQL version: 9.2.2 >>> Operating system: Debian >>> Description: >>> >>> Up until 9.1 >>> >>> select (xpath('/z/text()', ('' || 'AT&T' || '')::xml))[1]; >>> >>> returned 'AT&T' >>> 9.2 returns 'AT&T' >>> >>> Is it a bug or a feature? >>> Is there a function to decode xml-entities? >> Does anyone have a comment on this? > Yes, the Evergreen project just ran into this change of behaviour and consider > it a bug. > https://bugs.launchpad.net/evergreen/+bug/1243023 tells the tale, but in short > the XPath spec states in "5.2 Element Nodes": > "Entity references to both internal and external entities are expanded. > Character references are resolved." (http://www.w3.org/TR/xpath/) > So we believe that the extracted text node children of element nodes should be > resolved when we retrieve them, as they were in 9.1 and before. The change in behavior was entirely intentional, see http://git.postgresql.org/gitweb/?p=postgresql.git&a=commitdiff&h=aaf15e5c1cf8d2c27d2f9841343f00027762cb4e which was extensively discussed beforehand: http://www.postgresql.org/message-id/flat/201106291934.23089.rsmogura@softperience.eu Before we'd consider reverting this, you'd have to explain why it would be okay for xpath() to not return valid XML. I don't see that the bit of spec you mention has anything to do with that consideration --- it's talking about some internal processing steps to be done by xpath(), not the representation of the final result. It does seem that there should be a way to convert the result to text with character escaping undone. I'm not seeing anything built-in for that, but maybe I'm missing it. regards, tom lane -- Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-bugs