Michael Fuhr <[EMAIL PROTECTED]> 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
'if GD.has_key("calls"):
        GD["calls"] = GD["calls"] + 1
        if GD["calls"] > 2:
                del GD["calls"]
                return plpy.EndOfSet
        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

---------------------------(end of broadcast)---------------------------
TIP 5: Have you checked our extensive FAQ?


Reply via email to