Re: How does one return rows from plpgsql functions?

From: Ryan Kirkpatrick <pgsql(at)rkirkpat(dot)net>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: How does one return rows from plpgsql functions?
Date: 2002-01-21 15:02:46
Message-ID: Pine.LNX.4.21.0201210758230.24200-100000@magellan.rkirkpat.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Sat, 19 Jan 2002, Tom Lane wrote:

> Ryan Kirkpatrick <pgsql(at)rkirkpat(dot)net> writes:
> > And "SELECT id(update_get(1));" rewards me with a backend
> > crash. :(
>
> Works okay for me in current sources. Time to update ...

Okay, once I updated to 7.2b5, that select statement started
working just fine for me. :)
Though I have hit another problem, if I want to display multiple
fields from the returned row, the function executes again for each
field. I.e. 'SELECT id(update_get(1), fielda(update_get(1), ...' will
result in both the values for id and fielda being displayed, but will
execute update_get() twice. This is not only inefficient, but also
undesireable (esp if update_get() modified something that was only to be
modified once for a single row reterival).
So, how do I get back and access the entire row returned from a
function without calling it multiple times? Or is that even possible?
Thanks.

---------------------------------------------------------------------------
| "For to me to live is Christ, and to die is gain." |
| --- Philippians 1:21 (KJV) |
---------------------------------------------------------------------------
| Ryan Kirkpatrick | Boulder, Colorado | http://www.rkirkpat.net/ |
---------------------------------------------------------------------------

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Bruce Momjian 2002-01-21 15:06:36 Re: [HACKERS] PostgreSQL Licence: GNU/GPL
Previous Message Bruce Momjian 2002-01-21 15:02:45 Re: [HACKERS] PostgreSQL Licence: GNU/GPL