Re: How return a row from a function so it is recognized as such by caller? - Mailing list pgsql-general

From Merlin Moncure
Subject Re: How return a row from a function so it is recognized as such by caller?
Date
Msg-id CAHyXU0zLOC7LFEuE+s9Gew_hPzGsbQ3tR1ouPKOQZx+vMqED5Q@mail.gmail.com
Whole thread Raw
In response to Re: How return a row from a function so it is recognized as such by caller?  (Kenneth Tilton <ktilton@mcna.net>)
Responses Re: How return a row from a function so it is recognized as such by caller?  (Kenneth Tilton <ktilton@mcna.net>)
List pgsql-general
On Wed, Mar 28, 2012 at 1:11 PM, Kenneth Tilton <ktilton@mcna.net> wrote:
>
>
> On Wed, Mar 28, 2012 at 1:52 PM, Kenneth Tilton <ktilton@mcna.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

pgsql-general by date:

Previous
From: Scott Marlowe
Date:
Subject: Re: Limit the normal user to see system catalog or not??? And create privilege???
Next
From: Kenneth Tilton
Date:
Subject: Re: How return a row from a function so it is recognized as such by caller?