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/nodes/print.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'src/backend/nodes/print.c') diff --git a/src/backend/nodes/print.c b/src/backend/nodes/print.c index 7bf78e134bc..3f48cb0b9eb 100644 --- a/src/backend/nodes/print.c +++ b/src/backend/nodes/print.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/nodes/print.c,v 1.40 2000/09/12 21:06:49 tgl Exp $ + * $Header: /cvsroot/pgsql/src/backend/nodes/print.c,v 1.41 2000/09/25 18:14:55 tgl Exp $ * * HISTORY * AUTHOR DATE MAJOR EVENT @@ -172,11 +172,13 @@ print_expr(Node *expr, List *rtable) break; default: { - RangeTblEntry *rt; + RangeTblEntry *rte; - rt = rt_fetch(var->varno, rtable); - relname = rt->eref->relname; - attname = get_attname(rt->relid, var->varattno); + Assert(var->varno > 0 && + (int) var->varno <= length(rtable)); + rte = rt_fetch(var->varno, rtable); + relname = rte->eref->relname; + attname = get_rte_attribute_name(rte, var->varattno); } break; } -- cgit v1.2.3