pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Florian Pflug <fgp@phlo.org>
To: Bruce Momjian <bruce@momjian.us>
Cc: Stefan Kaltenbrunner <stefan@kaltenbrunner.cc>
Cc: dennis.noordsij@helsinki.fi
Cc: pgsql-bugs@postgresql.org
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> (raw)
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-bugs>

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@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.

>  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 //node/text()
to return quoted output, there's really no way around that given the way the 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 returns XML,
it NEEDS to return something that's actually valid content for a value of type XML,
not plain test masquerading as XML. Otherwise, basic guarantees are violated, 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 behaviour. We
could (and should) however

  * Provide an way to actually unescape text contained in XML fields. I planned to
    post a followup patch doing that when I submitted the patch for XPATH, but then
    stuff came up and… oh well… :-(

  * Add a big, fat warning to the docs about this. 

best regards,
Florian Pflug

PS: I'm not subscribed to pgsql-bugs, so please keep me on the CC list



-- 
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs



view thread (10+ messages)  latest in thread

Message-ID: <72DA66D9-0222-4888-AF55-61D3337CAC7A@phlo.org>
Permalink:  ../72DA66D9-0222-4888-AF55-61D3337CAC7A@phlo.org/
Also on:    postgresql.org/message-id/72DA66D9-0222-4888-AF55-61D3337CAC7A@phlo.org

 · 

reply

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: fgp@phlo.org, bruce@momjian.us, stefan@kaltenbrunner.cc, dennis.noordsij@helsinki.fi
  Subject: Re: BUG #8469: Xpath behaviour unintuitive / arguably wrong
  In-Reply-To: <72DA66D9-0222-4888-AF55-61D3337CAC7A@phlo.org>
  References: <72DA66D9-0222-4888-AF55-61D3337CAC7A@phlo.org>

* 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