Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1VnR7V-0000ID-11 for pgsql-bugs@arkaria.postgresql.org; Mon, 02 Dec 2013 10:52:53 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.80) (envelope-from ) id 1VnR7U-0006Kh-FG for pgsql-bugs@arkaria.postgresql.org; Mon, 02 Dec 2013 10:52:52 +0000 Received: from makus.postgresql.org ([2001:4800:7903:4::125]) by malur.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1VnR7S-0006Iq-Dm for pgsql-bugs@postgresql.org; Mon, 02 Dec 2013 10:52:50 +0000 Received: from out1-smtp.messagingengine.com ([66.111.4.25]) by makus.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1VnR7O-0006gf-Mr for pgsql-bugs@postgresql.org; Mon, 02 Dec 2013 10:52:49 +0000 Received: from compute3.internal (compute3.nyi.mail.srv.osa [10.202.2.43]) by gateway1.nyi.mail.srv.osa (Postfix) with ESMTP id EC67B20E87; Mon, 2 Dec 2013 05:52:42 -0500 (EST) Received: from frontend1 ([10.202.2.160]) by compute3.internal (MEProxy); Mon, 02 Dec 2013 05:52:42 -0500 DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d=phlo.org; h=from :content-type:content-transfer-encoding:subject:date:message-id :cc:to:mime-version; s=mesmtp; bh=CATpXOY/m28+es+C/ksWgBttjk8=; b= JUCOwTb121iacyIrenf2vbVQ2rRg7q12KCkWriug7AFOJy47H1ohyPB8OPFUJ/PT nRuanCP3qdMGWqTiBT5sagzOlyktWyl8ckwEOs6Q2hDaNpYLJJBq41LBQhzppZWa m/Dy1OXWTVEDc2QIMR9RRKOSupCE7oNkYZzRpmhTr70= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d= messagingengine.com; h=from:content-type :content-transfer-encoding:subject:date:message-id:cc:to :mime-version; s=smtpout; bh=CATpXOY/m28+es+C/ksWgBttjk8=; b=HG4 79eQaEuosm83b73tlXlHTHI1vPfvBeREPvFrOR0tWLDpD9pIbP1hPXZEmQD5+JbD Tccme/bn048bSvZKExsCRi0YZkYllLQns0or9G4WfKVN7bSGqTOMYC5x6L9tN2Ai xp1UxArHlvgbxCbyU8Ek0SF+PTOUVqknd9paA0nk= X-Sasl-enc: 4SPrbV7na8vvdUKd3rOidICVaww8R7txe3NtKSPQ87Vm 1385981561 Received: from phlook.config (unknown [149.241.116.146]) by mail.messagingengine.com (Postfix) with ESMTPA id 78D5FC00E87; Mon, 2 Dec 2013 05:52:36 -0500 (EST) From: Florian Pflug Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: quoted-printable Subject: Re: BUG #8469: Xpath behaviour unintuitive / arguably wrong Date: Mon, 2 Dec 2013 10:52:29 +0000 Message-Id: <72DA66D9-0222-4888-AF55-61D3337CAC7A@phlo.org> Cc: Stefan Kaltenbrunner , dennis.noordsij@helsinki.fi, pgsql-bugs@postgresql.org To: Bruce Momjian Mime-Version: 1.0 (Mac OS X Mail 6.6 \(1510\)) X-Mailer: Apple Mail (2.1510) X-Pg-Spam-Score: -0.8 (/) 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 2013-10-05 Broce Monjian wrote: > On Fri, Oct 4, 2013 at 10:20:46PM +0200, Stefan Kaltenbrunner wrote: > > > > http://www.postgresql.org/message-id/201106291934.23089.rsmogura@so= ftperience.eu > > >=20 > > > There are two other similar bug reports on this from February and Mar= ch > > > of this year: > > >=20 > > > http://www.postgresql.org/message-id/E1U1FKL-0002rD-RO@wrihigleys.pos= tgresql.org > > I think that should be: > > http://www.postgresql.org/message-id/E1U1FKL-0002rD-RO@wrigleys.postgre= sql.org > > > http://www.postgresql.org/message-id/E1UHyUw-0001oj-HE@wrigleys.postg= resql.org > > > Someone who knows XML needs to take leadership on this and propose a > > > patch. > Added to TODO. I'm the one who submitted the patch which changed XPATH's behaviour. While = I agree that some might find it counter-intuitive for an XPATH expression like //no= de/text() to return quoted output, there's really no way around that given the way th= e postgres type system works. A general XPATH function needs to return XML[], not TEXT[], since an XPATH = can not only select text and attribute nodes, but whole XML subtrees. But if it ret= urns XML, it NEEDS to return something that's actually valid content for a value of t= ype XML, not plain test masquerading as XML. Otherwise, basic guarantees are violate= d, like for example that xmlin(xmlout(value)) yields value (and not an error). So unfortunate as it may be, I really see no way around the current behavio= ur. We could (and should) however * Provide an way to actually unescape text contained in XML fields. I pla= nned to post a followup patch doing that when I submitted the patch for XPATH, = but then stuff came up and=85 oh well=85 :-( * Add a big, fat warning to the docs about this.=20 best regards, Florian Pflug PS: I'm not subscribed to pgsql-bugs, so please keep me on the CC list --=20 Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-bugs