|
29 | 29 | * MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
|
30 | 30 | *
|
31 | 31 | * IDENTIFICATION
|
32 |
| - * $PostgreSQL: pgsql/src/pl/plpython/plpython.c,v 1.62 2005/05/06 17:24:55 tgl Exp $ |
| 32 | + * $PostgreSQL: pgsql/src/pl/plpython/plpython.c,v 1.63 2005/07/04 18:59:42 momjian Exp $ |
33 | 33 | *
|
34 | 34 | *********************************************************************
|
35 | 35 | */
|
@@ -286,6 +286,9 @@ static PyObject *PLy_exc_error = NULL;
|
286 | 286 | static PyObject *PLy_exc_fatal = NULL;
|
287 | 287 | static PyObject *PLy_exc_spi_error = NULL;
|
288 | 288 |
|
| 289 | +/* End-of-set Indication */ |
| 290 | +static PyObject *PLy_endofset = NULL; |
| 291 | + |
289 | 292 | /* some globals for the python module
|
290 | 293 | */
|
291 | 294 | static char PLy_plan_doc[] = {
|
@@ -770,6 +773,16 @@ PLy_function_handler(FunctionCallInfo fcinfo, PLyProcedure * proc)
|
770 | 773 | fcinfo->isnull = true;
|
771 | 774 | rv = (Datum) NULL;
|
772 | 775 | }
|
| 776 | + /* test for end-of-set condition */ |
| 777 | + else if (fcinfo->flinfo->fn_retset && plrv == PLy_endofset) |
| 778 | + { |
| 779 | + ReturnSetInfo *rsi; |
| 780 | + |
| 781 | + fcinfo->isnull = true; |
| 782 | + rv = (Datum)NULL; |
| 783 | + rsi = (ReturnSetInfo *)fcinfo->resultinfo; |
| 784 | + rsi->isDone = ExprEndResult; |
| 785 | + } |
773 | 786 | else
|
774 | 787 | {
|
775 | 788 | fcinfo->isnull = false;
|
@@ -2317,9 +2330,11 @@ PLy_init_plpy(void)
|
2317 | 2330 | PLy_exc_error = PyErr_NewException("plpy.Error", NULL, NULL);
|
2318 | 2331 | PLy_exc_fatal = PyErr_NewException("plpy.Fatal", NULL, NULL);
|
2319 | 2332 | PLy_exc_spi_error = PyErr_NewException("plpy.SPIError", NULL, NULL);
|
| 2333 | + PLy_endofset = PyErr_NewException("plpy.EndOfSet",NULL,NULL); |
2320 | 2334 | PyDict_SetItemString(plpy_dict, "Error", PLy_exc_error);
|
2321 | 2335 | PyDict_SetItemString(plpy_dict, "Fatal", PLy_exc_fatal);
|
2322 | 2336 | PyDict_SetItemString(plpy_dict, "SPIError", PLy_exc_spi_error);
|
| 2337 | + PyDict_SetItemString(plpy_dict, "EndOfSet", PLy_endofset); |
2323 | 2338 |
|
2324 | 2339 | /*
|
2325 | 2340 | * initialize main module, and add plpy
|
|
0 commit comments