= ANY (SELECT ..) and type casts, what's going on here? - Mailing list pgsql-general

From Russell Smith
Subject = ANY (SELECT ..) and type casts, what's going on here?
Date
Msg-id 4DF92E53.50700@pws.com.au
Whole thread Raw
Responses Re: = ANY (SELECT ..) and type casts, what's going on here?
List 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 by date:

Previous
From: "David Johnston"
Date:
Subject: { SELECT *->NOT(column1, column2) FROM table } syntax idea
Next
From: "Matthew A. R. Sherian"
Date:
Subject: Further details on cursors.