Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitb39fd89

Browse files
committed
Improve regression test coverage of expand_tuple().
I was dissatisfied with the code coverage report for expand_tuple() in thewake of commit7c44c46: while better than no coverage at all, it wasstill not exercising the core function of inserting out-of-line defaultvalues, nor was the HeapTuple-output path covered. So far as I can find,the only code path that reaches the latter at present is EvalPlanQualfetches for non-locked tables. Hence, extend eval-plan-qual.spec totest cases where out-of-line defaults must be inserted into a tuplefetched from a non-locked table.Discussion:https://postgr.es/m/87woxi24uw.fsf@ansel.ydns.eu
1 parent50c6bb0 commitb39fd89

File tree

2 files changed

+34
-0
lines changed

2 files changed

+34
-0
lines changed

‎src/test/isolation/expected/eval-plan-qual.out

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,26 @@ accountid balance
145145
checking 1050
146146
savings 600
147147

148+
starting permutation: wx2_ext partiallock_ext c2 c1 read_ext
149+
step wx2_ext: UPDATE accounts_ext SET balance = balance + 450;
150+
step partiallock_ext:
151+
SELECT * FROM accounts_ext a1, accounts_ext a2
152+
WHERE a1.accountid = a2.accountid
153+
FOR UPDATE OF a1;
154+
<waiting ...>
155+
step c2: COMMIT;
156+
step partiallock_ext: <... completed>
157+
accountid balance other newcol newcol2 accountid balance other newcol newcol2
158+
159+
checking 1050 other 42 checking 600 other 42
160+
savings 1150 42 savings 700 42
161+
step c1: COMMIT;
162+
step read_ext: SELECT * FROM accounts_ext ORDER BY accountid;
163+
accountid balance other newcol newcol2
164+
165+
checking 1050 other 42
166+
savings 1150 42
167+
148168
starting permutation: updateforss readforss c1 c2
149169
step updateforss:
150170
UPDATE table_a SET value = 'newTableAValue' WHERE id = 1;

‎src/test/isolation/specs/eval-plan-qual.spec

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,11 @@ setup
99
CREATETABLEaccounts (accountidtextPRIMARYKEY,balancenumericnotnull);
1010
INSERTINTOaccountsVALUES ('checking',600), ('savings',600);
1111

12+
CREATETABLEaccounts_ext (accountidtextPRIMARYKEY,balancenumericnotnull,othertext);
13+
INSERTINTOaccounts_extVALUES ('checking',600,'other'), ('savings',700,null);
14+
ALTERTABLEaccounts_extADDCOLUMNnewcolintDEFAULT42;
15+
ALTERTABLEaccounts_extADDCOLUMNnewcol2textDEFAULTNULL;
16+
1217
CREATETABLEp (aint,bint,cint);
1318
CREATETABLEc1 ()INHERITS (p);
1419
CREATETABLEc2 ()INHERITS (p);
@@ -29,6 +34,7 @@ setup
2934
teardown
3035
{
3136
DROPTABLEaccounts;
37+
DROPTABLEaccounts_ext;
3238
DROPTABLEpCASCADE;
3339
DROPTABLEtable_a,table_b,jointest;
3440
}
@@ -72,6 +78,11 @@ step "lockwithvalues"{
7278
WHEREa1.accountid=v.id
7379
FORUPDATEOFa1;
7480
}
81+
step"partiallock_ext"{
82+
SELECT*FROMaccounts_exta1,accounts_exta2
83+
WHEREa1.accountid=a2.accountid
84+
FORUPDATEOFa1;
85+
}
7586

7687
# these tests exercise EvalPlanQual with a SubLink sub-select (which should be
7788
# unaffected by any EPQ recheck behavior in the outer query); cf bug #14034
@@ -105,6 +116,7 @@ step "upsert2"{
105116
INSERTINTOaccountsSELECT'savings',1234
106117
WHERENOTEXISTS (SELECT1FROMupsert);
107118
}
119+
step"wx2_ext"{UPDATEaccounts_extSETbalance=balance+450; }
108120
step"readp2"{SELECTtableoid::regclass,ctid,*FROMpWHEREbIN (0,1)ANDc=0FORUPDATE; }
109121
step"returningp1" {
110122
WITHuAS (UPDATEpSETb=bWHEREa>0RETURNING* )
@@ -124,6 +136,7 @@ step "c2"{ COMMIT; }
124136
session"s3"
125137
setup{BEGINISOLATIONLEVELREADCOMMITTED; }
126138
step"read"{SELECT*FROMaccountsORDERBYaccountid; }
139+
step"read_ext"{SELECT*FROMaccounts_extORDERBYaccountid; }
127140

128141
# this test exercises EvalPlanQual with a CTE, cf bug #14328
129142
step"readwcte"{
@@ -156,6 +169,7 @@ permutation "readp1" "writep1" "readp2" "c1" "c2"
156169
permutation"writep2""returningp1""c1""c2"
157170
permutation"wx2""partiallock""c2""c1""read"
158171
permutation"wx2""lockwithvalues""c2""c1""read"
172+
permutation"wx2_ext""partiallock_ext""c2""c1""read_ext"
159173
permutation"updateforss""readforss""c1""c2"
160174
permutation"wrtwcte""readwcte""c1""c2"
161175
permutation"wrjt""selectjoinforupdate""c2""c1"

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp