Re: revised patch for PL/PgSQL table functions

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: revised patch for PL/PgSQL table functions
Дата
Msg-id 15381.1030667962@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: revised patch for PL/PgSQL table functions  (Neil Conway <neilc@samurai.com>)
Ответы Re: revised patch for PL/PgSQL table functions  (Neil Conway <neilc@samurai.com>)
Список pgsql-patches
Neil Conway <neilc@samurai.com> writes:
> I've attached a revised patch: rediffed against CVS HEAD, changed the
> RETURN NEXT parsing as suggested by Tom above, and made some more
> minor cleanups to PL/PgSQL code.

I've applied this patch with some editorializing --- mainly, I didn't
like hardwiring the functionality to plpgsql, so I extended the
ReturnSetInfo interface instead.  Now anybody can use the
return-a-tuplestore mechanism for SRFs.

There is a rather nasty bug left (Sir Mordred would likely call it a
DOS possibility ;-)) --- RETURN NEXT doesn't seem to be checking that
the row or record variable it is given actually matches the declared
return type of the plpgsql function.  You could probably cause problems
by passing the wrong thing, or even more subtly by passing the right
thing on the first RETURN NEXT and then wrong things later.  This
needs to be tightened up.

Another thing to think about is extending plpgsql to support functions
declared to return RECORD, ie, the first value actually passed to RETURN
or RETURN NEXT determines the result tuple type.  I won't cry if we
don't get that feature into 7.3, though.

            regards, tom lane

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

Предыдущее
От: Joe Conway
Дата:
Сообщение: Re: SRF memory mgmt patch (was [HACKERS] Concern about memory management
Следующее
От: Tom Lane
Дата:
Сообщение: Re: [HACKERS] Proposed GUC Variable