diff --git a/src/gausskernel/runtime/executor/execQual.cpp b/src/gausskernel/runtime/executor/execQual.cpp index ec246a861..e6f1004b6 100644 --- a/src/gausskernel/runtime/executor/execQual.cpp +++ b/src/gausskernel/runtime/executor/execQual.cpp @@ -5184,6 +5184,11 @@ Datum ExecEvalExprSwitchContext(ExprState* expression, ExprContext* econtext, bo */ ExprState* ExecInitExpr(Expr* node, PlanState* parent) { + if (u_sess->hook_cxt.execInitExprHook != NULL) { + ExprState* expr = ((execInitExprFunc)(u_sess->hook_cxt.execInitExprHook))(node, parent); + if (expr != NULL) + return expr; + } ExprState* state = NULL; gstrace_entry(GS_TRC_ID_ExecInitExpr); diff --git a/src/include/executor/executor.h b/src/include/executor/executor.h index bb2f80996..39735080b 100644 --- a/src/include/executor/executor.h +++ b/src/include/executor/executor.h @@ -152,6 +152,7 @@ extern THR_LOCAL PGDLLIMPORT ExecutorEnd_hook_type ExecutorEnd_hook; typedef bool (*ExecutorCheckPerms_hook_type)(List*, bool); extern THR_LOCAL PGDLLIMPORT ExecutorCheckPerms_hook_type ExecutorCheckPerms_hook; +typedef ExprState* (*execInitExprFunc)(Expr* node, PlanState* parent); /* * prototypes from functions in execAmi.c */ diff --git a/src/include/knl/knl_session.h b/src/include/knl/knl_session.h index 3c214ed66..d79981d4d 100644 --- a/src/include/knl/knl_session.h +++ b/src/include/knl/knl_session.h @@ -2637,6 +2637,7 @@ typedef struct knl_u_clientConnTime_context { typedef struct knl_u_hook_context { void *analyzerRoutineHook; void *transformStmtHook; + void *execInitExprHook; } knl_u_hook_context; typedef struct knl_session_context {