Received: from maia.hub.org (unknown [200.46.208.211]) by mail.postgresql.org (Postfix) with ESMTP id 29CEC6324D2 for ; Wed, 24 Feb 2010 08:40:38 -0400 (AST) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.208.211]) (amavisd-maia, port 10024) with ESMTP id 21330-08 for ; Wed, 24 Feb 2010 12:40:20 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from sargon.lncsa.com (mail.lncsa.com [213.215.28.11]) by mail.postgresql.org (Postfix) with ESMTP id 89558632387 for ; Wed, 24 Feb 2010 08:40:27 -0400 (AST) Received: from localhost (localhost.localdomain [127.0.0.1]) by sargon.lncsa.com (Postfix) with ESMTP id 7572C301E6CD for ; Wed, 24 Feb 2010 13:40:24 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at lncsa.com Received: from sargon.lncsa.com ([127.0.0.1]) by localhost (sargon.lncsa.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id CmqsGdwksE-p for ; Wed, 24 Feb 2010 13:40:24 +0100 (CET) Received: from zenon.apartia.fr (zenon.apartia.fr [10.0.3.1]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client CN "zenon.apartia.fr", Issuer "ca.apartia.fr" (verified OK)) by sargon.lncsa.com (Postfix) with ESMTP id 54DBD300E355 for ; Wed, 24 Feb 2010 13:40:24 +0100 (CET) Received: from galba.apartia.fr (galba.apartia.fr [10.0.3.119]) by zenon.apartia.fr (Postfix) with ESMTP id F1CB159336C50 for ; Wed, 24 Feb 2010 13:40:23 +0100 (CET) Received: by galba.apartia.fr (Postfix, from userid 1000) id C30A01D427; Wed, 24 Feb 2010 13:40:23 +0100 (CET) Date: Wed, 24 Feb 2010 13:40:23 +0100 From: Louis-David Mitterrand To: pgsql-sql@postgresql.org Subject: join with an array Message-ID: <20100224124023.GA16500@apartia.fr> Mail-Followup-To: pgsql-sql@postgresql.org MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.5.20 (2009-06-14) X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-2.333 tagged_above=-10 required=5 tests=AWL=0.266, BAYES_00=-2.599 X-Spam-Level: X-Archive-Number: 201002/89 X-Sequence-Number: 33688 Hi, I'm trying the following query: select array_agg(t1.id) from table1 t1 join table2 t2 on (t2.id = any(array_agg)) group by t1.col1; but I get this error: ERROR: column "array_agg" does not exist I tried aliasing array_agg(t1.id) without success. Thanks for any suggestions,