diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 2015-07-29 13:27:15 -0400 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 2015-07-29 13:27:57 -0400 |
commit | 3ef1a682d5e4a919dcaddc8256ea65de91654d1c (patch) | |
tree | 7530d988686b7c2025e58136bc395033ff618144 /src | |
parent | 0bfbf14f93c30ec8f505baba79625f5a3b010405 (diff) | |
download | postgresql-3ef1a682d5e4a919dcaddc8256ea65de91654d1c.tar.gz postgresql-3ef1a682d5e4a919dcaddc8256ea65de91654d1c.zip |
Add some test coverage of EvalPlanQual with non-locked tables.
A Salesforce colleague of mine griped that the regression tests don't
exercise EvalPlanQualFetchRowMarks() and allied routines. Which is
a fair complaint. Add test cases that go through the REFERENCE and COPY
code paths. Unfortunately we don't have sufficient infrastructure right
now to exercise the FDW code path in the isolation tests, but this is
surely better than before.
Diffstat (limited to 'src')
-rw-r--r-- | src/test/isolation/expected/eval-plan-qual.out | 40 | ||||
-rw-r--r-- | src/test/isolation/specs/eval-plan-qual.spec | 16 |
2 files changed, 56 insertions, 0 deletions
diff --git a/src/test/isolation/expected/eval-plan-qual.out b/src/test/isolation/expected/eval-plan-qual.out index 433533e6117..457461e355c 100644 --- a/src/test/isolation/expected/eval-plan-qual.out +++ b/src/test/isolation/expected/eval-plan-qual.out @@ -104,3 +104,43 @@ a b c 2 2 2 2 3 0 step c2: COMMIT; + +starting permutation: wx2 partiallock c2 c1 read +step wx2: UPDATE accounts SET balance = balance + 450 WHERE accountid = 'checking'; +step partiallock: + SELECT * FROM accounts a1, accounts a2 + WHERE a1.accountid = a2.accountid + FOR UPDATE OF a1; + <waiting ...> +step c2: COMMIT; +step partiallock: <... completed> +accountid balance accountid balance + +checking 1050 checking 600 +savings 600 savings 600 +step c1: COMMIT; +step read: SELECT * FROM accounts ORDER BY accountid; +accountid balance + +checking 1050 +savings 600 + +starting permutation: wx2 lockwithvalues c2 c1 read +step wx2: UPDATE accounts SET balance = balance + 450 WHERE accountid = 'checking'; +step lockwithvalues: + SELECT * FROM accounts a1, (values('checking'),('savings')) v(id) + WHERE a1.accountid = v.id + FOR UPDATE OF a1; + <waiting ...> +step c2: COMMIT; +step lockwithvalues: <... completed> +accountid balance id + +checking 1050 checking +savings 600 savings +step c1: COMMIT; +step read: SELECT * FROM accounts ORDER BY accountid; +accountid balance + +checking 1050 +savings 600 diff --git a/src/test/isolation/specs/eval-plan-qual.spec b/src/test/isolation/specs/eval-plan-qual.spec index 6fb24322863..a391466722f 100644 --- a/src/test/isolation/specs/eval-plan-qual.spec +++ b/src/test/isolation/specs/eval-plan-qual.spec @@ -50,6 +50,20 @@ step "writep1" { UPDATE p SET b = -1 WHERE a = 1 AND b = 1 AND c = 0; } step "writep2" { UPDATE p SET b = -b WHERE a = 1 AND c = 0; } step "c1" { COMMIT; } +# these tests are meant to exercise EvalPlanQualFetchRowMarks, +# ie, handling non-locked tables in an EvalPlanQual recheck + +step "partiallock" { + SELECT * FROM accounts a1, accounts a2 + WHERE a1.accountid = a2.accountid + FOR UPDATE OF a1; +} +step "lockwithvalues" { + SELECT * FROM accounts a1, (values('checking'),('savings')) v(id) + WHERE a1.accountid = v.id + FOR UPDATE OF a1; +} + session "s2" setup { BEGIN ISOLATION LEVEL READ COMMITTED; } step "wx2" { UPDATE accounts SET balance = balance + 450 WHERE accountid = 'checking'; } @@ -79,3 +93,5 @@ permutation "wy1" "wy2" "c1" "c2" "read" permutation "upsert1" "upsert2" "c1" "c2" "read" permutation "readp1" "writep1" "readp2" "c1" "c2" permutation "writep2" "returningp1" "c1" "c2" +permutation "wx2" "partiallock" "c2" "c1" "read" +permutation "wx2" "lockwithvalues" "c2" "c1" "read" |