bool enable_geqo = false; /* just in case GUC doesn't set it */
int geqo_threshold;
+/* Hook for plugins to get control in set_rel_pathlist() */
+set_rel_pathlist_hook_type set_rel_pathlist_hook = NULL;
+
/* Hook for plugins to replace standard_join_search() */
join_search_hook_type join_search_hook = NULL;
}
}
+ /*
+ * 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 delete or modify paths added by the core code.
+ */
+ if (set_rel_pathlist_hook)
+ (*set_rel_pathlist_hook) (root, rel, rti, rte);
+
+ /* Now find the cheapest of the paths for this rel */
+ set_cheapest(rel);
+
#ifdef OPTIMIZER_DEBUG
debug_print_rel(root, rel);
#endif
/* Consider TID scans */
create_tidscan_paths(root, rel);
-
- /* Consider custom scans, if any */
- create_customscan_paths(root, rel, rte);
-
- /* Now find the cheapest of the paths for this rel */
- set_cheapest(rel);
}
/*
{
/* Call the FDW's GetForeignPaths function to generate path(s) */
rel->fdwroutine->GetForeignPaths(root, rel, rte->relid);
-
- /* Select cheapest path */
- set_cheapest(rel);
}
/*
add_path(rel, (Path *)
create_append_path(rel, subpaths, required_outer));
}
-
- /* Select cheapest paths */
- set_cheapest(rel);
}
/*
add_path(rel, (Path *) create_append_path(rel, NIL, NULL));
- /* Select cheapest path (pretty easy in this case...) */
+ /*
+ * We set the cheapest path immediately, to ensure that IS_DUMMY_REL()
+ * will recognize the relation as dummy if anyone asks. This is redundant
+ * when we're called from set_rel_size(), but not when called from
+ * elsewhere, and doing it twice is harmless anyway.
+ */
set_cheapest(rel);
}
/* Generate appropriate path */
add_path(rel, create_subqueryscan_path(root, rel, pathkeys, required_outer));
-
- /* Select cheapest path (pretty easy in this case...) */
- set_cheapest(rel);
}
/*
/* Generate appropriate path */
add_path(rel, create_functionscan_path(root, rel,
pathkeys, required_outer));
-
- /* Select cheapest path (pretty easy in this case...) */
- set_cheapest(rel);
}
/*
/* Generate appropriate path */
add_path(rel, create_valuesscan_path(root, rel, required_outer));
-
- /* Select cheapest path (pretty easy in this case...) */
- set_cheapest(rel);
}
/*
/* Generate appropriate path */
add_path(rel, create_ctescan_path(root, rel, required_outer));
-
- /* Select cheapest path (pretty easy in this case...) */
- set_cheapest(rel);
}
/*
/* Generate appropriate path */
add_path(rel, create_worktablescan_path(root, rel, required_outer));
-
- /* Select cheapest path (pretty easy in this case...) */
- set_cheapest(rel);
}
/*
#include "optimizer/var.h"
#include "parser/parsetree.h"
#include "utils/lsyscache.h"
-#include "utils/memutils.h"
#include "utils/selfuncs.h"
}
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(const CustomPathMethods *cpp_methods)
-{
- MemoryContext oldcxt;
-
- oldcxt = MemoryContextSwitchTo(TopMemoryContext);
- custom_path_providers = lappend(custom_path_providers,
- (void *) 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);
- }
-}