diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 2000-09-25 18:14:55 +0000 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 2000-09-25 18:14:55 +0000 |
commit | 8bdc2bf030acae0bdac98c645a3c80f205e7e10a (patch) | |
tree | 4a006a48c92f0de9945eb38a2a0b05cdf49a9514 /src/backend/nodes/print.c | |
parent | 164caa3951a80d3e9f31f598460ee7582850c71b (diff) |
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/nodes/print.c')
-rw-r--r-- | src/backend/nodes/print.c | 12 |
1 files changed, 7 insertions, 5 deletions
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; } |