Someone at Fujitsu pointed out the following bug in 8.0: begin; savepoint x; create table abc (a int); insert into abc values (5); declare foo cursor for select * from abc; rollback to x; fetch from foo; -- hits an Assert() commit;
The stacktrace is: #2 0x0826367b in ExceptionalCondition (conditionName=0x8316544 "!(((bool)((relation)->rd_refcnt == 0)))", errorType=0x8316004 "FailedAssertion", fileName=0x8315f08 "/home/neilc/pgsql/src/backend/utils/cache/relcache.c", lineNumber=2118) at /home/neilc/pgsql/src/backend/utils/error/assert.c:51 #3 0x0825cec0 in AtEOSubXact_RelationCache (isCommit=0 '\0', mySubid=2, parentSubid=1) at /home/neilc/pgsql/src/backend/utils/cache/relcache.c:2118 #4 0x080ade30 in AbortSubTransaction () at /home/neilc/pgsql/src/backend/access/transam/xact.c:3407 #5 0x080ac404 in CommitTransactionCommand () at /home/neilc/pgsql/src/backend/access/transam/xact.c:1982 #6 0x081de4ba in finish_xact_command () at /home/neilc/pgsql/src/backend/tcop/postgres.c:1843 #7 0x081dd102 in exec_simple_query (query_string=0x83b6ad4 "rollback to x;") at /home/neilc/pgsql/src/backend/tcop/postgres.c:950 So what's happening is that the cursor still holds a reference to the newly-created table, so we can't just blow it away. I don't know the subtransaction code too well, so I'm not sure of the right fix. Comments? -Neil ---------------------------(end of broadcast)--------------------------- TIP 6: Have you searched our list archives? http://archives.postgresql.org