/* Hook for plugins to get control in planner() */
planner_hook_type planner_hook = NULL;
+/* Hook for plugins to get control after PlannerGlobal is initialized */
+planner_setup_hook_type planner_setup_hook = NULL;
+
+/* Hook for plugins to get control before PlannerGlobal is discarded */
+planner_shutdown_hook_type planner_shutdown_hook = NULL;
+
/* Hook for plugins to get control when grouping_planner() plans upper rels */
create_upper_paths_hook_type create_upper_paths_hook = NULL;
tuple_fraction = 0.0;
}
+ /* Allow plugins to take control after we've initialized "glob" */
+ if (planner_setup_hook)
+ (*planner_setup_hook) (glob, parse, query_string, &tuple_fraction, es);
+
/* primary planning entry point (may recurse for subqueries) */
root = subquery_planner(glob, parse, NULL, NULL, false, tuple_fraction,
NULL);
result->jitFlags |= PGJIT_DEFORM;
}
+ /* Allow plugins to take control before we discard "glob" */
+ if (planner_shutdown_hook)
+ (*planner_shutdown_hook) (glob, parse, query_string, result);
+
if (glob->partition_directory != NULL)
DestroyPartitionDirectory(glob->partition_directory);
ExplainState *es);
extern PGDLLIMPORT planner_hook_type planner_hook;
+/* Hook for plugins to get control after PlannerGlobal is initialized */
+typedef void (*planner_setup_hook_type) (PlannerGlobal *glob, Query *parse,
+ const char *query_string,
+ double *tuple_fraction,
+ ExplainState *es);
+extern PGDLLIMPORT planner_setup_hook_type planner_setup_hook;
+
+/* Hook for plugins to get control before PlannerGlobal is discarded */
+typedef void (*planner_shutdown_hook_type) (PlannerGlobal *glob, Query *parse,
+ const char *query_string,
+ PlannedStmt *pstmt);
+extern PGDLLIMPORT planner_shutdown_hook_type planner_shutdown_hook;
+
/* Hook for plugins to get control when grouping_planner() plans upper rels */
typedef void (*create_upper_paths_hook_type) (PlannerInfo *root,
UpperRelationKind stage,