X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id 0BBA5D1E5E0 for ; Thu, 29 Apr 2004 14:57:45 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 97261-09 for ; Thu, 29 Apr 2004 14:57:25 -0300 (ADT) Received: from tht.net (vista.tht.net [216.126.88.2]) by svr1.postgresql.org (Postfix) with ESMTP id 99ECBD1E60F for ; Thu, 29 Apr 2004 14:57:24 -0300 (ADT) Received: from [134.22.68.249] (dyn-68-249.tor.dsl.tht.net [134.22.68.249]) by tht.net (Postfix) with ESMTP id 7399A76ADD; Thu, 29 Apr 2004 13:57:28 -0400 (EDT) Subject: Re: Check a value in array From: Rod Taylor To: Marco Lazzeri Cc: pgsql-sql@postgresql.org In-Reply-To: <1083260230.20352.7.camel@macbeth.intranet.noze.it> References: <1083260230.20352.7.camel@macbeth.intranet.noze.it> Content-Type: text/plain Message-Id: <1083261407.30065.303.camel@jester> Mime-Version: 1.0 X-Mailer: Ximian Evolution 1.4.5 Date: Thu, 29 Apr 2004 13:56:47 -0400 Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at postgresql.org X-Spam-Status: No, hits=0.0 tagged_above=0.0 required=5.0 tests= X-Spam-Level: X-Archive-Number: 200404/320 X-Sequence-Number: 17695 On Thu, 2004-04-29 at 13:37, Marco Lazzeri wrote: > Hi all. > > I have to check if a value is in an array. > > I've got a date array in a table and I would like to perform queries > like: > > SELECT * FROM table WHERE date IN dates_array; If you're using 7.4 or later, try: SELECT * FROM table WHERE date = ANY(dates_array); This will work without the contrib package.