diff options
Diffstat (limited to 'src/backend/executor/nodeHashjoin.c')
-rw-r--r-- | src/backend/executor/nodeHashjoin.c | 21 |
1 files changed, 11 insertions, 10 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); |