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 DDEF1528A8 for ; Fri, 3 Jun 2005 12:15:59 -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 88471-09 for ; Fri, 3 Jun 2005 15:15:51 +0000 (GMT) Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by svr1.postgresql.org (Postfix) with ESMTP id 6DB9F5280A for ; Fri, 3 Jun 2005 12:15:49 -0300 (ADT) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.13.1/8.13.1) with ESMTP id j53FFmxo005176; Fri, 3 Jun 2005 11:15:48 -0400 (EDT) To: Ami Ganguli Cc: pgsql-sql@postgresql.org Subject: Re: using a selected row as a function parameter In-reply-to: <87eeecff0506030744e04eb25@mail.gmail.com> References: <87eeecff0506030744e04eb25@mail.gmail.com> Comments: In-reply-to Ami Ganguli message dated "Fri, 03 Jun 2005 17:44:59 +0300" Date: Fri, 03 Jun 2005 11:15:48 -0400 Message-ID: <5175.1117811748@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.006 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200506/51 X-Sequence-Number: 21652 Ami Ganguli writes: > SELECT queue.apply_routing_rule( > (SELECT * from queue.messages WHERE id = 1), > (SELECT * from queue.routing_rules WHERE id = 1) > ); Not sure if that particular syntax should be expected to work, but why not SELECT queue.apply_routing_rule(messages.*, routing_rules.*) FROM queue.messages, queue.routing_rules WHERE messages.id = 1 AND routing_rules.id = 1; The query as you want to write it will certainly fail anyway if there's more than one row with id = 1 in either table, so it's not like there's some huge inefficiency in doing it as a join. regards, tom lane