Why does =ANY() need an extra cast when used on an array returned by a select?

Поиск
Список
Период
Сортировка
От Frank van Vugt
Тема Why does =ANY() need an extra cast when used on an array returned by a select?
Дата
Msg-id 200408231614.22148.ftm.van.vugt@foxi.nl
обсуждение исходный текст
Ответ на Re: Greatest/Least functions?  (Martijn van Oosterhout <kleptog@svana.org>)
Ответы Re: Why does =ANY() need an extra cast when used  (Stephan Szabo <sszabo@megazone.bigpanda.com>)
Список pgsql-general
Hi,

The following works :

db=# select 1 = ANY ('{1,2,3}'::int[]);
 ?column?
----------
 t
(1 row)


This doesn't :

db=# select 1 = ANY (select '{1,2,3}'::int[]);
ERROR:  operator does not exist: integer = integer[]
HINT:  No operator matches the given name and argument type(s). You may need
to add explicit type casts.

Using an extra case, the above can easily be made to work :

db=# select 1 = ANY ((select '{1,2,3}'::int[])::int[]);
 ?column?
----------
 t
(1 row)


I'm just wondering why the array returned by the inner select is not casted by
ANY() automagically?


db=# select version();
                               version
---------------------------------------------------------------------
 PostgreSQL 7.4.5 on i686-pc-linux-gnu, compiled by GCC egcs-2.91.66
(1 row)





--
Best,




Frank.


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

Предыдущее
От: Christopher Browne
Дата:
Сообщение: Re: postgres replication only some datas
Следующее
От: Thomas Hallgren
Дата:
Сообщение: Re: Unsupported 3rd-party solutions (Was: Few questions