Re: ANY - Mailing list pgsql-general

From Richard Huxton
Subject Re: ANY
Date
Msg-id 46DFFFED.9010809@archonet.com
Whole thread Raw
In response to ANY (was: Re: Alias "all fields"?)  (Alban Hertroys <alban@magproductions.nl>)
Responses Re: ANY
List pgsql-general
Alban Hertroys wrote:
>
> SELECT * FROM gdp WHERE NULL IS NOT ANY(y1970, y1971, y1972);
>
> I get nothing but syntax errors... I remember trying to use ANY in the
> past and never got it to work...
>
> So, how do you use ANY with a fixed set of values (the way IN can)? And
> can this be used to solve the OP's problem without using tricks like
> summing NULL values?

AFAIK there are two variants of ANY()
   1. sets
   2. arrays

So you should be able to do:
   ... WHERE x = ANY( ARRAY[a, b, c] )

Of course, where x is NULL, I don't think that'll help you (x = NULL
returns NULL). Oh, and you couldn't have nulls in arrays before 8.2 iirc.

--
   Richard Huxton
   Archonet Ltd

pgsql-general by date:

Previous
From: "Rajaram J"
Date:
Subject: Wrong dynamic link ../../../src/interfaces/libpq/libpq.sl.3
Next
From: "gunce orman"
Date:
Subject: foreign key violation error with partitioned table