= ANY (SELECT ..) and type casts, what's going on here?

Поиск
Список
Период
Сортировка
От Russell Smith
Тема = ANY (SELECT ..) and type casts, what's going on here?
Дата
Msg-id 4DF92E53.50700@pws.com.au
обсуждение исходный текст
Ответы Re: = ANY (SELECT ..) and type casts, what's going on here?
Список pgsql-general
Hi,

Is anybody able to explain the following behaviour?

Server is 8.4.7  RHEL5 build.  Also happens on 8.4.8 Ubuntu x64 package.

mr-russ=# SELECT 'BU'::varchar = ANY ((select '{BU,CI}'::varchar[]));
ERROR:  operator does not exist: character varying = character varying[]
LINE 1: SELECT 'BU'::varchar = ANY ((select '{BU,CI}'::varchar[]));
                             ^
HINT:  No operator matches the given name and argument type(s). You might need to add explicit type casts.
mr-russ=# SELECT 'BU'::varchar = ANY ((select '{BU,CI}'::varchar[])::varchar[]);
 ?column?
----------
 t
(1 row)

mr-russ=#


What I don't understand is what happens to the single SELECT's type, is it because select returns a row?  The error
doesn'tseem to match what I would expect? 

Thanks

Russell

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

Предыдущее
От: "David Johnston"
Дата:
Сообщение: { SELECT *->NOT(column1, column2) FROM table } syntax idea
Следующее
От: "Matthew A. R. Sherian"
Дата:
Сообщение: Further details on cursors.