X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 7C57752817 for ; Fri, 3 Jun 2005 12:23:49 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 90466-09 for ; Fri, 3 Jun 2005 15:23:39 +0000 (GMT) Received: from tigger.fuhr.org (tigger.fuhr.org [63.214.45.158]) by svr1.postgresql.org (Postfix) with ESMTP id 402B452805 for ; Fri, 3 Jun 2005 12:23:34 -0300 (ADT) Received: from winnie.fuhr.org (winnie.fuhr.org [10.1.0.1]) by tigger.fuhr.org (8.13.3/8.13.3) with ESMTP id j53FNTZJ050596 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Fri, 3 Jun 2005 09:23:31 -0600 (MDT) (envelope-from mfuhr@winnie.fuhr.org) Received: from winnie.fuhr.org (localhost [127.0.0.1]) by winnie.fuhr.org (8.13.3/8.13.3) with ESMTP id j53FNTGH013735; Fri, 3 Jun 2005 09:23:29 -0600 (MDT) (envelope-from mfuhr@winnie.fuhr.org) Received: (from mfuhr@localhost) by winnie.fuhr.org (8.13.3/8.13.3/Submit) id j53FNSeJ013734; Fri, 3 Jun 2005 09:23:28 -0600 (MDT) (envelope-from mfuhr) Date: Fri, 3 Jun 2005 09:23:28 -0600 From: Michael Fuhr To: Ami Ganguli Cc: pgsql-sql@postgresql.org Subject: Re: using a selected row as a function parameter Message-ID: <20050603152328.GA66944@winnie.fuhr.org> References: <87eeecff0506030744e04eb25@mail.gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <87eeecff0506030744e04eb25@mail.gmail.com> X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.004 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200506/52 X-Sequence-Number: 21653 On Fri, Jun 03, 2005 at 05:44:59PM +0300, Ami Ganguli wrote: > > SELECT queue.apply_routing_rule( > (SELECT * from queue.messages WHERE id = 1), > (SELECT * from queue.routing_rules WHERE id = 1) > ); > > I get an error message along the lines of "sub-query must return a > single value". The error I get is "subquery must return only one column". Queries like the following should work in 8.0.x: SELECT queue.apply_routing_rule(m, r) FROM (SELECT * FROM queue.messages WHERE id = 1) AS m, (SELECT * FROM queue.routing_rules WHERE id = 1) AS r; SELECT queue.apply_routing_rule(m, r) FROM queue.messages AS m, queue.routing_rules AS r WHERE m.id = 1 AND r.id = 1; -- Michael Fuhr http://www.fuhr.org/~mfuhr/