aboutsummaryrefslogtreecommitdiff
path: root/src/backend/parser/parse_agg.c
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2000-09-25 18:14:55 +0000
committerTom Lane <tgl@sss.pgh.pa.us>2000-09-25 18:14:55 +0000
commit8bdc2bf030acae0bdac98c645a3c80f205e7e10a (patch)
tree4a006a48c92f0de9945eb38a2a0b05cdf49a9514 /src/backend/parser/parse_agg.c
parent164caa3951a80d3e9f31f598460ee7582850c71b (diff)
downloadpostgresql-8bdc2bf030acae0bdac98c645a3c80f205e7e10a.tar.gz
postgresql-8bdc2bf030acae0bdac98c645a3c80f205e7e10a.zip
Use variable aliases, if supplied, rather than real column names in
complaints about ungrouped variables. This is for consistency with behavior elsewhere, notably the fact that the relname is reported as an alias in these same complaints. Also, it'll work with subselect- in-FROM where old code didn't.
Diffstat (limited to 'src/backend/parser/parse_agg.c')
-rw-r--r--src/backend/parser/parse_agg.c7
1 files changed, 2 insertions, 5 deletions
diff --git a/src/backend/parser/parse_agg.c b/src/backend/parser/parse_agg.c
index 955be022e4e..c3ac417365c 100644
--- a/src/backend/parser/parse_agg.c
+++ b/src/backend/parser/parse_agg.c
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/parser/parse_agg.c,v 1.40 2000/09/12 21:07:02 tgl Exp $
+ * $Header: /cvsroot/pgsql/src/backend/parser/parse_agg.c,v 1.41 2000/09/25 18:14:54 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -113,10 +113,7 @@ check_ungrouped_columns_walker(Node *node,
Assert(var->varno > 0 &&
(int) var->varno <= length(context->pstate->p_rtable));
rte = rt_fetch(var->varno, context->pstate->p_rtable);
- attname = get_attname(rte->relid, var->varattno);
- if (!attname)
- elog(ERROR, "cache lookup of attribute %d in relation %u failed",
- var->varattno, rte->relid);
+ attname = get_rte_attribute_name(rte, var->varattno);
elog(ERROR, "Attribute %s.%s must be GROUPed or used in an aggregate function",
rte->eref->relname, attname);
}