aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2024-05-06 14:22:45 -0400
committerTom Lane <tgl@sss.pgh.pa.us>2024-05-06 14:22:45 -0400
commit07746a8ef2a871d904c26364cdca4e7feeffe395 (patch)
tree5399b925676b07c5cd9b5e99e893a72d7d25ad46 /src
parent521a7156ab47623e299855dd04a2a4ea3ad71afe (diff)
downloadpostgresql-07746a8ef2a871d904c26364cdca4e7feeffe395.tar.gz
postgresql-07746a8ef2a871d904c26364cdca4e7feeffe395.zip
Finish incomplete revert of ec63622c0.
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.)
Diffstat (limited to 'src')
-rw-r--r--src/backend/optimizer/prep/prepunion.c9
1 files changed, 3 insertions, 6 deletions
diff --git a/src/backend/optimizer/prep/prepunion.c b/src/backend/optimizer/prep/prepunion.c
index 3f14e90a45b..30068c27a13 100644
--- a/src/backend/optimizer/prep/prepunion.c
+++ b/src/backend/optimizer/prep/prepunion.c
@@ -662,17 +662,14 @@ build_setop_child_paths(PlannerInfo *root, RelOptInfo *rel,
* otherwise do statistical estimation.
*
* XXX you don't really want to know about this: we do the estimation
- * using the subroot->parse's original targetlist expressions, not the
+ * using the subquery's original targetlist expressions, not the
* subroot->processed_tlist which might seem more appropriate. The reason
* is that if the subquery is itself a setop, it may return a
* processed_tlist containing "varno 0" Vars generated by
* generate_append_tlist, and those would confuse estimate_num_groups
* mightily. We ought to get rid of the "varno 0" hack, but that requires
* a redesign of the parsetree representation of setops, so that there can
- * be an RTE corresponding to each setop's output. Note, we use this not
- * subquery's targetlist but subroot->parse's targetlist, because it was
- * revised by self-join removal. subquery's targetlist might contain the
- * references to the removed relids.
+ * be an RTE corresponding to each setop's output.
*/
if (pNumGroups)
{
@@ -685,7 +682,7 @@ build_setop_child_paths(PlannerInfo *root, RelOptInfo *rel,
*pNumGroups = rel->cheapest_total_path->rows;
else
*pNumGroups = estimate_num_groups(subroot,
- get_tlist_exprs(subroot->parse->targetList, false),
+ get_tlist_exprs(subquery->targetList, false),
rel->cheapest_total_path->rows,
NULL,
NULL);