Debian Codegraph @

src/test/isolation/specs/alter-table-4.spec

raw
1 # ALTER TABLE - Add and remove inheritance with concurrent reads
2
3 setup
4 {
5 CREATE TABLE p (a integer);
6 INSERT INTO p VALUES(1);
7 CREATE TABLE c1 () INHERITS (p);
8 INSERT INTO c1 VALUES(10);
9 CREATE TABLE c2 (a integer);
10 INSERT INTO c2 VALUES(100);
11 }
12
13 teardown
14 {
15 DROP TABLE IF EXISTS c1, c2, p;
16 }
17
18 session s1
19 step s1b { BEGIN; }
20 step s1delc1 { ALTER TABLE c1 NO INHERIT p; }
21 step s1modc1a { ALTER TABLE c1 ALTER COLUMN a TYPE float; }
22 step s1addc2 { ALTER TABLE c2 INHERIT p; }
23 step s1dropc1 { DROP TABLE c1; }
24 step s1c { COMMIT; }
25
26 session s2
27 step s2sel { SELECT SUM(a) FROM p; }
28
29 # NO INHERIT will not be visible to concurrent select,
30 # since we identify children before locking them
31 permutation s1b s1delc1 s2sel s1c s2sel
32 # adding inheritance likewise is not seen if s1 commits after s2 locks p
33 permutation s1b s1delc1 s1addc2 s2sel s1c s2sel
34 # but we do cope with DROP on a child table
35 permutation s1b s1dropc1 s2sel s1c s2sel
36 # this case currently results in an error; doesn't seem worth preventing
37 permutation s1b s1delc1 s1modc1a s2sel s1c s2sel