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