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

Commit5e26aa6

Browse files
committed
Test, don't just Assert, that mergejoin's inputs are in order.
There are two Asserts in nodeMergejoin.c that are reachable ifthe input data is not in the expected order. This seems way toofragile. Alexander Lakhin reported a case where the assertionscould be triggered with misconfigured foreign-table partitions,and bitter experience with unstable operating system collationdefinitions suggests another easy route to hitting them. NeitherAssert is in a place where we can't afford one more test-and-branch,so replace 'em with plain test-and-elog logic.Per bug #17395. While the reported symptom is relatively recent,collation changes could happen anytime, so back-patch to allsupported branches.Discussion:https://postgr.es/m/17395-8c326292078d1a57@postgresql.org
1 parentb31e3f5 commit5e26aa6

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

‎src/backend/executor/nodeMergejoin.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -893,11 +893,10 @@ ExecMergeJoin(PlanState *pstate)
893893

894894
if (compareResult==0)
895895
node->mj_JoinState=EXEC_MJ_JOINTUPLES;
896-
else
897-
{
898-
Assert(compareResult<0);
896+
elseif (compareResult<0)
899897
node->mj_JoinState=EXEC_MJ_NEXTOUTER;
900-
}
898+
else/* compareResult > 0 should not happen */
899+
elog(ERROR,"mergejoin input data is out of order");
901900
break;
902901
caseMJEVAL_NONMATCHABLE:
903902

@@ -1087,7 +1086,7 @@ ExecMergeJoin(PlanState *pstate)
10871086

10881087
node->mj_JoinState=EXEC_MJ_JOINTUPLES;
10891088
}
1090-
else
1089+
elseif (compareResult>0)
10911090
{
10921091
/* ----------------
10931092
*if the new outer tuple didn't match the marked inner
@@ -1106,7 +1105,6 @@ ExecMergeJoin(PlanState *pstate)
11061105
*no more inners, no more matches are possible.
11071106
* ----------------
11081107
*/
1109-
Assert(compareResult>0);
11101108
innerTupleSlot=node->mj_InnerTupleSlot;
11111109

11121110
/* reload comparison data for current inner */
@@ -1140,6 +1138,8 @@ ExecMergeJoin(PlanState *pstate)
11401138
returnNULL;
11411139
}
11421140
}
1141+
else/* compareResult < 0 should not happen */
1142+
elog(ERROR,"mergejoin input data is out of order");
11431143
break;
11441144

11451145
/*----------------------------------------------------------

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp