Re: BUG #6690: ALL and ANY array operators

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: sergey-1987(at)yandex(dot)ru
Cc: pgsql-bugs(at)postgresql(dot)org
Subject: Re: BUG #6690: ALL and ANY array operators
Date: 2012-06-15 16:35:25
Message-ID: 29012.1339778125@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

sergey-1987(at)yandex(dot)ru writes:
> As I see in documentation,
> http://www.postgresql.org/docs/current/static/functions-aggregate.html there
> is an ambiguity with bool_or aggregate and ANY array operator, so bool_or
> cannot has standard name ANY. So ANY should always mean array operator. But
> such query produces syntax error:

> select 1 = ANY((select ARRAY[1, 2]::integer[]))

Yes. Do it like this instead:

select 1 = ANY(ARRAY[1, 2]::integer[]);

If the argument of ANY is a sub-select, the interpretation is to compare
the left-hand value to each row of the sub-select's output. This isn't
terribly consistent perhaps, but it's what's required by the SQL
standard.

regards, tom lane

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message Daniele Varrazzo 2012-06-15 18:11:40 Can't move extension out of pg_catalog
Previous Message Daniele Varrazzo 2012-06-15 15:15:57 pg_upgrade fails with missing FTS resources