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

Поиск
Список
Период
Сортировка
От Merlin Moncure
Тема Re: How return a row from a function so it is recognized as such by caller?
Дата
Msg-id CAHyXU0zLOC7LFEuE+s9Gew_hPzGsbQ3tR1ouPKOQZx+vMqED5Q@mail.gmail.com
обсуждение исходный текст
Ответ на Re: How return a row from a function so it is recognized as such by caller?  (Kenneth Tilton <ktilton@mcna.net>)
Ответы Re: How return a row from a function so it is recognized as such by caller?  (Kenneth Tilton <ktilton@mcna.net>)
Список 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 по дате отправления:

Предыдущее
От: Scott Marlowe
Дата:
Сообщение: Re: Limit the normal user to see system catalog or not??? And create privilege???
Следующее
От: Kenneth Tilton
Дата:
Сообщение: Re: How return a row from a function so it is recognized as such by caller?