mirror of
https://github.com/postgres/postgres.git
synced 2025-06-17 17:02:08 +03:00
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.
This commit is contained in:
@ -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);
|
||||
}
|
||||
|
Reference in New Issue
Block a user