Re: ANY

From: Richard Huxton <dev(at)archonet(dot)com>
To: Alban Hertroys <alban(at)magproductions(dot)nl>
Cc: Stefan Schwarzer <stefan(dot)schwarzer(at)grid(dot)unep(dot)ch>, pgsql-general(at)postgresql(dot)org
Subject: Re: ANY
Date: 2007-09-06 13:26:05
Message-ID: 46DFFFED.9010809@archonet.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

In response to

Responses

  • Re: ANY at 2007-09-06 15:56:30 from Alban Hertroys

Browse pgsql-general by date

  From Date Subject
Next Message gunce orman 2007-09-06 13:26:59 foreign key violation error with partitioned table
Previous Message Rajaram J 2007-09-06 13:25:17 Wrong dynamic link ../../../src/interfaces/libpq/libpq.sl.3