Re: Adding xpath_exists function

From: mike(at)mlfowler(dot)com
To: Robert Haas <robertmhaas(at)gmail(dot)com>
Cc: pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Adding xpath_exists function
Date: 2010-05-06 21:53:23
Message-ID: 20100506225323.f10qfyljk88kg0g8@www.mlfowler.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers pgsql-rrreviewers

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.

Thanks,

--
Mike Fowler

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Takahiro Itagaki 2010-05-07 02:19:33 Re: pg_stat_transaction patch
Previous Message Bruce Momjian 2010-05-06 21:32:07 Re: max_standby_delay considered harmful

Browse pgsql-rrreviewers by date

  From Date Subject
Next Message Robert Haas 2010-05-07 02:40:59 Re: Adding xpath_exists function
Previous Message Robert Haas 2010-05-06 15:43:09 Re: Adding xpath_exists function