xpath() subquery for empty array
| От | Roy Walter |
|---|---|
| Тема | xpath() subquery for empty array |
| Дата | |
| Msg-id | 4A59ABA9.9080209@brookhouse.co.uk обсуждение |
| Ответы |
Re: xpath() subquery for empty array
|
| Список | pgsql-general |
In postgres 8.4 When running xpath() queries it seems that empty results are always returned. So if I query a table containing 1000 XML documents a 1000 rows will always be fetched even if the xpath() element of the query only matches 10 documents.
The documentation states:
Thanks in advance,
Roy
The documentation states:
The functionYet it seems that empty node sets (arrays) are also returned. So, my thought was to run a subquery to eliminate empty arrays, e.g.:xpathevaluates the XPath expression xpath against the XML value xml. It returns an array of XML values corresponding to the node set produced by the XPath expression.
SELECT xHow do I test for an empty array in postgres?
FROM (SELECT xpath('//entry[contains(p, ''searchtext'')]/@*', docxml)
AS x FROM docs) AS y WHERE x <> [test for empty array?????????]
Thanks in advance,
Roy
В списке pgsql-general по дате отправления: