diff --git a/src/backend/optimizer/path/allpaths.c b/src/backend/optimizer/path/allpaths.c index 56ccde977c..b06cbc22ee 100644 --- a/src/backend/optimizer/path/allpaths.c +++ b/src/backend/optimizer/path/allpaths.c @@ -414,6 +414,25 @@ set_rel_size(PlannerInfo *root, RelOptInfo *rel, Assert(rel->rows > 0 || IS_DUMMY_REL(rel)); } +/* + * call_pathlist_hook + * Call the hook that allows extensions to editorialize pathlists on a base rel. + * + */ +void +call_pathlist_hook(PlannerInfo *root, RelOptInfo *rel, + Index rti, RangeTblEntry *rte) +{ + /* + * Allow a plugin to editorialize on the set of Paths for this base + * relation. It could add new paths (such as CustomPaths) by calling + * add_path(), or add_partial_path() if parallel aware. It could also + * delete or modify paths added by the core code. + */ + if (set_rel_pathlist_hook) + (*set_rel_pathlist_hook) (root, rel, rti, rte); +} + /* * set_rel_pathlist * Build access paths for a base relation @@ -479,14 +498,7 @@ set_rel_pathlist(PlannerInfo *root, RelOptInfo *rel, } } - /* - * Allow a plugin to editorialize on the set of Paths for this base - * relation. It could add new paths (such as CustomPaths) by calling - * add_path(), or add_partial_path() if parallel aware. It could also - * delete or modify paths added by the core code. - */ - if (set_rel_pathlist_hook) - (*set_rel_pathlist_hook) (root, rel, rti, rte); + call_pathlist_hook(root, rel, rti, rte); /* * If this is a baserel, we should normally consider gathering any partial diff --git a/src/backend/optimizer/plan/planner.c b/src/backend/optimizer/plan/planner.c index 0f46914e54..3bed90e20a 100644 --- a/src/backend/optimizer/plan/planner.c +++ b/src/backend/optimizer/plan/planner.c @@ -7008,6 +7008,8 @@ apply_scanjoin_target_to_paths(PlannerInfo *root, /* Build new paths for this relation by appending child paths. */ add_paths_to_append_rel(root, rel, live_children); + + call_pathlist_hook(root, rel, rel->relid, root->simple_rte_array[rel->relid]); } /* diff --git a/src/include/optimizer/paths.h b/src/include/optimizer/paths.h index cafde307ad..a21c316dca 100644 --- a/src/include/optimizer/paths.h +++ b/src/include/optimizer/paths.h @@ -240,4 +240,7 @@ extern PathKey *make_canonical_pathkey(PlannerInfo *root, extern void add_paths_to_append_rel(PlannerInfo *root, RelOptInfo *rel, List *live_childrels); +extern void call_pathlist_hook(PlannerInfo *root, RelOptInfo *rel, + Index rti, RangeTblEntry *rte); + #endif /* PATHS_H */