= any((select )) needs cast, why? - Mailing list pgsql-general

From Frank van Vugt
Subject = any((select )) needs cast, why?
Date
Msg-id 201111121210.03296.ftm.van.vugt@foxi.nl
Whole thread Raw
Responses Re: = any((select )) needs cast, why?  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-general
L.S.

Could someone point me to the formal reason why in:

postgres=# select version();
                                        version
---------------------------------------------------------------------------------------
 PostgreSQL 9.0.4 on x86_64-unknown-linux-gnu, compiled by GCC gcc (GCC)
4.3.3, 64-bit
(1 row)


the cast to int[ ] of the result row is needed here:

postgres=# select 1 = any((select ARRAY[1,2])::int[]);
 ?column?
----------
 t
(1 row)


in order to avoid an error:

postgres=# select 1 = any((select ARRAY[1,2]));
ERROR:  operator does not exist: integer = integer[]
LINE 1: select 1 = any((select ARRAY[1,2]));
                 ^
HINT:  No operator matches the given name and argument type(s). You might need
to add explicit type casts.


Is the right hand side resulting in an array of an array or....?

--


Best,




Frank.

pgsql-general by date:

Previous
From: hubert depesz lubaczewski
Date:
Subject: Re: Strange problem with create table as select * from table;
Next
From: Enrico Sirola
Date:
Subject: Re: weird pg_statistic problem