From: Tom Lane <tgl@sss.pgh.pa.us>
To: sergey-1987@yandex.ru
Cc: pgsql-bugs@postgresql.org
Subject: Re: BUG #6690: ALL and ANY array operators
Date: Fri, 15 Jun 2012 12:35:25 -0400
Message-ID: <29012.1339778125@sss.pgh.pa.us> (raw)
In-Reply-To: <E1Sem9x-0006K6-CE@wrigleys.postgresql.org>
References: <E1Sem9x-0006K6-CE@wrigleys.postgresql.org>
sergey-1987@yandex.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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-bugs@postgresql.org
Cc: tgl@sss.pgh.pa.us, sergey-1987@yandex.ru
Subject: Re: BUG #6690: ALL and ANY array operators
In-Reply-To: <29012.1339778125@sss.pgh.pa.us>
References: <E1Sem9x-0006K6-CE@wrigleys.postgresql.org> <29012.1339778125@sss.pgh.pa.us>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox