Re: Adding xpath_exists function

Поиск
Список
Период
Сортировка
От Robert Haas
Тема Re: Adding xpath_exists function
Дата
Msg-id AANLkTindcyMH87hwvFH-cLwRNMCdsMbDPCrxdqg-Lj_g@mail.gmail.com
обсуждение исходный текст
Ответ на Re: Adding xpath_exists function  (mike@mlfowler.com)
Ответы Re: Adding xpath_exists function  (Mike Fowler <mike@mlfowler.com>)
Re: Adding xpath_exists function  (Mike Fowler <mike@mlfowler.com>)
Список pgsql-hackers
On Thu, May 6, 2010 at 5:53 PM,  <mike@mlfowler.com> wrote:
> Quoting Robert Haas <robertmhaas@gmail.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:
https://commitfest.postgresql.org/action/commitfest_view/open

-- 
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise Postgres Company


В списке pgsql-hackers по дате отправления:

Предыдущее
От: Takahiro Itagaki
Дата:
Сообщение: Re: pg_stat_transaction patch
Следующее
От: Robert Haas
Дата:
Сообщение: Re: including PID or backend ID in relpath of temp rels