Received: from localhost (unknown [200.46.208.211]) by mail.postgresql.org (Postfix) with ESMTP id B0D10633628 for ; Wed, 8 Jul 2009 22:43:59 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by localhost (mx1.hub.org [200.46.208.211]) (amavisd-maia, port 10024) with ESMTP id 81441-05 for ; Wed, 8 Jul 2009 22:43:39 -0300 (ADT) Received: from news.hub.org (news.hub.org [200.46.204.72]) by mail.postgresql.org (Postfix) with ESMTP id 3283B6321AD for ; Wed, 8 Jul 2009 22:43:48 -0300 (ADT) Received: from news.hub.org (news.hub.org [200.46.204.72]) by news.hub.org (8.14.3/8.14.3) with ESMTP id n691hfR7017458 for ; Wed, 8 Jul 2009 22:43:41 -0300 (ADT) (envelope-from news@news.hub.org) Received: (from news@localhost) by news.hub.org (8.14.3/8.14.3/Submit) id n691Mba4040399 for pgsql-sql@postgresql.org; Wed, 8 Jul 2009 22:22:37 -0300 (ADT) (envelope-from news) From: Joseph S X-Newsgroups: pgsql.sql Subject: ERROR: function expression in FROM may not refer to other relations of same query level Date: Wed, 08 Jul 2009 21:22:41 -0400 Organization: Hub.Org Networking Services Lines: 18 Message-ID: Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Complaints-To: usenet@news.hub.org User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.8.1.22) Gecko/20090608 Thunderbird/2.0.0.22 Mnenhy/0.7.5.0 To: pgsql-sql@postgresql.org X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests=none X-Spam-Level: X-Archive-Number: 200907/37 X-Sequence-Number: 32778 I've seen this asked in the archives, but there was never any answer. Supposed I have this table: create temp table tempa (ids int[]); insert into tempa SELECT ARRAY[1 , 2, 3]; Now how do I get output from that? None of these work: (xunnest is my version of unnest since I'm using 8.2.x) select * FROM xunnest(tempa.ids); SELECT * FROM (select * FROM xunnest(tempa.ids) AS aa) AS ab, tempa; SELECT * FROM ( select * FROM xunnest(ta.ids) AS aa) AS ab, tempa ta; SELECT * FROM tempa ta, ( select * FROM xunnest(ta.ids) AS aa) AS ab;