diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-04 12:19:15 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-04 12:19:15 +0000 |
commit | 6eb9c5a5657d1fe77b55cc261450f3538d35a94d (patch) | |
tree | 657d8194422a5daccecfd42d654b8a245ef7b4c8 /src/test/isolation/specs/two-ids.spec | |
parent | Initial commit. (diff) | |
download | postgresql-13-upstream.tar.xz postgresql-13-upstream.zip |
Adding upstream version 13.4.upstream/13.4upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-rw-r--r-- | src/test/isolation/specs/two-ids.spec | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/src/test/isolation/specs/two-ids.spec b/src/test/isolation/specs/two-ids.spec new file mode 100644 index 0000000..fc0289f --- /dev/null +++ b/src/test/isolation/specs/two-ids.spec @@ -0,0 +1,40 @@ +# Two IDs test +# +# Small, simple test showing read-only anomalies. +# +# There are only four permutations which must cause a serialization failure. +# Required failure cases are where s2 overlaps both s1 and s3, but s1 +# commits before s3 executes its first SELECT. +# +# If s3 were declared READ ONLY there would be no false positives. +# With s3 defaulting to READ WRITE, we currently expect 12 false +# positives. Further work dealing with de facto READ ONLY transactions +# may be able to reduce or eliminate those false positives. + +setup +{ + create table D1 (id int not null); + create table D2 (id int not null); + insert into D1 values (1); + insert into D2 values (1); +} + +teardown +{ + DROP TABLE D1, D2; +} + +session s1 +setup { BEGIN ISOLATION LEVEL SERIALIZABLE; } +step wx1 { update D1 set id = id + 1; } +step c1 { COMMIT; } + +session s2 +setup { BEGIN ISOLATION LEVEL SERIALIZABLE; } +step rxwy2 { update D2 set id = (select id+1 from D1); } +step c2 { COMMIT; } + +session s3 +setup { BEGIN ISOLATION LEVEL SERIALIZABLE; } +step ry3 { select id from D2; } +step c3 { COMMIT; } |