<int> = any((select <int[]>)) needs cast, why?

From: Frank van Vugt <ftm(dot)van(dot)vugt(at)foxi(dot)nl>
To: pgsql-general(at)postgresql(dot)org
Subject: <int> = any((select <int[]>)) needs cast, why?
Date: 2011-11-12 11:10:02
Message-ID: 201111121210.03296.ftm.van.vugt@foxi.nl
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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.

Responses

Browse pgsql-general by date

  From Date Subject
Next Message alextc 2011-11-12 12:51:15 Re: Help with Stack Builder
Previous Message hubert depesz lubaczewski 2011-11-12 08:58:07 Re: Strange problem with create table as select * from table;