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

Поиск
Список
Период
Сортировка
От Thor Michael Støre
Тема SELECT 1 = ANY (SELECT ARRAY[1,2,3]) -> ERROR: operator does not exist: integer = integer[] ?
Дата
Msg-id 2F624E3A-5C94-44CB-B6D3-B1502D436FB5@gmail.com
обсуждение исходный текст
Ответы Re: SELECT 1 = ANY (SELECT ARRAY[1,2,3]) -> ERROR: operator does not exist: integer = integer[] ?
Список pgsql-general
Hello,

Could someone make sense of this for me?

$ /Library/PostgreSQL/9.2/bin/psql -d postgres postgres
psql (9.2.3)
Type "help" for help.

postgres=# select 1 = ANY (ARRAY[1,2,3]);
 ?column? 
----------
 t
(1 row)

postgres=# select 1 = ANY (SELECT ARRAY[1,2,3]);
ERROR:  operator does not exist: integer = integer[]
LINE 1: select 1 = ANY (SELECT ARRAY[1,2,3]);
                 ^
HINT:  No operator matches the given name and argument type(s). You might need to add explicit type casts.
postgres=# select 1 = ANY ((SELECT ARRAY[1,2,3])::int[]);
 ?column? 
----------
 t
(1 row)

Why do I have to add an explicit cast to int array on something that is an int array to begin with? Based on the error message containing "integer = integer[]" I'd say PostgreSQL manages to figure out the right type anyhow, and ::int[] shouldn't change anything, but I still get a message that doesn't make sense when I have an ANY there.

Thanks,
Michael

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

Предыдущее
От: Fabrízio de Royes Mello
Дата:
Сообщение: Re: Select rotate in PostgreSql
Следующее
От: Ian Lawrence Barwick
Дата:
Сообщение: Re: SELECT 1 = ANY (SELECT ARRAY[1,2,3]) -> ERROR: operator does not exist: integer = integer[] ?