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

Reply via email to