Received: from maia.hub.org (unknown [200.46.204.183]) by mail.postgresql.org (Postfix) with ESMTP id 3D22A63279F for ; Fri, 11 Sep 2009 18:45:06 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.183]) (amavisd-maia, port 10024) with ESMTP id 77329-07 for ; Fri, 11 Sep 2009 21:44:58 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by mail.postgresql.org (Postfix) with ESMTP id 8AB59630733 for ; Fri, 11 Sep 2009 18:44:58 -0300 (ADT) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.2/8.14.2) with ESMTP id n8BLitj8011733; Fri, 11 Sep 2009 17:44:55 -0400 (EDT) To: Gerardo Herzig cc: postgres list Subject: Re: its posible to use a 2 column returning function as a subquery? In-reply-to: <4AAAB01E.8070009@fmed.uba.ar> References: <4AAAB01E.8070009@fmed.uba.ar> Comments: In-reply-to Gerardo Herzig message dated "Fri, 11 Sep 2009 17:16:30 -0300" Date: Fri, 11 Sep 2009 17:44:54 -0400 Message-ID: <11732.1252705494@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-2.599 tagged_above=-10 required=5 tests=BAYES_00=-2.599 X-Spam-Level: X-Archive-Number: 200909/51 X-Sequence-Number: 33116 Gerardo Herzig writes: > There is some syntax for calling get_desc_and_price only once? Do something like select (t).* from (select get_desc_and_price(shoe) as t from ...) ss; If you don't have get_desc_and_price marked as volatile, you'll probably also need to add "offset 0" to the sub-select to keep the planner from flattening the sub-select and producing multiple calls of the function. regards, tom lane