From 0b434dca028bc095b6ca92047c9913c0c82bdc4b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Villemain?= Date: Mon, 23 Dec 2024 16:01:46 +0100 Subject: [PATCH] Move the patch a bit later in RouterJob() --- src/backend/distributed/planner/distributed_planner.c | 8 -------- src/backend/distributed/planner/multi_router_planner.c | 7 +++++++ 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/src/backend/distributed/planner/distributed_planner.c b/src/backend/distributed/planner/distributed_planner.c index 1df88f32fb0..8bbf1d6094c 100644 --- a/src/backend/distributed/planner/distributed_planner.c +++ b/src/backend/distributed/planner/distributed_planner.c @@ -217,14 +217,6 @@ distributed_planner(Query *parse, planContext.originalQuery = copyObject(parse); - /* - * We may need to reorder parts of the planner tree we are receiving here. - * We expect to produce an SQL query text but our tree has been optimized by - * PostgreSL rewriter already... - * FIXME is there conditions to reduce the number of calls ? - */ - RebuildParserTreeFromPlannerTree(planContext.originalQuery); - if (!fastPathRouterQuery) { /* diff --git a/src/backend/distributed/planner/multi_router_planner.c b/src/backend/distributed/planner/multi_router_planner.c index 44f955a3227..84352415fad 100644 --- a/src/backend/distributed/planner/multi_router_planner.c +++ b/src/backend/distributed/planner/multi_router_planner.c @@ -1869,6 +1869,13 @@ RouterJob(Query *originalQuery, PlannerRestrictionContext *plannerRestrictionCon } else { + /* + * We may need to reorder parts of the planner tree we are receiving here. + * We expect to produce an SQL query text but our tree has been optimized by + * PostgreSL rewriter already... + * FIXME is there conditions to reduce the number of calls ? + */ + RebuildParserTreeFromPlannerTree(originalQuery); (*planningError) = PlanRouterQuery(originalQuery, plannerRestrictionContext, &placementList, &shardId, &relationShardList, &prunedShardIntervalListList,