pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Gerardo Herzig <gherzig@fmed.uba.ar>
To: postgres list <pgsql-sql@postgresql.org>
Subject: its posible to use a 2 column returning function as a subquery?
Date: Fri, 11 Sep 2009 17:16:30 -0300
Message-ID: <4AAAB01E.8070009@fmed.uba.ar> (raw)

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



view thread (2+ messages)  latest in thread

Message-ID: <4AAAB01E.8070009@fmed.uba.ar>
Permalink:  ../4AAAB01E.8070009@fmed.uba.ar/
Also on:    postgresql.org/message-id/4AAAB01E.8070009@fmed.uba.ar

 · 

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: gherzig@fmed.uba.ar
  Subject: Re: its posible to use a 2 column returning function as a subquery?
  In-Reply-To: <4AAAB01E.8070009@fmed.uba.ar>

* 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