Skip site navigation (1) Skip section navigation (2)

Re: Adding xpath_exists function

From: Robert Haas <robertmhaas(at)gmail(dot)com>
To: mike(at)mlfowler(dot)com
Cc: pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Adding xpath_exists function
Date: 2010-05-07 02:40:59
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-hackerspgsql-rrreviewers
On Thu, May 6, 2010 at 5:53 PM,  <mike(at)mlfowler(dot)com> wrote:
> Quoting Robert Haas <robertmhaas(at)gmail(dot)com>:
>> I'm not sure I understand how this more convenient than just using
>> xpath() with exists()?
> It will save a lot of complexity in WHERE clauses. For example using
> exists() in xpath() you might construct something like:
> WHERE array_dims(xpath('exists(/foo/bar)','<bar><foo/></bar>'::xml) IS NOT
> NULL ...
> Whereas a dedicated xpath_exists() would look like:
> WHERE xpath_exists('/foo/bar','<bar><foo/></bar>'::xml) ....
> I accept this example is quite basic, but I hope it illustrates the added
> usability. I think xml in sql is complex enough, especially when you start
> considering namespaces, that anything we can do to simplify common use cases
> can only help improve the uptake of postgres xml.

Oh, I see.  Well, that might be reasonable syntactic sugar, although I
think you should make it wrap the path in exists() unconditionally,
rather than testing for an existing wrap.

Please email your patch to the list (replying to this email is fine)
and add it here:

Robert Haas
The Enterprise Postgres Company

In response to


pgsql-hackers by date

Next:From: Robert HaasDate: 2010-05-07 03:24:51
Subject: Re: including PID or backend ID in relpath of temp rels
Previous:From: Takahiro ItagakiDate: 2010-05-07 02:19:33
Subject: Re: pg_stat_transaction patch

pgsql-rrreviewers by date

Next:From: Mike FowlerDate: 2010-05-07 09:46:55
Subject: Re: Adding xpath_exists function
Previous:From: mikeDate: 2010-05-06 21:53:23
Subject: Re: Adding xpath_exists function

Privacy Policy | About PostgreSQL
Copyright © 1996-2018 The PostgreSQL Global Development Group