Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 07746a8

Browse files
committed
Finish incomplete revert of ec63622.
The code change this made might well be fine to keep, but the comment justifying it by reference to self-join removal isn't. Let's just go back to the status quo ante, pending a more thorough review/redesign of SJE. (I found this by grepping to see if any references to self-join removal remained in the tree.)
1 parent 521a715 commit 07746a8

File tree

1 file changed

+3
-6
lines changed

1 file changed

+3
-6
lines changed

src/backend/optimizer/prep/prepunion.c

+3-6
Original file line numberDiff line numberDiff line change
@@ -662,17 +662,14 @@ build_setop_child_paths(PlannerInfo *root, RelOptInfo *rel,
662662
* otherwise do statistical estimation.
663663
*
664664
* XXX you don't really want to know about this: we do the estimation
665-
* using the subroot->parse's original targetlist expressions, not the
665+
* using the subquery's original targetlist expressions, not the
666666
* subroot->processed_tlist which might seem more appropriate. The reason
667667
* is that if the subquery is itself a setop, it may return a
668668
* processed_tlist containing "varno 0" Vars generated by
669669
* generate_append_tlist, and those would confuse estimate_num_groups
670670
* mightily. We ought to get rid of the "varno 0" hack, but that requires
671671
* a redesign of the parsetree representation of setops, so that there can
672-
* be an RTE corresponding to each setop's output. Note, we use this not
673-
* subquery's targetlist but subroot->parse's targetlist, because it was
674-
* revised by self-join removal. subquery's targetlist might contain the
675-
* references to the removed relids.
672+
* be an RTE corresponding to each setop's output.
676673
*/
677674
if (pNumGroups)
678675
{
@@ -685,7 +682,7 @@ build_setop_child_paths(PlannerInfo *root, RelOptInfo *rel,
685682
*pNumGroups = rel->cheapest_total_path->rows;
686683
else
687684
*pNumGroups = estimate_num_groups(subroot,
688-
get_tlist_exprs(subroot->parse->targetList, false),
685+
get_tlist_exprs(subquery->targetList, false),
689686
rel->cheapest_total_path->rows,
690687
NULL,
691688
NULL);

0 commit comments

Comments
 (0)