diff options
Diffstat (limited to 'src/backend/optimizer/util/pathnode.c')
-rw-r--r-- | src/backend/optimizer/util/pathnode.c | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/src/backend/optimizer/util/pathnode.c b/src/backend/optimizer/util/pathnode.c index 319e8b2c379..6f1c6cfb2aa 100644 --- a/src/backend/optimizer/util/pathnode.c +++ b/src/backend/optimizer/util/pathnode.c @@ -27,6 +27,7 @@ #include "optimizer/var.h" #include "parser/parsetree.h" #include "utils/lsyscache.h" +#include "utils/memutils.h" #include "utils/selfuncs.h" @@ -1926,3 +1927,49 @@ reparameterize_path(PlannerInfo *root, Path *path, } return NULL; } + +/***************************************************************************** + * creation of custom-plan paths + *****************************************************************************/ + +static List *custom_path_providers = NIL; + +/* + * register_custom_path_provider + * + * Register a table of callback functions which implements a custom-path + * provider. This allows extension to provide additional (hopefully faster) + * methods of scanning a relation. + */ +void +register_custom_path_provider(CustomPathMethods *cpp_methods) +{ + MemoryContext oldcxt; + + oldcxt = MemoryContextSwitchTo(TopMemoryContext); + custom_path_providers = lappend(custom_path_providers, cpp_methods); + MemoryContextSwitchTo(oldcxt); +} + +/* + * create_customscan_paths + * + * Invoke custom path provider callbacks. If the callback determines that + * the custom-path provider can handle this relation, it can add one or more + * paths using add_path(). + */ +void +create_customscan_paths(PlannerInfo *root, + RelOptInfo *baserel, + RangeTblEntry *rte) +{ + ListCell *cell; + + foreach (cell, custom_path_providers) + { + const CustomPathMethods *cpp_methods = lfirst(cell); + + if (cpp_methods->CreateCustomScanPath) + cpp_methods->CreateCustomScanPath(root, baserel, rte); + } +} |