add plannerHook
This commit is contained in:
@ -1289,8 +1289,12 @@ PlannedStmt* pg_plan_query(Query* querytree, int cursorOptions, ParamListInfo bo
|
||||
if (!OidIsValid(lc_replan_nodegroup))
|
||||
check_query_acl(querytree);
|
||||
|
||||
/* call the optimizer */
|
||||
plan = planner(querytree, cursorOptions, boundParams);
|
||||
if (u_sess->hook_cxt.plannerHook != NULL) {
|
||||
plan = ((plannerFunc)(u_sess->hook_cxt.plannerHook))(querytree, cursorOptions, boundParams);
|
||||
} else {
|
||||
/* call the optimizer */
|
||||
plan = planner(querytree, cursorOptions, boundParams);
|
||||
}
|
||||
|
||||
PGSTAT_END_TIME_RECORD(PLAN_TIME);
|
||||
|
||||
|
@ -2711,6 +2711,7 @@ typedef struct knl_u_hook_context {
|
||||
void *standardProcessUtilityHook;
|
||||
void *aggIsSupportedHook;
|
||||
void *searchFuncHook;
|
||||
void *plannerHook;
|
||||
} knl_u_hook_context;
|
||||
/* PBE message flag */
|
||||
typedef enum {
|
||||
|
@ -209,4 +209,6 @@ extern bool check_stream_for_loop_fetch(Portal portal);
|
||||
extern bool IsPlanForPartitionScan(Plan* plan);
|
||||
extern bool queryIsReadOnly(Query* query);
|
||||
|
||||
typedef PlannedStmt* (*plannerFunc)(Query* parse, int cursorOptions, ParamListInfo boundParams);
|
||||
|
||||
#endif /* PLANNER_H */
|
||||
|
Reference in New Issue
Block a user