summaryrefslogtreecommitdiffstats
path: root/src/test/isolation/specs/fk-deadlock2.spec
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-04 12:15:05 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-04 12:15:05 +0000
commit46651ce6fe013220ed397add242004d764fc0153 (patch)
tree6e5299f990f88e60174a1d3ae6e48eedd2688b2b /src/test/isolation/specs/fk-deadlock2.spec
parentInitial commit. (diff)
downloadpostgresql-14-46651ce6fe013220ed397add242004d764fc0153.tar.xz
postgresql-14-46651ce6fe013220ed397add242004d764fc0153.zip
Adding upstream version 14.5.upstream/14.5upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'src/test/isolation/specs/fk-deadlock2.spec')
-rw-r--r--src/test/isolation/specs/fk-deadlock2.spec48
1 files changed, 48 insertions, 0 deletions
diff --git a/src/test/isolation/specs/fk-deadlock2.spec b/src/test/isolation/specs/fk-deadlock2.spec
new file mode 100644
index 0000000..c8e0e4e
--- /dev/null
+++ b/src/test/isolation/specs/fk-deadlock2.spec
@@ -0,0 +1,48 @@
+setup
+{
+ CREATE TABLE A (
+ AID integer not null,
+ Col1 integer,
+ PRIMARY KEY (AID)
+ );
+
+ CREATE TABLE B (
+ BID integer not null,
+ AID integer not null,
+ Col2 integer,
+ PRIMARY KEY (BID),
+ FOREIGN KEY (AID) REFERENCES A(AID)
+ );
+
+ INSERT INTO A (AID) VALUES (1);
+ INSERT INTO B (BID,AID) VALUES (2,1);
+}
+
+teardown
+{
+ DROP TABLE a, b;
+}
+
+session s1
+setup { BEGIN; SET deadlock_timeout = '100ms'; }
+step s1u1 { UPDATE A SET Col1 = 1 WHERE AID = 1; }
+step s1u2 { UPDATE B SET Col2 = 1 WHERE BID = 2; }
+step s1c { COMMIT; }
+
+session s2
+setup { BEGIN; SET deadlock_timeout = '10s'; }
+step s2u1 { UPDATE B SET Col2 = 1 WHERE BID = 2; }
+step s2u2 { UPDATE B SET Col2 = 1 WHERE BID = 2; }
+step s2c { COMMIT; }
+
+permutation s1u1 s1u2 s1c s2u1 s2u2 s2c
+permutation s1u1 s1u2 s2u1 s1c s2u2 s2c
+permutation s1u1 s2u1 s1u2 s2u2 s2c s1c
+permutation s1u1 s2u1 s2u2 s1u2 s2c s1c
+permutation s1u1 s2u1 s2u2 s2c s1u2 s1c
+permutation s2u1 s1u1 s1u2 s2u2 s2c s1c
+permutation s2u1 s1u1 s2u2 s1u2 s2c s1c
+permutation s2u1 s1u1 s2u2 s2c s1u2 s1c
+permutation s2u1 s2u2 s1u1 s1u2 s2c s1c
+permutation s2u1 s2u2 s1u1 s2c s1u2 s1c
+permutation s2u1 s2u2 s2c s1u1 s1u2 s1c