3
# Another famous test of snapshot isolation anomaly.
5
# Any overlap between the transactions must cause a serialization failure.
9
CREATE TABLE accounts (accountid text NOT NULL PRIMARY KEY, balance numeric not null);
10
INSERT INTO accounts VALUES ('checking', 600),('savings',600);
19
setup { BEGIN ISOLATION LEVEL SERIALIZABLE; }
20
step "wx1" { UPDATE accounts SET balance = balance - 200 WHERE accountid = 'checking'; }
21
step "rxy1" { SELECT SUM(balance) FROM accounts; }
25
setup { BEGIN ISOLATION LEVEL SERIALIZABLE; }
26
step "wy2" { UPDATE accounts SET balance = balance - 200 WHERE accountid = 'savings'; }
27
step "rxy2" { SELECT SUM(balance) FROM accounts; }