Re: first cut at PL/PgSQL table functions

Поиск
Список
Период
Сортировка
От Joe Conway
Тема Re: first cut at PL/PgSQL table functions
Дата
Msg-id 3D626A8F.4040303@joeconway.com
обсуждение исходный текст
Ответ на first cut at PL/PgSQL table functions  (Neil Conway <neilc@samurai.com>)
Список pgsql-patches
Jan Wieck wrote:
> A PL/pgSQL function might (in the future) want to return a refcursor on
> one call, but use RETURN ... AND RESUME on another. So this has to be
> done for every SET.

How? They are going to be two different datatypes.


> My original idea was to make a tuplestore part of the cursor (Portal
> structure). This way the tuplestore access would be hidden behind the
> fetching and the caller doesn't have to care what the function really
> returns. Also it'd avoid the memory context problem, because the
> tuplestore would be part of the Portal memory context and go away when
> the cursor is closed.

I don't understand your concern. In the current implementation, table
functions really have very little to do with portals. That was why
pretty early on (7 May) Tom asked me to "s/portal/function/ throughout
the patch".

In any case, what Neil has proposed does hide the tuplestore behind the
fetching. The user only declares the tuple return type like they would
have to anyway. If you're referring to the functionmode being added to
the grammar, I think Tom has talked us out of that already ;-)

Joe


В списке pgsql-patches по дате отправления:

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: first cut at PL/PgSQL table functions
Следующее
От: Tom Lane
Дата:
Сообщение: Re: Correct regression tests