diff --git a/src/backend/distributed/planner/multi_logical_planner.c b/src/backend/distributed/planner/multi_logical_planner.c index 6e51e779c..fa2668e88 100644 --- a/src/backend/distributed/planner/multi_logical_planner.c +++ b/src/backend/distributed/planner/multi_logical_planner.c @@ -1104,7 +1104,7 @@ ErrorHintRequired(const char *errorHint, Query *queryTree) /* - * DeferErrorIfSubqueryNotSupported checks that we can perform distributed planning for + * DeferErrorIfUnsupportedSubqueryRepartition checks that we can perform distributed planning for * the given subquery. If not, a deferred error is returned. The function recursively * does this check to all lower levels of the subquery. */ diff --git a/src/backend/distributed/planner/query_pushdown_planning.c b/src/backend/distributed/planner/query_pushdown_planning.c index 8b57b9682..13b73bac3 100644 --- a/src/backend/distributed/planner/query_pushdown_planning.c +++ b/src/backend/distributed/planner/query_pushdown_planning.c @@ -850,6 +850,18 @@ DeferredErrorIfUnsupportedRecurringTuplesJoin( } +/* + * CanPushdownSubquery checks if we can push down the given + * subquery to worker nodes. + */ +bool +CanPushdownSubquery(Query *subqueryTree, bool outerMostQueryHasLimit) +{ + return DeferErrorIfCannotPushdownSubquery(subqueryTree, outerMostQueryHasLimit) == + NULL; +} + + /* * DeferErrorIfCannotPushdownSubquery checks if we can push down the given * subquery to worker nodes. If we cannot push down the subquery, this function diff --git a/src/backend/distributed/planner/recursive_planning.c b/src/backend/distributed/planner/recursive_planning.c index ad337115f..49aa43c86 100644 --- a/src/backend/distributed/planner/recursive_planning.c +++ b/src/backend/distributed/planner/recursive_planning.c @@ -889,7 +889,7 @@ ShouldRecursivelyPlanSubquery(Query *subquery, RecursivePlanningContext *context * do not contain any other local tables. */ } - else if (DeferErrorIfCannotPushdownSubquery(subquery, false) == NULL) + else if (CanPushdownSubquery(subquery, false)) { /* * We should do one more check for the distribution key equality. diff --git a/src/include/distributed/query_pushdown_planning.h b/src/include/distributed/query_pushdown_planning.h index 22524b3e4..911be8d1e 100644 --- a/src/include/distributed/query_pushdown_planning.h +++ b/src/include/distributed/query_pushdown_planning.h @@ -22,7 +22,7 @@ /* Config variables managed via guc.c */ extern bool SubqueryPushdown; - +extern bool CanPushdownSubquery(Query *subqueryTree, bool outerMostQueryHasLimit); extern bool ShouldUseSubqueryPushDown(Query *originalQuery, Query *rewrittenQuery, PlannerRestrictionContext *plannerRestrictionContext); extern bool JoinTreeContainsSubquery(Query *query);