diff options
Diffstat (limited to 'src/backend/executor')
-rw-r--r-- | src/backend/executor/nodeHashjoin.c | 21 | ||||
-rw-r--r-- | src/backend/executor/nodeMergejoin.c | 21 |
2 files changed, 22 insertions, 20 deletions
diff --git a/src/backend/executor/nodeHashjoin.c b/src/backend/executor/nodeHashjoin.c index c46764023df..5429e687342 100644 --- a/src/backend/executor/nodeHashjoin.c +++ b/src/backend/executor/nodeHashjoin.c @@ -573,20 +573,21 @@ ExecHashJoinImpl(PlanState *pstate, bool parallel) } /* - * In a right-antijoin, we never return a matched tuple. - * And we need to stay on the current outer tuple to - * continue scanning the inner side for matches. + * If we only need to consider the first matching inner + * tuple, then advance to next outer tuple after we've + * processed this one. */ - if (node->js.jointype == JOIN_RIGHT_ANTI) - continue; + if (node->js.single_match) + node->hj_JoinState = HJ_NEED_NEW_OUTER; /* - * If we only need to join to the first matching inner - * tuple, then consider returning this one, but after that - * continue with next outer tuple. + * In a right-antijoin, we never return a matched tuple. + * If it's not an inner_unique join, we need to stay on + * the current outer tuple to continue scanning the inner + * side for matches. */ - if (node->js.single_match) - node->hj_JoinState = HJ_NEED_NEW_OUTER; + if (node->js.jointype == JOIN_RIGHT_ANTI) + continue; if (otherqual == NULL || ExecQual(otherqual, econtext)) return ExecProject(node->js.ps.ps_ProjInfo); diff --git a/src/backend/executor/nodeMergejoin.c b/src/backend/executor/nodeMergejoin.c index 4fb34e35371..29c54fcd753 100644 --- a/src/backend/executor/nodeMergejoin.c +++ b/src/backend/executor/nodeMergejoin.c @@ -805,20 +805,21 @@ ExecMergeJoin(PlanState *pstate) } /* - * In a right-antijoin, we never return a matched tuple. - * And we need to stay on the current outer tuple to - * continue scanning the inner side for matches. + * If we only need to consider the first matching inner + * tuple, then advance to next outer tuple after we've + * processed this one. */ - if (node->js.jointype == JOIN_RIGHT_ANTI) - break; + if (node->js.single_match) + node->mj_JoinState = EXEC_MJ_NEXTOUTER; /* - * If we only need to join to the first matching inner - * tuple, then consider returning this one, but after that - * continue with next outer tuple. + * In a right-antijoin, we never return a matched tuple. + * If it's not an inner_unique join, we need to stay on + * the current outer tuple to continue scanning the inner + * side for matches. */ - if (node->js.single_match) - node->mj_JoinState = EXEC_MJ_NEXTOUTER; + if (node->js.jointype == JOIN_RIGHT_ANTI) + break; qualResult = (otherqual == NULL || ExecQual(otherqual, econtext)); |