Search Postgresql Archives

Re: Difference between "in (...)" and "= any(...)" queries when using arrays

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

 



Francisco Figueiredo Jr. wrote:
Hi all!

I was playing with "in (...)"  and "= any (...)" queries and found a
difference between them and I wonder:

why this works:

select * from table_of_integers where integer_column = any (array[5,6]);

This checks if integer_column matches any value in the specified array.

select * from table_of_integers where integer_column in (array[5,6]);

This checks if integer_column IS an array[5,6] (which it isn't).

You probably want ... IN (5,6)

SOME is a synonym for ANY. IN is equivalent to = ANY.

I think this is probably talking with respect to sub-queries.

--
  Richard Huxton
  Archonet Ltd

--
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