Skip to content
Snippets Groups Projects
Commit 449d5acd authored by Tom Lane's avatar Tom Lane
Browse files

Fix failure with whole-row reference to a subquery.

Simple oversight in commit 1cb108ef ---
recursively examining a subquery output column is only sane if the
original Var refers to a single output column.  Found by Kevin Grittner.
parent c6ec8793
No related branches found
No related tags found
No related merge requests found
...@@ -4502,6 +4502,12 @@ examine_simple_variable(PlannerInfo *root, Var *var, ...@@ -4502,6 +4502,12 @@ examine_simple_variable(PlannerInfo *root, Var *var,
RelOptInfo *rel; RelOptInfo *rel;
TargetEntry *ste; TargetEntry *ste;
/*
* Punt if it's a whole-row var rather than a plain column reference.
*/
if (var->varattno == InvalidAttrNumber)
return;
/* /*
* Punt if subquery uses set operations or GROUP BY, as these will * Punt if subquery uses set operations or GROUP BY, as these will
* mash underlying columns' stats beyond recognition. (Set ops are * mash underlying columns' stats beyond recognition. (Set ops are
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment