From 8bdc2bf030acae0bdac98c645a3c80f205e7e10a Mon Sep 17 00:00:00 2001 From: Tom Lane Date: Mon, 25 Sep 2000 18:14:55 +0000 Subject: 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. --- src/backend/parser/parse_agg.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) (limited to 'src/backend/parser/parse_agg.c') diff --git a/src/backend/parser/parse_agg.c b/src/backend/parser/parse_agg.c index 955be022e4..c3ac417365 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); } -- cgit v1.2.1