summaryrefslogtreecommitdiffstats
path: root/src/test/isolation/specs/prepared-transactions-cic.spec
blob: 626b1b686a26e805a38512fbdca53a3204f2dbf0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
# This test verifies that CREATE INDEX CONCURRENTLY interacts with prepared
# transactions correctly.
setup
{
    CREATE TABLE cic_test (a int);
}

teardown
{
    DROP TABLE cic_test;
}


# Sessions for CREATE INDEX CONCURRENTLY test
session s1
step w1 { BEGIN; INSERT INTO cic_test VALUES (1); }
step p1 { PREPARE TRANSACTION 's1'; }
step c1 { COMMIT PREPARED 's1'; }

session s2
# The isolation tester never recognizes that a lock of s1 blocks s2, because a
# prepared transaction's locks have no pid associated.  While there's a slight
# chance of timeout while waiting for an autovacuum-held lock, that wouldn't
# change the output.  Hence, no timeout is too short.
setup { SET lock_timeout = 10; }
step cic2
{
    CREATE INDEX CONCURRENTLY on cic_test(a);
}
step r2
{
    SET enable_seqscan to off;
    SET enable_bitmapscan to off;
    SELECT * FROM cic_test WHERE a = 1;
}

permutation  w1 p1 cic2 c1 r2