bug w/ cursors and savepoints

Поиск
Список
Период
Сортировка
От Neil Conway
Тема bug w/ cursors and savepoints
Дата
Msg-id 1106625290.1780.101.camel@localhost.localdomain
обсуждение исходный текст
Ответы Re: bug w/ cursors and savepoints  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-hackers
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




В списке pgsql-hackers по дате отправления:

Предыдущее
От: David Fetter
Дата:
Сообщение: Re: Shortcut for defining triggers
Следующее
От: "Jim C. Nasby"
Дата:
Сообщение: Re: userlock changes for 8.1/8.2