| 1 |
# Project Manager test |
| 2 |
# |
| 3 |
# Ensure that the person who is on the project as a manager |
| 4 |
# is flagged as a project manager in the person table. |
| 5 |
# |
| 6 |
# Any overlap between the transactions must cause a serialization failure. |
| 7 |
|
| 8 |
setup |
| 9 |
{ |
| 10 |
CREATE TABLE person (person_id int NOT NULL PRIMARY KEY, name text NOT NULL, is_project_manager bool NOT NULL); |
| 11 |
INSERT INTO person VALUES (1, 'Robert Haas', true); |
| 12 |
CREATE TABLE project (project_no int NOT NULL PRIMARY KEY, description text NOT NULL, project_manager int NOT NULL); |
| 13 |
} |
| 14 |
|
| 15 |
teardown |
| 16 |
{ |
| 17 |
DROP TABLE person, project; |
| 18 |
} |
| 19 |
|
| 20 |
session s1 |
| 21 |
setup { BEGIN ISOLATION LEVEL SERIALIZABLE; } |
| 22 |
step rx1 { SELECT count(*) FROM person WHERE person_id = 1 AND is_project_manager; } |
| 23 |
step wy1 { INSERT INTO project VALUES (101, 'Build Great Wall', 1); } |
| 24 |
step c1 { COMMIT; } |
| 25 |
|
| 26 |
session s2 |
| 27 |
setup { BEGIN ISOLATION LEVEL SERIALIZABLE; } |
| 28 |
step ry2 { SELECT count(*) FROM project WHERE project_manager = 1; } |
| 29 |
step wx2 { UPDATE person SET is_project_manager = false WHERE person_id = 1; } |
| 30 |
step c2 { COMMIT; } |