aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBruce Momjian <bruce@momjian.us>2005-07-05 18:15:51 +0000
committerBruce Momjian <bruce@momjian.us>2005-07-05 18:15:51 +0000
commit2d6c375c5f34948dc32221c3075265d73b561ee8 (patch)
tree89455c88fa2474af1aaee6dfebcbb49c5fe0f8ed
parent576ac4b8c9337cd5b0e12c2f827dd99c5ee6f25b (diff)
downloadpostgresql-2d6c375c5f34948dc32221c3075265d73b561ee8.tar.gz
postgresql-2d6c375c5f34948dc32221c3075265d73b561ee8.zip
Back out patch. This should be done like other server-side languages.
--------------------------------------------------------------------------- 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
-rw-r--r--src/pl/plpython/plpython.c17
-rw-r--r--src/pl/plpython/sql/plpython_setof.sql12
2 files changed, 1 insertions, 28 deletions
diff --git a/src/pl/plpython/plpython.c b/src/pl/plpython/plpython.c
index 52ad1775829..3d7230ffca9 100644
--- a/src/pl/plpython/plpython.c
+++ b/src/pl/plpython/plpython.c
@@ -29,7 +29,7 @@
* MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/pl/plpython/plpython.c,v 1.63 2005/07/04 18:59:42 momjian Exp $
+ * $PostgreSQL: pgsql/src/pl/plpython/plpython.c,v 1.64 2005/07/05 18:15:51 momjian Exp $
*
*********************************************************************
*/
@@ -286,9 +286,6 @@ static PyObject *PLy_exc_error = NULL;
static PyObject *PLy_exc_fatal = NULL;
static PyObject *PLy_exc_spi_error = NULL;
-/* End-of-set Indication */
-static PyObject *PLy_endofset = NULL;
-
/* some globals for the python module
*/
static char PLy_plan_doc[] = {
@@ -773,16 +770,6 @@ PLy_function_handler(FunctionCallInfo fcinfo, PLyProcedure * proc)
fcinfo->isnull = true;
rv = (Datum) NULL;
}
- /* test for end-of-set condition */
- else if (fcinfo->flinfo->fn_retset && plrv == PLy_endofset)
- {
- ReturnSetInfo *rsi;
-
- fcinfo->isnull = true;
- rv = (Datum)NULL;
- rsi = (ReturnSetInfo *)fcinfo->resultinfo;
- rsi->isDone = ExprEndResult;
- }
else
{
fcinfo->isnull = false;
@@ -2330,11 +2317,9 @@ PLy_init_plpy(void)
PLy_exc_error = PyErr_NewException("plpy.Error", NULL, NULL);
PLy_exc_fatal = PyErr_NewException("plpy.Fatal", NULL, NULL);
PLy_exc_spi_error = PyErr_NewException("plpy.SPIError", NULL, NULL);
- PLy_endofset = PyErr_NewException("plpy.EndOfSet",NULL,NULL);
PyDict_SetItemString(plpy_dict, "Error", PLy_exc_error);
PyDict_SetItemString(plpy_dict, "Fatal", PLy_exc_fatal);
PyDict_SetItemString(plpy_dict, "SPIError", PLy_exc_spi_error);
- PyDict_SetItemString(plpy_dict, "EndOfSet", PLy_endofset);
/*
* initialize main module, and add plpy
diff --git a/src/pl/plpython/sql/plpython_setof.sql b/src/pl/plpython/sql/plpython_setof.sql
deleted file mode 100644
index 6e157886728..00000000000
--- a/src/pl/plpython/sql/plpython_setof.sql
+++ /dev/null
@@ -1,12 +0,0 @@
-
-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;