1
0
mirror of https://github.com/postgres/postgres.git synced 2025-10-19 15:49:24 +03:00

This patch allows the PL/Python module to do (SRF) functions.

The patch was taken from the CVS version.

I have modified the plpython.c file and have added a test sql script for
testing the functionality. It was actually the script that was in the
8.0.3 version but have since been removed.

In order to signal the end of a set, the called python function must
simply return plpy.EndOfSet and the set would be returned.

Gerrit van Dyk
This commit is contained in:
Bruce Momjian
2005-07-04 19:03:30 +00:00
parent 109f079be6
commit af8756713f
2 changed files with 28 additions and 1 deletions

View File

@@ -0,0 +1,12 @@
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;