/
githubmirror
/
postgres
Обзор
Документация
Войти
/
githubmirror
/
postgres
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
master
src/test/isolation/specs/total-cash.spec
28 строк
780 B
Tom Lane
Allow non-quoted identifiers as isolation test session/step names.
24 июн 2021, 01:41
24 июн 2021, 01:41
a443c1b
Код
Авторство
О чём код?
# Total Cash test # # Another famous test of snapshot isolation anomaly. # # Any overlap between the transactions must cause a serialization failure. setup { CREATE TABLE accounts (accountid text NOT NULL PRIMARY KEY, balance numeric not null); INSERT INTO accounts VALUES ('checking', 600),('savings',600); } teardown { DROP TABLE accounts; } session s1 setup { BEGIN ISOLATION LEVEL SERIALIZABLE; } step wx1 { UPDATE accounts SET balance = balance - 200 WHERE accountid = 'checking'; } step rxy1 { SELECT SUM(balance) FROM accounts; } step c1 { COMMIT; } session s2 setup { BEGIN ISOLATION LEVEL SERIALIZABLE; } step wy2 { UPDATE accounts SET balance = balance - 200 WHERE accountid = 'savings'; } step rxy2 { SELECT SUM(balance) FROM accounts; } step c2 { COMMIT; }