From: | David Christensen <david(at)endpoint(dot)com> |
---|---|
To: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Alvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org> |
Cc: | pgsql-bugs(at)lists(dot)postgresql(dot)org |
Subject: | Re: BUG #16676: SELECT ... FETCH FIRST ROW WITH TIES FOR UPDATE SKIP LOCKED locks rows it doesn't return |
Date: | 2020-10-21 19:12:29 |
Message-ID: | E75ECBBA-5902-4598-8F09-F36192E184EE@endpoint.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-bugs |
> On Oct 19, 2020, at 7:33 PM, David Christensen <david(at)endpoint(dot)com> wrote:
>
> Maybe splitting LockRows into two nodes, one for locking and one for emitting unlocked nodes then interleaving Limit in between? (Or only doing something along these lines for this admittedly narrow use case. )
This does appear to be quite a bit harder than originally hoped for on the surface; creating a node to “pass-thru” unlocked tuples without locking them would require building out some additional infrastructure that does not appear to be present in all AMs; something to allow a test for locks without actually calling table_tuple_lock() formally. Perhaps adding a param to indicate “test” only—not sure if something like similar to heapam's “test_lockmode_for_conflict()” is something we’d need to had. (Or even a new lock mode which doesn’t create RowMarks but skips any conflicting modes.)
That said, I think it might be worth trying to go down the road of “forbid this behavior”, particularly if a workaround is available. Perhaps looking into why Álvaro’s plan was generating the multiple LockRows nodes would be more fruitful and less likely to cause backpatching pain.
David
--
David Christensen
Senior Software and Database Engineer
End Point Corporation
david(at)endpoint(dot)com
785-727-1171
From | Date | Subject | |
---|---|---|---|
Next Message | Andrey Borodin | 2020-10-22 05:50:48 | Re: BUG #16329: Valgrind detects an invalid read when building a gist index with buffering |
Previous Message | David G. Johnston | 2020-10-21 15:23:31 | Re: BUG #16519: SET SESSION ROLE in plpgsql requires string literal. |