Re: Weird behavior with "sensitive" cursors.

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: Weird behavior with "sensitive" cursors.
Дата
Msg-id 8262.1254349766@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: Weird behavior with "sensitive" cursors.  (Alvaro Herrera <alvherre@commandprompt.com>)
Ответы Re: Weird behavior with "sensitive" cursors.  (Alvaro Herrera <alvherre@commandprompt.com>)
Список pgsql-general
Alvaro Herrera <alvherre@commandprompt.com> writes:
> Interesting.  If I create an non-unique index on the table before
> declaring the cursor, FETCH throws an error:

> alvherre=# fetch all from c1;
> ERROR:  attempted to lock invisible tuple

I get that in 8.4 and HEAD even without any index, just trying the given
case.  It looks to me like this is a bug in the new snapshot management.
The cursor is using CurrentSnapshot directly --- it does not have a
private copy --- and therefore when CommandCounterIncrement happens
it affects what the cursor can "see".  The cursor should not be able
to "see" any tuples created after it was created.

I think we need to ensure that when a cursor is created, it obtains a
private copy of the current snapshot ... but I'm not sure where that
ought to happen.  Thoughts?

            regards, tom lane

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

Предыдущее
От: Adrian Klaver
Дата:
Сообщение: Re: I can not drop a user/role because an object depent on it.
Следующее
От: Alvaro Herrera
Дата:
Сообщение: Re: Weird behavior with "sensitive" cursors.