pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Gerardo Herzig <gherzig@fmed.uba.ar>
Cc: postgres list <pgsql-sql@postgresql.org>
Subject: Re: its posible to use a 2 column returning function as a subquery?
Date: Fri, 11 Sep 2009 17:44:54 -0400
Message-ID: <11732.1252705494@sss.pgh.pa.us> (raw)
In-Reply-To: <4AAAB01E.8070009@fmed.uba.ar>
References: <4AAAB01E.8070009@fmed.uba.ar>

Gerardo Herzig <gherzig@fmed.uba.ar> 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



view thread (2+ messages)

Message-ID: <11732.1252705494@sss.pgh.pa.us>
Permalink:  ../11732.1252705494@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/11732.1252705494@sss.pgh.pa.us

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: tgl@sss.pgh.pa.us, gherzig@fmed.uba.ar
  Subject: Re: its posible to use a 2 column returning function as a subquery?
  In-Reply-To: <11732.1252705494@sss.pgh.pa.us>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox