summaryrefslogtreecommitdiffstats
path: root/src/test/isolation/specs/project-manager.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/project-manager.spec
parentInitial commit. (diff)
downloadpostgresql-14-upstream.tar.xz
postgresql-14-upstream.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/project-manager.spec')
-rw-r--r--src/test/isolation/specs/project-manager.spec30
1 files changed, 30 insertions, 0 deletions
diff --git a/src/test/isolation/specs/project-manager.spec b/src/test/isolation/specs/project-manager.spec
new file mode 100644
index 0000000..42e5fc5
--- /dev/null
+++ b/src/test/isolation/specs/project-manager.spec
@@ -0,0 +1,30 @@
+# Project Manager test
+#
+# Ensure that the person who is on the project as a manager
+# is flagged as a project manager in the person table.
+#
+# Any overlap between the transactions must cause a serialization failure.
+
+setup
+{
+ CREATE TABLE person (person_id int NOT NULL PRIMARY KEY, name text NOT NULL, is_project_manager bool NOT NULL);
+ INSERT INTO person VALUES (1, 'Robert Haas', true);
+ CREATE TABLE project (project_no int NOT NULL PRIMARY KEY, description text NOT NULL, project_manager int NOT NULL);
+}
+
+teardown
+{
+ DROP TABLE person, project;
+}
+
+session s1
+setup { BEGIN ISOLATION LEVEL SERIALIZABLE; }
+step rx1 { SELECT count(*) FROM person WHERE person_id = 1 AND is_project_manager; }
+step wy1 { INSERT INTO project VALUES (101, 'Build Great Wall', 1); }
+step c1 { COMMIT; }
+
+session s2
+setup { BEGIN ISOLATION LEVEL SERIALIZABLE; }
+step ry2 { SELECT count(*) FROM project WHERE project_manager = 1; }
+step wx2 { UPDATE person SET is_project_manager = false WHERE person_id = 1; }
+step c2 { COMMIT; }