From cd9f6ae313b23d8081b9e87213efc9c030918ead Mon Sep 17 00:00:00 2001 From: eaydingol Date: Fri, 25 Jul 2025 14:18:23 +0300 Subject: [PATCH] Enable push down only for reference table --- .../distributed/planner/recursive_planning.c | 19 +++---------------- 1 file changed, 3 insertions(+), 16 deletions(-) diff --git a/src/backend/distributed/planner/recursive_planning.c b/src/backend/distributed/planner/recursive_planning.c index 924d567c0..1fd2b47d1 100644 --- a/src/backend/distributed/planner/recursive_planning.c +++ b/src/backend/distributed/planner/recursive_planning.c @@ -2658,34 +2658,21 @@ hasPseudoconstantQuals(RelationRestrictionContext *relationRestrictionContext) /* - * IsPushdownSafeForRTEInLeftJoin returns true if the given range table entry - * is safe for pushdown. Currently, we only allow RTE_RELATION and RTE_FUNCTION. + * IsPushdownSafeForRTEInLeftJoin returns true if the given range table entry + * is safe for pushdown. Currently, we only allow reference tables. */ bool IsPushdownSafeForRTEInLeftJoin(RangeTblEntry *rte) { - if (rte->rtekind == RTE_RELATION) + if (IsCitusTable(rte->relid) && IsCitusTableType(rte->relid, REFERENCE_TABLE)) { return true; } - /* check if it is a citus table, e.g., ref table */ - else if (rte->rtekind == RTE_FUNCTION) - { - RangeTblEntry *newRte = NULL; - if(!ExtractCitusExtradataContainerRTE(rte, &newRte)) - { - ereport(DEBUG5, (errmsg("RTE type %d is not safe for pushdown, function but it does not contain citus extradata", - rte->rtekind))); - return false; - } - return true; - } else { ereport(DEBUG5, (errmsg("RTE type %d is not safe for pushdown", rte->rtekind))); return false; } - }