aboutsummaryrefslogtreecommitdiff
path: root/src
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:44 -0500
commit449d5acd7d02fae0086ecfbbd45a13f28a40e795 (patch)
treed8f9ad2c0cf0e5088aec7f986ee0e9b41492956b /src
parentc6ec8793aa59d1842082e14b4b4aae7d4bd883fd (diff)
downloadpostgresql-449d5acd7d02fae0086ecfbbd45a13f28a40e795.tar.gz
postgresql-449d5acd7d02fae0086ecfbbd45a13f28a40e795.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')
-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 a5a9fa69ab6..84c27a95a91 100644
--- a/src/backend/utils/adt/selfuncs.c
+++ b/src/backend/utils/adt/selfuncs.c
@@ -4503,6 +4503,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