Re: Check a column value not in Array.

From: Emi Lu <emilu(at)encs(dot)concordia(dot)ca>
To: Filip Rembiałkowski <plk(dot)zuber(at)gmail(dot)com>
Cc: pgsql-sql(at)postgresql(dot)org
Subject: Re: Check a column value not in Array.
Date: 2008-08-15 13:32:32
Message-ID: 48A58570.4080307@encs.concordia.ca
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

>> select *
>> from test
>> where test.col not in ARRAY['val1', 'val2'];
>>
>
> select * from test where test.col <> ALL ( ARRAY['val1', 'val2'] );
>
> see http://www.postgresql.org/docs/current/static/functions-comparisons.html
>
> be careful with NULLs in this type of comparisons.

Thanks a lot for all your inputs!

For efficiency, I guess :

(1) "... where test.col <> all ARRAY['val1', 'val2']"
and
(2) "... where test.col not in ('var1', 'var2')"

provide the same query efficiency right?

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Edward W. Rouse 2008-08-15 16:48:10 Join question
Previous Message Andreas Wenk 2008-08-15 07:37:05 Re: Check a column value not in Array.