Daniel Schuchardt <[EMAIL PROTECTED]> writes: > now I get > ERROR: buffer XYZ is not owned by resource owner TopTransaction
Yeah, I ran into that earlier today while trying to reproduce your problem. It's fixed by this pending patch. I didn't see any freeze-up of the system after running out of lock memory, though. It seemed to release the locks just fine. *** src/pl/plpgsql/src/pl_exec.c.orig Sun Aug 29 22:58:09 2004 --- src/pl/plpgsql/src/pl_exec.c Sun Sep 12 17:04:30 2004 *************** *** 897,902 **** --- 897,903 ---- * sub-transaction */ MemoryContext oldcontext = CurrentMemoryContext; + ResourceOwner oldowner = CurrentResourceOwner; volatile bool caught = false; int xrc; *************** *** 907,918 **** BeginInternalSubTransaction(NULL); /* Want to run statements inside function's memory context */ MemoryContextSwitchTo(oldcontext); if ((xrc = SPI_connect()) != SPI_OK_CONNECT) elog(ERROR, "SPI_connect failed: %s", SPI_result_code_string(xrc)); PG_TRY(); ! rc = exec_stmts(estate, block->body); PG_CATCH(); { ErrorData *edata; --- 908,922 ---- BeginInternalSubTransaction(NULL); /* Want to run statements inside function's memory context */ MemoryContextSwitchTo(oldcontext); + if ((xrc = SPI_connect()) != SPI_OK_CONNECT) elog(ERROR, "SPI_connect failed: %s", SPI_result_code_string(xrc)); PG_TRY(); ! { ! rc = exec_stmts(estate, block->body); ! } PG_CATCH(); { ErrorData *edata; *************** *** 927,932 **** --- 931,937 ---- /* Abort the inner transaction (and inner SPI connection) */ RollbackAndReleaseCurrentSubTransaction(); MemoryContextSwitchTo(oldcontext); + CurrentResourceOwner = oldowner; SPI_pop(); *************** *** 958,965 **** --- 963,973 ---- if ((xrc = SPI_finish()) != SPI_OK_FINISH) elog(ERROR, "SPI_finish failed: %s", SPI_result_code_string(xrc)); + ReleaseCurrentSubTransaction(); MemoryContextSwitchTo(oldcontext); + CurrentResourceOwner = oldowner; + SPI_pop(); } } regards, tom lane ---------------------------(end of broadcast)--------------------------- TIP 6: Have you searched our list archives? http://archives.postgresql.org