aboutsummaryrefslogtreecommitdiff
path: root/src/backend/utils/adt/selfuncs.c
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2013-11-11 16:36:27 -0500
committerTom Lane <tgl@sss.pgh.pa.us>2013-11-11 16:36:27 -0500
commitebefbb5fdeba885bb57d2f2e1eb185a46c9d777d (patch)
tree595221ade65210cb309726a51b079ab65d2ccbe2 /src/backend/utils/adt/selfuncs.c
parent0b7e660d6c70f45e06f1b52f255116bcb44624eb (diff)
downloadpostgresql-ebefbb5fdeba885bb57d2f2e1eb185a46c9d777d.tar.gz
postgresql-ebefbb5fdeba885bb57d2f2e1eb185a46c9d777d.zip
Fix failure with whole-row reference to a subquery.
Simple oversight in commit 1cb108efb0e60d87e4adec38e7636b6e8efbeb57 --- recursively examining a subquery output column is only sane if the original Var refers to a single output column. Found by Kevin Grittner.
Diffstat (limited to 'src/backend/utils/adt/selfuncs.c')
-rw-r--r--src/backend/utils/adt/selfuncs.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/backend/utils/adt/selfuncs.c b/src/backend/utils/adt/selfuncs.c
index edfd8435aaa..5c30577cdfe 100644
--- a/src/backend/utils/adt/selfuncs.c
+++ b/src/backend/utils/adt/selfuncs.c
@@ -4506,6 +4506,12 @@ examine_simple_variable(PlannerInfo *root, Var *var,
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
* mash underlying columns' stats beyond recognition. (Set ops are
* particularly nasty; if we forged ahead, we would return stats