| 1 |
# Test locking of a tuple with a committed key-update. In this case, |
| 2 |
# the update conflicts with the lock, so failures are expected, except |
| 3 |
# in READ COMMITTED isolation mode. |
| 4 |
# |
| 5 |
# Some of the permutations are commented out that work fine in the |
| 6 |
# lock-committed-update test, because in this case the update blocks. |
| 7 |
|
| 8 |
setup |
| 9 |
{ |
| 10 |
DROP TABLE IF EXISTS lcku_table; |
| 11 |
CREATE TABLE lcku_table (id INTEGER, value TEXT, PRIMARY KEY (id) INCLUDE (value)); |
| 12 |
INSERT INTO lcku_table VALUES (1, 'one'); |
| 13 |
INSERT INTO lcku_table VALUES (3, 'two'); |
| 14 |
} |
| 15 |
|
| 16 |
teardown |
| 17 |
{ |
| 18 |
DROP TABLE lcku_table; |
| 19 |
} |
| 20 |
|
| 21 |
session s1 |
| 22 |
step s1b { BEGIN; } |
| 23 |
step s1l { SELECT pg_advisory_lock(578902068); } |
| 24 |
step s1u { UPDATE lcku_table SET id = 2 WHERE id = 3; } |
| 25 |
step s1hint { SELECT * FROM lcku_table; } |
| 26 |
step s1ul { SELECT pg_advisory_unlock(578902068); } |
| 27 |
step s1c { COMMIT; } |
| 28 |
teardown { SELECT pg_advisory_unlock_all(); } |
| 29 |
|
| 30 |
session s2 |
| 31 |
step s2b1 { BEGIN ISOLATION LEVEL READ COMMITTED; } |
| 32 |
step s2b2 { BEGIN ISOLATION LEVEL REPEATABLE READ; } |
| 33 |
step s2b3 { BEGIN ISOLATION LEVEL SERIALIZABLE; } |
| 34 |
step s2l { SELECT * FROM lcku_table WHERE pg_advisory_lock(578902068) IS NOT NULL FOR KEY SHARE; } |
| 35 |
step s2c { COMMIT; } |
| 36 |
teardown { SELECT pg_advisory_unlock_all(); } |
| 37 |
|
| 38 |
permutation s1b s2b1 s1l s2l s1u s1c s1ul s2c |
| 39 |
permutation s1b s2b1 s1l s1u s2l s1c s1ul s2c |
| 40 |
#permutation s1b s2b1 s1l s2l s1ul s1u s1c s2c |
| 41 |
permutation s1b s2b1 s1l s1u s1ul s2l s1c s2c |
| 42 |
|
| 43 |
permutation s1b s2b1 s1l s2l s1u s1c s1hint s1ul s2c |
| 44 |
permutation s1b s2b1 s1l s1u s2l s1c s1hint s1ul s2c |
| 45 |
#permutation s1b s2b1 s1l s2l s1ul s1u s1c s1hint s2c |
| 46 |
permutation s1b s2b1 s1l s1u s1ul s2l s1c s1hint s2c |
| 47 |
|
| 48 |
permutation s1b s2b2 s1l s2l s1u s1c s1ul s2c |
| 49 |
permutation s1b s2b2 s1l s1u s2l s1c s1ul s2c |
| 50 |
#permutation s1b s2b2 s1l s2l s1ul s1u s1c s2c |
| 51 |
permutation s1b s2b2 s1l s1u s1ul s2l s1c s2c |
| 52 |
|
| 53 |
permutation s1b s2b2 s1l s2l s1u s1c s1hint s1ul s2c |
| 54 |
permutation s1b s2b2 s1l s1u s2l s1c s1hint s1ul s2c |
| 55 |
#permutation s1b s2b2 s1l s2l s1ul s1u s1c s1hint s2c |
| 56 |
permutation s1b s2b2 s1l s1u s1ul s2l s1c s1hint s2c |
| 57 |
|
| 58 |
permutation s1b s2b3 s1l s2l s1u s1c s1ul s2c |
| 59 |
permutation s1b s2b3 s1l s1u s2l s1c s1ul s2c |
| 60 |
#permutation s1b s2b3 s1l s2l s1ul s1u s1c s2c |
| 61 |
permutation s1b s2b3 s1l s1u s1ul s2l s1c s2c |
| 62 |
|
| 63 |
permutation s1b s2b3 s1l s2l s1u s1c s1hint s1ul s2c |
| 64 |
permutation s1b s2b3 s1l s1u s2l s1c s1hint s1ul s2c |
| 65 |
#permutation s1b s2b3 s1l s2l s1ul s1u s1c s1hint s2c |
| 66 |
permutation s1b s2b3 s1l s1u s1ul s2l s1c s1hint s2c |