Re: Update with subselect sometimes returns wrong result

Поиск
Список
Период
Сортировка
От Alvaro Herrera
Тема Re: Update with subselect sometimes returns wrong result
Дата
Msg-id 20131219005808.GI11006@eldon.alvh.no-ip.org
обсуждение исходный текст
Ответ на Re: Update with subselect sometimes returns wrong result  (Andres Freund <andres@2ndquadrant.com>)
Ответы Re: Update with subselect sometimes returns wrong result  (Alvaro Herrera <alvherre@2ndquadrant.com>)
Список pgsql-bugs
Andres Freund escribió:
> On 2013-12-18 19:13:43 -0300, Alvaro Herrera wrote:
> > I'm not sure about the added assert that the tuple cannot possibly be
> > locked.  I fear cursors provide strange ways to access at tuples.
>
> I don't see how, the EPQ machinery should have ensured we're looking at
> the most recent version. Also, pretty fundamentally, we have to be the
> only locker, otherwise the optimization wouldn't be applicable in this
> way.

EPQ works funny with cursors in the WHERE CURRENT OF stuff; the fact
that it behaves differently in FOR UPDATE case than when there's no
locking clause makes this whole thing pretty misterious.

Anyway I think this whole optimization can be formulated more clearly if
we separate the case into its own block by checking
XidIsCurrentTransaction instead of cramming it into the XidIsInProgress
case as the original is doing; see attached.

Any ideas on possible tests for this stuff?  Nothing comes to mind that
doesn't involve pageinspect ...

--
Álvaro Herrera                http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Training & Services

Вложения

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

Предыдущее
От: Andres Freund
Дата:
Сообщение: Re: Update with subselect sometimes returns wrong result
Следующее
От: katsumata.tomonari@po.ntts.co.jp
Дата:
Сообщение: BUG #8686: Standby could not restart.