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 6B383D1B21A for ; Mon, 10 May 2004 21:09:17 -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 46942-01 for ; Mon, 10 May 2004 21:08:57 -0300 (ADT) Received: from mailhub2.sghms.ac.uk (firewall.sghms.ac.uk [194.82.50.2]) by svr1.postgresql.org (Postfix) with ESMTP id A0C75D1B23F for ; Mon, 10 May 2004 21:08:52 -0300 (ADT) Received: from [194.82.51.24] (helo=imail) by mailhub2.sghms.ac.uk with esmtp (Exim 4.24) id 1BNKpI-0003rZ-5s for pgsql-sql@postgresql.org; Tue, 11 May 2004 01:08:52 +0100 Received: from [172.16.20.3] (mrc1-003.sghms.ac.uk [172.16.20.3]) by imail.sghms.ac.uk (iPlanet Messaging Server 5.2 Patch 1 (built Aug 19 2002)) with ESMTPA id <0HXI00APFWERA6@imail.sghms.ac.uk> for pgsql-sql@postgresql.org; Tue, 11 May 2004 01:08:52 +0100 (BST) Date: Tue, 11 May 2004 01:09:34 +0100 From: Adam Witney Subject: Subqueries returning more than one value? To: pgsql-sql Message-id: MIME-version: 1.0 Content-type: text/plain; charset=US-ASCII Content-transfer-encoding: 7BIT User-Agent: Microsoft-Entourage/10.1.1.2418 X-MailScanner-Information: Please contact sysadmin at sghms.ac.uk for more information X-MailScanner-MH2: No Virues detected X-MailScanner-SpamCheck: not spam, SpamAssassin (score=-4.9, required 5, autolearn=not spam, APARENTLY_FROM_MYSELF 1.00, BAYES_00 -4.90, FROM_SGHMS -1.00) X-MailScanner-From: awitney@sghms.ac.uk 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/92 X-Sequence-Number: 17806 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? Thanks for any help adam -- This message has been scanned for viruses and dangerous content by MailScanner, and is believed to be clean.