Re: Adding xpath_exists function

Поиск
Список
Период
Сортировка
От mike@mlfowler.com
Тема Re: Adding xpath_exists function
Дата
Msg-id 20100506225323.f10qfyljk88kg0g8@www.mlfowler.com
обсуждение исходный текст
Ответ на Re: Adding xpath_exists function  (Robert Haas <robertmhaas@gmail.com>)
Ответы Re: Adding xpath_exists function  (Robert Haas <robertmhaas@gmail.com>)
Список pgsql-hackers
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.

Thanks,

--
Mike Fowler



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

Предыдущее
От: Bruce Momjian
Дата:
Сообщение: Re: max_standby_delay considered harmful
Следующее
От: Takahiro Itagaki
Дата:
Сообщение: Re: pg_stat_transaction patch