Re: Python setof patch

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: Python setof patch
Дата
Msg-id 24079.1120583665@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: Python setof patch  (Michael Fuhr <mike@fuhr.org>)
Ответы Re: Python setof patch
Список pgsql-patches
Michael Fuhr <mike@fuhr.org> writes:
>> This patch allows the PL/Python module to do (SRF) functions.

> Does this patch work?

Aside from minor problems like being broken and undocumented, there is a
more serious question here: is this even the functionality we want?

The proposed test case is:

CREATE or replace FUNCTION test_setof() returns setof text
    AS
'if GD.has_key("calls"):
    GD["calls"] = GD["calls"] + 1
    if GD["calls"] > 2:
        del GD["calls"]
        return plpy.EndOfSet
else:
    GD["calls"] = 1
return str(GD["calls"])'
    LANGUAGE plpythonu;

which is essentially exposing the old value-per-call SRF implementation
to the Python programmer.  Do we really want to do that?  plperl and
plpgsql have not taken that tack.  One reason this doesn't seem a
particularly great idea is that the above example would likely fail
if invoked twice in one query, due to it using only one global state
variable for both invocations.

            regards, tom lane

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

Предыдущее
От: Alvaro Herrera
Дата:
Сообщение: Re: Autovacuum integration patch
Следующее
От: Michael Fuhr
Дата:
Сообщение: Re: Python setof patch