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 AA969D1B286 for ; Mon, 10 May 2004 22:47:46 -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 61174-06 for ; Mon, 10 May 2004 22:47:30 -0300 (ADT) Received: from news.hub.org (news.hub.org [200.46.204.72]) by svr1.postgresql.org (Postfix) with ESMTP id 7A3AED1B281 for ; Mon, 10 May 2004 22:47:26 -0300 (ADT) Received: from news.hub.org (news.hub.org [200.46.204.72]) by news.hub.org (8.12.9/8.12.9) with ESMTP id i4B1lPSx014470 for ; Tue, 11 May 2004 01:47:25 GMT (envelope-from news@news.hub.org) Received: (from news@localhost) by news.hub.org (8.12.9/8.12.9/Submit) id i4B1fcdF010812 for pgsql-sql@postgresql.org; Tue, 11 May 2004 01:41:38 GMT From: CoL X-Newsgroups: comp.databases.postgresql.sql Subject: Re: Subqueries returning more than one value? Date: Tue, 11 May 2004 03:43:29 +0200 Organization: Hub.Org Networking Services Lines: 25 Message-ID: References: Reply-To: col@mportal.hu Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-Complaints-To: usenet@news.hub.org User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.8a) Gecko/20040510 X-Accept-Language: en-us, en In-Reply-To: To: pgsql-sql@postgresql.org 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: 200405/99 X-Sequence-Number: 17813 hi, Adam Witney wrote, On 5/11/2004 02:09: > Hi, > > I am using a function in a subquery, this works ok: > > SELECT name, (SELECT p_my_func(1)) AS id > FROM test; > > However I would like to have the function return 2 values into the main > query... Something like this: > > SELECT name, (SELECT p_my_func(1)) AS (id, type) > FROM test; > > Of course this gives the error: > > ERROR: subquery must return only one column > > Is there any way around this? SELECT name,t.* FROM (SELECT p_my_func(1)) AS t(id, type), test C.