Re: [GENERAL] xpath() subquery for empty array

2009-07-12 Thread Roy Walter
Sam Mason wrote: 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?

Re: [GENERAL] xpath() subquery for empty array

2009-07-12 Thread Sam Mason
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

Re: [GENERAL] xpath() subquery for empty array

2009-07-12 Thread Roy Walter
Scott Bailey wrote: Sam Mason wrote: On Sun, Jul 12, 2009 at 06:41:57PM +0100, Roy Walter wrote: Scott Bailey wrote: Roy Walter wrote: How do I test for an empty array in postgres? WHERE x != array[]::xml[] Thanks Scott but that throws up a syntax error (at the closing bracket of array[]

Re: [GENERAL] xpath() subquery for empty array

2009-07-12 Thread Scott Bailey
Sam Mason wrote: On Sun, Jul 12, 2009 at 06:41:57PM +0100, Roy Walter wrote: Scott Bailey wrote: Roy Walter wrote: How do I test for an empty array in postgres? WHERE x != array[]::xml[] Thanks Scott but that throws up a syntax error (at the closing bracket of array[]): ERROR: synta

Re: [GENERAL] xpath() subquery for empty array

2009-07-12 Thread Sam Mason
On Sun, Jul 12, 2009 at 06:41:57PM +0100, Roy Walter wrote: > Scott Bailey wrote: > >Roy Walter wrote: > >>How do I test for an empty array in postgres? > > > >WHERE x != array[]::xml[] > > > > > Thanks Scott but that throws up a syntax error (at the closing bracket > of array[]): > >ERROR:

Re: [GENERAL] xpath() subquery for empty array

2009-07-12 Thread Roy Walter
Scott Bailey wrote: Roy Walter wrote: 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 d

Re: [GENERAL] xpath() subquery for empty array

2009-07-12 Thread Scott Bailey
Roy Walter wrote: 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: