1# Two IDs test
2#
3# Small, simple test showing read-only anomalies.
4#
5# There are only four permutations which must cause a serialization failure.
6# Required failure cases are where s2 overlaps both s1 and s3, but s1
7# commits before s3 executes its first SELECT.
8#
9# If s3 were declared READ ONLY there would be no false positives.
10# With s3 defaulting to READ WRITE, we currently expect 12 false
11# positives.  Further work dealing with de facto READ ONLY transactions
12# may be able to reduce or eliminate those false positives.
13
14setup
15{
16 create table D1 (id int not null);
17 create table D2 (id int not null);
18 insert into D1 values (1);
19 insert into D2 values (1);
20}
21
22teardown
23{
24 DROP TABLE D1, D2;
25}
26
27session s1
28setup		{ BEGIN ISOLATION LEVEL SERIALIZABLE; }
29step wx1	{ update D1 set id = id + 1; }
30step c1		{ COMMIT; }
31
32session s2
33setup		{ BEGIN ISOLATION LEVEL SERIALIZABLE; }
34step rxwy2	{ update D2 set id = (select id+1 from D1); }
35step c2		{ COMMIT; }
36
37session s3
38setup		{ BEGIN ISOLATION LEVEL SERIALIZABLE; }
39step ry3	{ select id from D2; }
40step c3		{ COMMIT; }
41