Re: SELECT 1 = ANY (SELECT ARRAY[1,2,3]) -> ERROR: operator does not exist: integer = integer[] ?

Поиск
Список
Период
Сортировка
От Thor Michael Støre
Тема Re: SELECT 1 = ANY (SELECT ARRAY[1,2,3]) -> ERROR: operator does not exist: integer = integer[] ?
Дата
Msg-id 9134971A-2F3B-4701-A500-65196723BC72@gmail.com
обсуждение исходный текст
Ответ на Re: SELECT 1 = ANY (SELECT ARRAY[1,2,3]) -> ERROR: operator does not exist: integer = integer[] ?  (Ian Lawrence Barwick <barwick@gmail.com>)
Список pgsql-general
On 13. mars 2013, at 15:35, Ian Lawrence Barwick <barwick@gmail.com> wrote:
> -> "Is the integer value 1 contained in the specified result set,
> which happens to be an array (which is not comparable with an
> integer)?" (NO)
>
> select 1 = ANY ((SELECT ARRAY[1,2,3])::int[]);
> -> "Is the value one contained in an array of integers which is
> derived by converting a result set into an array?" (YES)
>
> Note:
>
> testdb=> SELECT array[1,2,3] = ANY (SELECT ARRAY[1,2,3]);
> ?column?
> ----------
> t
> (1 row)
>
> I hope that makes some kind of sense…


Right, "= ANY" could either match an array or a result set. I thought of it as only matching arrays, I've never used it
forsubqueries where I've always used IN, that's what had me confused. For most other operators a select enclosed in
parenthesiswill be converted to a single type, array or not, but in this case it's evaluated as a result set. That
clearsit up. 

Thanks,
Michael

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

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: SELECT 1 = ANY (SELECT ARRAY[1,2,3]) -> ERROR: operator does not exist: integer = integer[] ?
Следующее
От: John R Pierce
Дата:
Сообщение: Re: table spaces