1
0
mirror of https://github.com/postgres/postgres.git synced 2025-07-02 09:02:37 +03:00

Add a GetForeignUpperPaths callback function for FDWs.

This is basically like the just-added create_upper_paths_hook, but
control is funneled only to the FDW responsible for all the baserels
of the current query; so providing such a callback is much less likely
to add useless overhead than using the hook function is.

The documentation is a bit sketchy.  We'll likely want to improve it,
and/or adjust the call conventions, when we get some experience with
actually using this callback.  Hopefully somebody will find time to
experiment with it before 9.6 feature freeze.
This commit is contained in:
Tom Lane
2016-03-14 20:04:44 -04:00
parent be6de4c121
commit 101fd9349e
5 changed files with 67 additions and 17 deletions

View File

@ -1752,13 +1752,17 @@ grouping_planner(PlannerInfo *root, bool inheritance_update,
root->upper_targets[UPPERREL_GROUP_AGG] = grouping_target;
/*
* Let extensions, particularly CustomScan providers, consider
* injecting extension Paths into the query's upperrels, where they
* will compete with the Paths we create below. We pass the final
* scan/join rel because that's not so easily findable from the
* PlannerInfo struct; anything else the hook wants to know should be
* obtainable via "root".
* Let extensions, particularly FDWs and CustomScan providers,
* consider injecting extension Paths into the query's upperrels,
* where they will compete with the Paths we create below. We pass
* the final scan/join rel because that's not so easily findable from
* the PlannerInfo struct; anything else the hooks want to know should
* be obtainable via "root".
*/
if (current_rel->fdwroutine &&
current_rel->fdwroutine->GetForeignUpperPaths)
current_rel->fdwroutine->GetForeignUpperPaths(root, current_rel);
if (create_upper_paths_hook)
(*create_upper_paths_hook) (root, current_rel);