| 1 |
# Test locking of a tuple with a committed update. When the lock does not |
| 2 |
# conflict with the update, no blocking and no serializability errors should |
| 3 |
# occur. |
| 4 |
|
| 5 |
setup |
| 6 |
{ |
| 7 |
DROP TABLE IF EXISTS lcu_table; |
| 8 |
CREATE TABLE lcu_table (id INTEGER PRIMARY KEY, value TEXT); |
| 9 |
INSERT INTO lcu_table VALUES (1, 'one'); |
| 10 |
} |
| 11 |
|
| 12 |
teardown |
| 13 |
{ |
| 14 |
DROP TABLE lcu_table; |
| 15 |
} |
| 16 |
|
| 17 |
session s1 |
| 18 |
step s1b { BEGIN; } |
| 19 |
step s1l { SELECT pg_advisory_lock(380170116); } |
| 20 |
step s1u { UPDATE lcu_table SET value = 'two' WHERE id = 1; } |
| 21 |
step s1hint { SELECT * FROM lcu_table; } |
| 22 |
step s1ul { SELECT pg_advisory_unlock(380170116); } |
| 23 |
step s1c { COMMIT; } |
| 24 |
teardown { SELECT pg_advisory_unlock_all(); } |
| 25 |
|
| 26 |
session s2 |
| 27 |
step s2b1 { BEGIN ISOLATION LEVEL READ COMMITTED; } |
| 28 |
step s2b2 { BEGIN ISOLATION LEVEL REPEATABLE READ; } |
| 29 |
step s2b3 { BEGIN ISOLATION LEVEL SERIALIZABLE; } |
| 30 |
step s2l { SELECT * FROM lcu_table WHERE pg_advisory_lock(380170116) IS NOT NULL FOR KEY SHARE; } |
| 31 |
step s2c { COMMIT; } |
| 32 |
teardown { SELECT pg_advisory_unlock_all(); } |
| 33 |
|
| 34 |
permutation s1b s2b1 s1l s2l s1u s1c s1ul s2c |
| 35 |
permutation s1b s2b1 s1l s1u s2l s1c s1ul s2c |
| 36 |
permutation s1b s2b1 s1l s2l s1ul s1u s1c s2c |
| 37 |
permutation s1b s2b1 s1l s1u s1ul s2l s1c s2c |
| 38 |
|
| 39 |
permutation s1b s2b1 s1l s2l s1u s1c s1hint s1ul s2c |
| 40 |
permutation s1b s2b1 s1l s1u s2l s1c s1hint s1ul s2c |
| 41 |
permutation s1b s2b1 s1l s2l s1ul s1u s1c s1hint s2c |
| 42 |
permutation s1b s2b1 s1l s1u s1ul s2l s1c s1hint s2c |
| 43 |
|
| 44 |
permutation s1b s2b2 s1l s2l s1u s1c s1ul s2c |
| 45 |
permutation s1b s2b2 s1l s1u s2l s1c s1ul s2c |
| 46 |
permutation s1b s2b2 s1l s2l s1ul s1u s1c s2c |
| 47 |
permutation s1b s2b2 s1l s1u s1ul s2l s1c s2c |
| 48 |
|
| 49 |
permutation s1b s2b2 s1l s2l s1u s1c s1hint s1ul s2c |
| 50 |
permutation s1b s2b2 s1l s1u s2l s1c s1hint s1ul s2c |
| 51 |
permutation s1b s2b2 s1l s2l s1ul s1u s1c s1hint s2c |
| 52 |
permutation s1b s2b2 s1l s1u s1ul s2l s1c s1hint s2c |
| 53 |
|
| 54 |
permutation s1b s2b3 s1l s2l s1u s1c s1ul s2c |
| 55 |
permutation s1b s2b3 s1l s1u s2l s1c s1ul s2c |
| 56 |
permutation s1b s2b3 s1l s2l s1ul s1u s1c s2c |
| 57 |
permutation s1b s2b3 s1l s1u s1ul s2l s1c s2c |
| 58 |
|
| 59 |
permutation s1b s2b3 s1l s2l s1u s1c s1hint s1ul s2c |
| 60 |
permutation s1b s2b3 s1l s1u s2l s1c s1hint s1ul s2c |
| 61 |
permutation s1b s2b3 s1l s2l s1ul s1u s1c s1hint s2c |
| 62 |
permutation s1b s2b3 s1l s1u s1ul s2l s1c s1hint s2c |