From d8619578a9f94562337cac689caf7cde82e0a4ac Mon Sep 17 00:00:00 2001 From: Dipesh Dhameliya Date: Mon, 11 Nov 2024 08:59:07 +0000 Subject: [PATCH] Handle reset of the context correctly --- src/backend/optimizer/plan/planner.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/backend/optimizer/plan/planner.c b/src/backend/optimizer/plan/planner.c index 49948e2b516..e483f1e87f8 100644 --- a/src/backend/optimizer/plan/planner.c +++ b/src/backend/optimizer/plan/planner.c @@ -1157,6 +1157,10 @@ preprocess_expression(PlannerInfo *root, Node *expr, int kind) if (kind != EXPRKIND_RTFUNC) expr = eval_const_expressions(root, expr); + /* Reset context of expression */ + if(EXPRKIND_TARGET == kind && planner_node_transformer_hook) + (void) planner_node_transformer_hook(root, NULL, -1); + /* * If it's a qual or havingQual, canonicalize it. */ @@ -1169,10 +1173,6 @@ preprocess_expression(PlannerInfo *root, Node *expr, int kind) pprint(expr); #endif - /* Reset context of expression */ - if(EXPRKIND_TARGET == kind && planner_node_transformer_hook) - expr = planner_node_transformer_hook(root, NULL, -1); - } /*