This is correct behavior with MVCC. Do a 'select * from x' in thread 2 and to
understand why. The select for update in thread 2 sees the data in table x as
it was prior to thread 1 committing, thus it won't see the row with a=2.
For further suggestions you'll have to explain what you are logic
Hi,
I hit a UPDATE/LOCK issue in my application and the result has surprised me
somewhat.
And for the repro, it boils down into this:
---
CREATE TABLE x (a int, b bool);
INSERT INTO x VALUES (1, TRUE);
COMMIT;
_THREAD 1_:
BEGIN;
UPDATE x SET b=FALSE;
INSERT INTO x VALUES (2, TRUE);