Index: src/pl/plpython/feature.expected =================================================================== RCS file: /projects/cvsroot/pgsql-server/src/pl/plpython/feature.expected,v retrieving revision 1.4 diff -c -r1.4 feature.expected *** src/pl/plpython/feature.expected 2002/03/06 18:50:31 1.4 --- src/pl/plpython/feature.expected 2002/09/20 22:12:36 *************** *** 29,35 **** (1 row) SELECT import_fail(); ! WARNING: ('import socket failed -- untrusted dynamic module: _socket',) import_fail -------------------- failed as expected --- 29,35 ---- (1 row) SELECT import_fail(); ! NOTICE: ('import socket failed -- untrusted dynamic module: _socket',) import_fail -------------------- failed as expected Index: src/pl/plpython/plpython.c =================================================================== RCS file: /projects/cvsroot/pgsql-server/src/pl/plpython/plpython.c,v retrieving revision 1.22 diff -c -r1.22 plpython.c *** src/pl/plpython/plpython.c 2002/09/04 22:51:23 1.22 --- src/pl/plpython/plpython.c 2002/09/20 22:12:40 *************** *** 408,414 **** --- 408,416 ---- else PLy_restart_in_progress += 1; if (proc) + { Py_DECREF(proc->me); + } RERAISE_EXC(); } *************** *** 1841,1847 **** --- 1843,1856 ---- * * FIXME -- leaks saved plan on object destruction. can this be * avoided? + * I think so. A function prepares and then execp's a statement. + * When we come to deallocate the 'statement' object we obviously + * no long need the plan. Even if we did, without the object + * we're never going to be able to use it again. + * In the against arguments: SPI_saveplan has stuck this under + * the top context so there must be a reason for doing that. */ + pfree(ob->plan); } if (ob->types) PLy_free(ob->types); *************** *** 2374,2379 **** --- 2383,2390 ---- PyList_SetItem(result->rows, i, row); } PLy_typeinfo_dealloc(&args); + + SPI_freetuptable(tuptable); } RESTORE_EXC(); } Index: src/pl/plpython/plpython_schema.sql =================================================================== RCS file: /projects/cvsroot/pgsql-server/src/pl/plpython/plpython_schema.sql,v retrieving revision 1.1 diff -c -r1.1 plpython_schema.sql *** src/pl/plpython/plpython_schema.sql 2001/05/09 19:54:38 1.1 --- src/pl/plpython/plpython_schema.sql 2002/09/20 22:12:40 *************** *** 20,26 **** CREATE TABLE entry ( accession text not null primary key, ! eid serial, txid int2 not null references taxonomy(id) ) ; --- 20,26 ---- CREATE TABLE entry ( accession text not null primary key, ! eid serial unique, txid int2 not null references taxonomy(id) ) ; Index: src/pl/tcl/pltcl.c =================================================================== RCS file: /projects/cvsroot/pgsql-server/src/pl/tcl/pltcl.c,v retrieving revision 1.61 diff -c -r1.61 pltcl.c *** src/pl/tcl/pltcl.c 2002/09/04 20:31:48 1.61 --- src/pl/tcl/pltcl.c 2002/09/20 22:12:42 *************** *** 1648,1653 **** --- 1648,1654 ---- pltcl_set_tuple_values(interp, arrayname, 0, tuples[0], tupdesc); sprintf(buf, "%d", ntuples); Tcl_SetResult(interp, buf, TCL_VOLATILE); + SPI_freetuptable(SPI_tuptable); memcpy(&Warn_restart, &save_restart, sizeof(Warn_restart)); return TCL_OK; } *************** *** 1669,1683 **** --- 1670,1688 ---- continue; if (loop_rc == TCL_RETURN) { + SPI_freetuptable(SPI_tuptable); memcpy(&Warn_restart, &save_restart, sizeof(Warn_restart)); return TCL_RETURN; } if (loop_rc == TCL_BREAK) break; + SPI_freetuptable(SPI_tuptable); memcpy(&Warn_restart, &save_restart, sizeof(Warn_restart)); return TCL_ERROR; } + SPI_freetuptable(SPI_tuptable); + /************************************************************ * Finally return the number of tuples ************************************************************/ *************** *** 2208,2213 **** --- 2213,2219 ---- { if (ntuples > 0) pltcl_set_tuple_values(interp, arrayname, 0, tuples[0], tupdesc); + SPI_freetuptable(SPI_tuptable); memcpy(&Warn_restart, &save_restart, sizeof(Warn_restart)); sprintf(buf, "%d", ntuples); Tcl_SetResult(interp, buf, TCL_VOLATILE); *************** *** 2230,2243 **** --- 2236,2253 ---- continue; if (loop_rc == TCL_RETURN) { + SPI_freetuptable(SPI_tuptable); memcpy(&Warn_restart, &save_restart, sizeof(Warn_restart)); return TCL_RETURN; } if (loop_rc == TCL_BREAK) break; + SPI_freetuptable(SPI_tuptable); memcpy(&Warn_restart, &save_restart, sizeof(Warn_restart)); return TCL_ERROR; } + + SPI_freetuptable(SPI_tuptable); /************************************************************ * Finally return the number of tuples