summaryrefslogtreecommitdiffstats
path: root/src/test/isolation/specs/nowait-3.spec
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-13 13:44:03 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-13 13:44:03 +0000
commit293913568e6a7a86fd1479e1cff8e2ecb58d6568 (patch)
treefc3b469a3ec5ab71b36ea97cc7aaddb838423a0c /src/test/isolation/specs/nowait-3.spec
parentInitial commit. (diff)
downloadpostgresql-16-293913568e6a7a86fd1479e1cff8e2ecb58d6568.tar.xz
postgresql-16-293913568e6a7a86fd1479e1cff8e2ecb58d6568.zip
Adding upstream version 16.2.upstream/16.2
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'src/test/isolation/specs/nowait-3.spec')
-rw-r--r--src/test/isolation/specs/nowait-3.spec33
1 files changed, 33 insertions, 0 deletions
diff --git a/src/test/isolation/specs/nowait-3.spec b/src/test/isolation/specs/nowait-3.spec
new file mode 100644
index 0000000..06fb762
--- /dev/null
+++ b/src/test/isolation/specs/nowait-3.spec
@@ -0,0 +1,33 @@
+# Test NOWAIT with tuple locks.
+
+setup
+{
+ CREATE TABLE foo (
+ id int PRIMARY KEY,
+ data text NOT NULL
+ );
+ INSERT INTO foo VALUES (1, 'x');
+}
+
+teardown
+{
+ DROP TABLE foo;
+}
+
+session s1
+setup { BEGIN; }
+step s1a { SELECT * FROM foo FOR UPDATE; }
+step s1b { COMMIT; }
+
+session s2
+setup { BEGIN; }
+step s2a { SELECT * FROM foo FOR UPDATE; }
+step s2b { COMMIT; }
+
+session s3
+setup { BEGIN; }
+step s3a { SELECT * FROM foo FOR UPDATE NOWAIT; }
+step s3b { COMMIT; }
+
+# s3 skips to second record due to tuple lock held by s2
+permutation s1a s2a s3a s1b s2b s3b