Skip to content

Commit

Permalink
Extend the ability of planner_node_transformer_hook to store the cont…
Browse files Browse the repository at this point in the history
…ext of expression being processed (#469)

Extend the ability of planner_node_transformer_hook to store the context of expression being process. This saved context will be used during planning to transform declared variable either as a Param (if it appears in TargetList) or as a const (all the other places).

Extension: babelfish-for-postgresql/babelfish_extensions#3011
Task: BABEL-5188
Signed-off-by: Dipesh Dhameliya <dddhamel@amazon.com>
  • Loading branch information
Deepesh125 authored and ritanwar committed Nov 25, 2024
1 parent e14f7cc commit 47e50ad
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/backend/optimizer/plan/planner.c
Original file line number Diff line number Diff line change
Expand Up @@ -1182,6 +1182,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.
*/
Expand Down

0 comments on commit 47e50ad

Please sign in to comment.