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

Поиск
Список
Период
Сортировка
От Richard Huxton
Тема Re: Difference between "in (...)" and "= any(...)" queries when using arrays
Дата
Msg-id 4A092D17.1020608@archonet.com
обсуждение исходный текст
Ответ на Difference between "in (...)" and "= any(...)" queries when using arrays  ("Francisco Figueiredo Jr." <francisco@npgsql.org>)
Ответы Re: Difference between "in (...)" and "= any(...)" queries when using arrays  ("Francisco Figueiredo Jr." <francisco@npgsql.org>)
Список pgsql-general
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

В списке pgsql-general по дате отправления:

Предыдущее
От: "Tomasz Rejman"
Дата:
Сообщение: Selecting data from bytea field in 8.3
Следующее
От: Joe Kramer
Дата:
Сообщение: Re: Unable to access table named "user"