Save PathTargets for distinct/ordered relations in root->upper_targets[].

For the convenience of extensions, we previously only saved PathTargets
for grouped, window, and final relations in root->upper_targets[] in
grouping_planner().  To improve the convenience, save PathTargets for
distinct and ordered relations as well.

Author: Antonin Houska, with an additional change by me
Discussion: https://postgr.es/m/10994.1549559088@localhost
This commit is contained in:
Etsuro Fujita 2019-02-18 16:13:46 +09:00
parent a916bdc496
commit 3fdc374b5d
1 changed files with 2 additions and 0 deletions

View File

@ -2035,6 +2035,8 @@ grouping_planner(PlannerInfo *root, bool inheritance_update,
* of the corresponding upperrels might not be needed for this query.
*/
root->upper_targets[UPPERREL_FINAL] = final_target;
root->upper_targets[UPPERREL_ORDERED] = final_target;
root->upper_targets[UPPERREL_DISTINCT] = sort_input_target;
root->upper_targets[UPPERREL_WINDOW] = sort_input_target;
root->upper_targets[UPPERREL_GROUP_AGG] = grouping_target;