summaryrefslogtreecommitdiff
path: root/src/test/isolation/expected
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2012-01-28 17:55:08 -0500
committerTom Lane <tgl@sss.pgh.pa.us>2012-01-28 17:55:08 -0500
commit759d9d67695783f6d04a85aba383a41c5382548c (patch)
tree5bef015457c560676acc8b7e335603b3f98d537d /src/test/isolation/expected
parent7c1719bc68ec1c347e7c80c3735bf3373e765f35 (diff)
downloadpostgresql-759d9d67695783f6d04a85aba383a41c5382548c.tar.gz
Add simple tests of EvalPlanQual using the isolationtester infrastructure.
Much more could be done here, but at least now we have *some* automated test coverage of that mechanism. In particular this tests the writable-CTE case reported by Phil Sorber. In passing, remove isolationtester's arbitrary restriction on the number of steps in a permutation list. I used this so that a single spec file could be used to run several related test scenarios, but there are other possible reasons to want a step series that's not exactly a permutation. Improve documentation and fix a couple other nits as well.
Diffstat (limited to 'src/test/isolation/expected')
-rw-r--r--src/test/isolation/expected/eval-plan-qual.out51
1 files changed, 51 insertions, 0 deletions
diff --git a/src/test/isolation/expected/eval-plan-qual.out b/src/test/isolation/expected/eval-plan-qual.out
new file mode 100644
index 0000000000..ab778cbd7a
--- /dev/null
+++ b/src/test/isolation/expected/eval-plan-qual.out
@@ -0,0 +1,51 @@
+Parsed test spec with 3 sessions
+
+starting permutation: wx1 wx2 c1 c2 read
+step wx1: UPDATE accounts SET balance = balance - 200 WHERE accountid = 'checking';
+step wx2: UPDATE accounts SET balance = balance + 450 WHERE accountid = 'checking'; <waiting ...>
+step c1: COMMIT;
+step wx2: <... completed>
+step c2: COMMIT;
+step read: SELECT * FROM accounts ORDER BY accountid;
+accountid balance
+
+checking 850
+savings 600
+
+starting permutation: wy1 wy2 c1 c2 read
+step wy1: UPDATE accounts SET balance = balance + 500 WHERE accountid = 'checking';
+step wy2: UPDATE accounts SET balance = balance + 1000 WHERE accountid = 'checking' AND balance < 1000; <waiting ...>
+step c1: COMMIT;
+step wy2: <... completed>
+step c2: COMMIT;
+step read: SELECT * FROM accounts ORDER BY accountid;
+accountid balance
+
+checking 1100
+savings 600
+
+starting permutation: upsert1 upsert2 c1 c2 read
+step upsert1:
+ WITH upsert AS
+ (UPDATE accounts SET balance = balance + 500
+ WHERE accountid = 'savings'
+ RETURNING accountid)
+ INSERT INTO accounts SELECT 'savings', 500
+ WHERE NOT EXISTS (SELECT 1 FROM upsert);
+
+step upsert2:
+ WITH upsert AS
+ (UPDATE accounts SET balance = balance + 1234
+ WHERE accountid = 'savings'
+ RETURNING accountid)
+ INSERT INTO accounts SELECT 'savings', 1234
+ WHERE NOT EXISTS (SELECT 1 FROM upsert);
+ <waiting ...>
+step c1: COMMIT;
+step upsert2: <... completed>
+step c2: COMMIT;
+step read: SELECT * FROM accounts ORDER BY accountid;
+accountid balance
+
+checking 600
+savings 2334