Received: from localhost (unknown [200.46.208.211]) by mail.postgresql.org (Postfix) with ESMTP id 7F14263316B for ; Fri, 11 Sep 2009 17:26:56 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by localhost (mx1.hub.org [200.46.208.211]) (amavisd-maia, port 10024) with ESMTP id 04219-07 for ; Fri, 11 Sep 2009 20:26:41 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from mail.fmed.uba.ar (mail.fmed.uba.ar [157.92.152.1]) by mail.postgresql.org (Postfix) with ESMTP id A7D4D6336A4 for ; Fri, 11 Sep 2009 17:26:45 -0300 (ADT) Received: from [157.92.155.58] (mailbis [157.92.155.58]) by mail.fmed.uba.ar (Postfix) with ESMTP id CFA7539CAF7 for ; Fri, 11 Sep 2009 17:25:43 -0300 (ART) Message-ID: <4AAAB01E.8070009@fmed.uba.ar> Date: Fri, 11 Sep 2009 17:16:30 -0300 From: Gerardo Herzig User-Agent: Thunderbird 2.0.0.6 (X11/20070801) MIME-Version: 1.0 To: postgres list Subject: its posible to use a 2 column returning function as a subquery? Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-1.345 tagged_above=-10 required=5 tests=AWL=-0.235, BAYES_05=-1.11 X-Spam-Level: X-Archive-Number: 200909/50 X-Sequence-Number: 33115 Hi All. My poor english doest not allow me to get a better subject. Here is the thing: I have a function who returns a two column result, that is is used inside another function, like this CREATE FUNCTION show_result((some args), OUT shoe varchar, OUT desc varchar , OUT price numeric) ... as $$ select shoe, (get_desc_and_price(shoe)).desc, (get_desc_and_price(shoe)).price from ... $$ language sql; This is the only way i get this thing working. According to the timming, it looks like get_desc_and_price() is being called twice. There is some syntax for calling get_desc_and_price only once? As getting the 'description' and the 'price' share most of the logic, it looks ok to write a single function that does the job. Thanks! Gerardo