Re: How does one return rows from plpgsql functions? - Mailing list pgsql-general

From Ryan Kirkpatrick
Subject Re: How does one return rows from plpgsql functions?
Date
Msg-id Pine.LNX.4.21.0201210758230.24200-100000@magellan.rkirkpat.net
Whole thread Raw
In response to Re: How does one return rows from plpgsql functions?  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: How does one return rows from plpgsql functions?  (Tom Lane <tgl@sss.pgh.pa.us>)
Re: How does one return rows from plpgsql functions?  (Holger Krug <hkrug@rationalizer.com>)
List pgsql-general
On Sat, 19 Jan 2002, Tom Lane wrote:

> Ryan Kirkpatrick <pgsql@rkirkpat.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/   |
---------------------------------------------------------------------------


pgsql-general by date:

Previous
From: Vince Vielhaber
Date:
Subject: Re: [HACKERS] PostgreSQL Licence: GNU/GPL
Next
From: Bruce Momjian
Date:
Subject: Re: [HACKERS] PostgreSQL Licence: GNU/GPL