From 2b2d3ae3821ad25f431a03f8acf75bad550bff93 Mon Sep 17 00:00:00 2001 From: ganyang Date: Mon, 20 Jun 2022 11:20:03 +0800 Subject: [PATCH] add execInitExprHook --- src/gausskernel/runtime/executor/execQual.cpp | 5 +++++ src/include/executor/executor.h | 1 + src/include/knl/knl_session.h | 1 + 3 files changed, 7 insertions(+) diff --git a/src/gausskernel/runtime/executor/execQual.cpp b/src/gausskernel/runtime/executor/execQual.cpp index f6783ca9f..9c059bb21 100644 --- a/src/gausskernel/runtime/executor/execQual.cpp +++ b/src/gausskernel/runtime/executor/execQual.cpp @@ -5162,6 +5162,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 fbd7b338b..572e46c38 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 {