X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 5B7779DCA21 for ; Tue, 20 Dec 2005 09:43:24 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 76204-04 for ; Tue, 20 Dec 2005 09:43:27 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from smtpout.eastlink.ca (smtpout.eastlink.ca [24.222.0.30]) by postgresql.org (Postfix) with ESMTP id D9C359DC89E for ; Tue, 20 Dec 2005 09:43:21 -0400 (AST) Received: from ip01.eastlink.ca ([24.222.10.5]) by mta01.eastlink.ca (Sun Java System Messaging Server 6.2-4.03 (built Sep 22 2005)) with ESMTP id <0IRS00CEYU4H52N1@mta01.eastlink.ca> for pgsql-sql@postgresql.org; Tue, 20 Dec 2005 09:43:29 -0400 (AST) Received: from blk-137-99-147.eastlink.ca (HELO tickletrunk.engtech.eng) ([24.137.99.147]) by ip01.eastlink.ca with ESMTP; Tue, 20 Dec 2005 09:42:59 -0400 Date: Tue, 20 Dec 2005 09:42:51 -0400 From: Michael Burke Subject: Sub-query as function argument To: pgsql-sql@postgresql.org Message-id: <200512200942.51624.michael@engtech.ca> MIME-version: 1.0 Content-type: text/plain; charset=us-ascii Content-transfer-encoding: 7BIT Content-disposition: inline X-BrightmailFiltered: true X-Brightmail-Tracker: AAAAAA== User-Agent: KMail/1.8.3 X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0 required=5 tests=[none] X-Spam-Score: 0 X-Spam-Level: X-Archive-Number: 200512/175 X-Sequence-Number: 23717 Is it possible to execute a SELECT query as an argument to a function? Example: SELECT my_func('Sample', NULL, SELECT MIN(year) FROM audio); In my particular case, my_func inserts columns into another table; I wish to use values from another table as the arguments. The interior SELECT will return only a single value; perhaps it needs to be wrapped in another function? TIA. Mike. -- Michael Burke michael@engtech.ca