OK, patch backed out, new and regression file removed. ---------------------------------------------------------------------------
Andrew Dunstan wrote: > > > Michael Fuhr wrote: > > >On Tue, Jul 05, 2005 at 01:14:25PM -0400, Tom Lane wrote: > > > > > >>Aside from minor problems like being broken and undocumented, there is a > >>more serious question here: is this even the functionality we want? > >> > >> > > > >I'd rather see something akin to PL/pgSQL's RETURN NEXT or PL/Perl's > >return_next. > > > > > > > > Agreed. My rudimentary testing shows that plperl's shiny new return_next > functionality not only avoids memory blowup but has a 40% speed > improvement over the old 'return the lot at once' API. > > cheers > > andrew > > ---------------------------(end of broadcast)--------------------------- > TIP 7: don't forget to increase your free space map settings > -- Bruce Momjian | http://candle.pha.pa.us pgman@candle.pha.pa.us | (610) 359-1001 + If your life is a hard drive, | 13 Roberts Road + Christ can be your backup. | Newtown Square, Pennsylvania 19073
Index: src/pl/plpython/plpython.c =================================================================== RCS file: /cvsroot/pgsql/src/pl/plpython/plpython.c,v retrieving revision 1.62 retrieving revision 1.63 diff -c -r1.62 -r1.63 *** src/pl/plpython/plpython.c 6 May 2005 17:24:55 -0000 1.62 --- src/pl/plpython/plpython.c 4 Jul 2005 18:59:42 -0000 1.63 *************** *** 29,35 **** * MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. * * IDENTIFICATION ! * $PostgreSQL: pgsql/src/pl/plpython/plpython.c,v 1.62 2005/05/06 17:24:55 tgl Exp $ * ********************************************************************* */ --- 29,35 ---- * 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 $ * ********************************************************************* */ *************** *** 286,291 **** --- 286,294 ---- 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[] = { *************** *** 770,775 **** --- 773,788 ---- 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; *************** *** 2317,2325 **** --- 2330,2340 ---- 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
---------------------------(end of broadcast)--------------------------- TIP 8: explain analyze is your friend