Re: BUG #17141: SELECT LIMIT WITH TIES FOR UPDATE SKIP LOCKED returns wrong number of rows

Поиск
Список
Период
Сортировка
Искать
От
Alvaro Herrera
Тема
Re: BUG #17141: SELECT LIMIT WITH TIES FOR UPDATE SKIP LOCKED returns wrong number of rows
Дата
Msg-id
202110022205.jwz6b5bdyja5@alvherre.pgsql
Ответ на
Список
Дерево обсуждения
BUG #17141: SELECT LIMIT WITH TIES FOR UPDATE SKIP LOCKED returns wrong number of rows PG Bug reporting form <noreply@postgresql.org>
Re: BUG #17141: SELECT LIMIT WITH TIES FOR UPDATE SKIP LOCKED returns wrong number of rows Alvaro Herrera <alvherre@alvh.no-ip.org>
Re: BUG #17141: SELECT LIMIT WITH TIES FOR UPDATE SKIP LOCKED returns wrong number of rows David Christensen <david.christensen@crunchydata.com>
Re: BUG #17141: SELECT LIMIT WITH TIES FOR UPDATE SKIP LOCKED returns wrong number of rows Emil Iggland <emil@iggland.com>
Re: BUG #17141: SELECT LIMIT WITH TIES FOR UPDATE SKIP LOCKED returns wrong number of rows Alvaro Herrera <alvherre@alvh.no-ip.org>
Re: BUG #17141: SELECT LIMIT WITH TIES FOR UPDATE SKIP LOCKED returns wrong number of rows Tom Lane <tgl@sss.pgh.pa.us>
Re: BUG #17141: SELECT LIMIT WITH TIES FOR UPDATE SKIP LOCKED returns wrong number of rows Emil Iggland <emil@iggland.com>
Re: BUG #17141: SELECT LIMIT WITH TIES FOR UPDATE SKIP LOCKED returns wrong number of rows David Christensen <david.christensen@crunchydata.com>
Re: BUG #17141: SELECT LIMIT WITH TIES FOR UPDATE SKIP LOCKED returns wrong number of rows Emil Iggland <emil@iggland.com>
Re: BUG #17141: SELECT LIMIT WITH TIES FOR UPDATE SKIP LOCKED returns wrong number of rows Emil Iggland <emil@iggland.com>
Re: BUG #17141: SELECT LIMIT WITH TIES FOR UPDATE SKIP LOCKED returns wrong number of rows Emil Iggland <emil@iggland.com>
On 2021-Aug-25, Emil Iggland wrote:

> I see a lot of thought being put into how this issue can be worked
> around, but very little discussion on if this behaviour is correct or
> not. Without having thought about it much deeper, this seems to only be
> a problem with the "WITH TIES" clause which provokes this extra row
> being locked. Perhaps that is where the problem should be attacked.

The problem is that when the WITH TIES clause is added, we need to read
one extra row after the one that reaches the LIMIT count, in order to
verify whether it (the next one) should be included due to a tie.  With
the executor structure that we currently have, there is no way to read
that row and not lock it.  So a good fix would be to separate the act of
locking the row from the act of reading it.

-- 
Álvaro Herrera           39°49'30"S 73°17'W  —  https://www.EnterpriseDB.com/


В списке pgsql-bugs по дате отправления
От: Peter Geoghegan
Дата:
От: Tom Lane
Дата:
FAQ