Search Postgresql Archives

Re: xpath() subquery for empty array

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sun, Jul 12, 2009 at 09:49:15PM +0100, Roy Walter wrote:
> Where exactly does that fit in terms of my original query, i.e.:
> 
>    SELECT x
>    FROM (SELECT xpath('//entry[contains(p, ''searchtext'')]/@*', docxml)
>    AS x FROM docs) AS y WHERE x <> [test for empty array?????????]

Something like the following should do the right thing:

  SELECT x FROM (
    SELECT xpath('//entry[contains(p, ''searchtext'')]/@*', docxml) AS x
    FROM docs) AS y
  WHERE array_upper(x, 1) > 0;

-- 
  Sam  http://samason.me.uk/

-- 
Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux