Re: How return a row from a function so it is recognized as such by caller?

From: Merlin Moncure <mmoncure(at)gmail(dot)com>
To: Kenneth Tilton <ktilton(at)mcna(dot)net>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: How return a row from a function so it is recognized as such by caller?
Date: 2012-03-28 18:36:35
Message-ID: CAHyXU0zLOC7LFEuE+s9Gew_hPzGsbQ3tR1ouPKOQZx+vMqED5Q@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Wed, Mar 28, 2012 at 1:11 PM, Kenneth Tilton <ktilton(at)mcna(dot)net> wrote:
>
>
> On Wed, Mar 28, 2012 at 1:52 PM, Kenneth Tilton <ktilton(at)mcna(dot)net> wrote:
>>
>> First, apologies for being too succinct. I should have reiterated the
>> message subject to provide the context: I am just trying to return a row
>> from a function and have the caller understand it. Oh, and I am a nooby so
>> it is probably something daft.
>>
>> Second, I just tried returning the row as an out variable and got the same
>> result. I'll try messing with the caller...
>
>
> OK, this works in re getting the row back:
>
>     bpa := now_plus_30(NEW);
>
> But I need to execute an arbitrary function passed in as text, and I now
> realize EXECUTE is for SQL and I am trying to use it to "eval" plpgsql and
> those are different animals.
>
> I see no plpgsql equivalent of EXECUTE, ie where I can build up a plpgsql
> statement like this:
>
>    execute 'bpa := ' || function_name || '($1)' using NEW into bpa;

If all you are doing is assignment into a variable, you can use
EXECUTE...INTO...USING. That should work.

merlin

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Kenneth Tilton 2012-03-28 19:08:21 Re: How return a row from a function so it is recognized as such by caller?
Previous Message Scott Marlowe 2012-03-28 18:20:36 Re: Limit the normal user to see system catalog or not??? And create privilege???