| 1 |
# This test verifies that CREATE INDEX CONCURRENTLY interacts with prepared |
| 2 |
# transactions correctly. |
| 3 |
setup |
| 4 |
{ |
| 5 |
CREATE TABLE cic_test (a int); |
| 6 |
} |
| 7 |
|
| 8 |
teardown |
| 9 |
{ |
| 10 |
DROP TABLE cic_test; |
| 11 |
} |
| 12 |
|
| 13 |
|
| 14 |
# Sessions for CREATE INDEX CONCURRENTLY test |
| 15 |
session s1 |
| 16 |
step w1 { BEGIN; INSERT INTO cic_test VALUES (1); } |
| 17 |
step p1 { PREPARE TRANSACTION 's1'; } |
| 18 |
step c1 { COMMIT PREPARED 's1'; } |
| 19 |
|
| 20 |
session s2 |
| 21 |
# The isolation tester never recognizes that a lock of s1 blocks s2, because a |
| 22 |
# prepared transaction's locks have no pid associated. While there's a slight |
| 23 |
# chance of timeout while waiting for an autovacuum-held lock, that wouldn't |
| 24 |
# change the output. Hence, no timeout is too short. |
| 25 |
setup { SET lock_timeout = 10; } |
| 26 |
step cic2 |
| 27 |
{ |
| 28 |
CREATE INDEX CONCURRENTLY on cic_test(a); |
| 29 |
} |
| 30 |
step r2 |
| 31 |
{ |
| 32 |
SET enable_seqscan to off; |
| 33 |
SET enable_bitmapscan to off; |
| 34 |
SELECT * FROM cic_test WHERE a = 1; |
| 35 |
} |
| 36 |
|
| 37 |
permutation w1 p1 cic2 c1 r2 |