Re: Why does =ANY() need an extra cast when used

Поиск
Список
Период
Сортировка
От Stephan Szabo
Тема Re: Why does =ANY() need an extra cast when used
Дата
Msg-id 20040823075510.H6667@megazone.bigpanda.com
обсуждение исходный текст
Ответ на Why does =ANY() need an extra cast when used on an array returned by a select?  (Frank van Vugt <ftm.van.vugt@foxi.nl>)
Список pgsql-general
On Mon, 23 Aug 2004, Frank van Vugt wrote:

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


Barring the cast syntax and such, the first and last query would I believe
be illegal in SQL92/99, so we defined useful behavior for them for this
case.  The second query looks to me to be of the form = ANY (table
subquery) which already had defined behavior by spec. Changing it to act
like the first or last would break that spec behavior.

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

Предыдущее
От: Bruce Momjian
Дата:
Сообщение: Re: Unsupported 3rd-party solutions (Was: Few questions
Следующее
От: Frank van Vugt
Дата:
Сообщение: Re: Why does =ANY() need an extra cast when used