Received: from magus.postgresql.org (magus.postgresql.org [87.238.57.229]) by mail.postgresql.org (Postfix) with ESMTP id 41F43CE6EC for ; Fri, 15 Jun 2012 13:35:40 -0300 (ADT) Received: from sss.pgh.pa.us ([66.207.139.130]) by magus.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1SfZUo-0008Vk-9F for pgsql-bugs@postgresql.org; Fri, 15 Jun 2012 16:35:39 +0000 Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.5/8.14.5) with ESMTP id q5FGZPg3029013; Fri, 15 Jun 2012 12:35:25 -0400 (EDT) From: Tom Lane To: sergey-1987@yandex.ru cc: pgsql-bugs@postgresql.org Subject: Re: BUG #6690: ALL and ANY array operators In-reply-to: References: Comments: In-reply-to sergey-1987@yandex.ru message dated "Wed, 13 Jun 2012 11:54:49 -0000" Date: Fri, 15 Jun 2012 12:35:25 -0400 Message-ID: <29012.1339778125@sss.pgh.pa.us> X-Pg-Spam-Score: -1.9 (-) X-Archive-Number: 201206/145 X-Sequence-Number: 33372 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