From: | Thor Michael Støre <thormichael(at)gmail(dot)com> |
---|---|
To: | "pgsql-general(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)org> |
Subject: | SELECT 1 = ANY (SELECT ARRAY[1, 2, 3]) -> ERROR: operator does not exist: integer = integer[] ? |
Date: | 2013-03-13 14:18:03 |
Message-ID: | 2F624E3A-5C94-44CB-B6D3-B1502D436FB5@gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
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
From | Date | Subject | |
---|---|---|---|
Next Message | Ian Lawrence Barwick | 2013-03-13 14:35:46 | Re: SELECT 1 = ANY (SELECT ARRAY[1,2,3]) -> ERROR: operator does not exist: integer = integer[] ? |
Previous Message | Fabrízio de Royes Mello | 2013-03-13 13:38:51 | Re: Select rotate in PostgreSql |