From 302f1a86dc1125f681b9a3b3509d1be7e33b0e4f Mon Sep 17 00:00:00 2001 From: Tom Lane Date: Mon, 11 Aug 2003 23:04:50 +0000 Subject: Rewriter and planner should use only resno, not resname, to identify target columns in INSERT and UPDATE targetlists. Don't rely on resname to be accurate in ruleutils, either. This fixes bug reported by Donald Fraser, in which renaming a column referenced in a rule did not work very well. --- src/backend/parser/parse_relation.c | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) (limited to 'src/backend/parser/parse_relation.c') diff --git a/src/backend/parser/parse_relation.c b/src/backend/parser/parse_relation.c index b8c2d8c8e36..ba1eea0475b 100644 --- a/src/backend/parser/parse_relation.c +++ b/src/backend/parser/parse_relation.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/parser/parse_relation.c,v 1.88 2003/08/11 20:46:46 tgl Exp $ + * $Header: /cvsroot/pgsql/src/backend/parser/parse_relation.c,v 1.89 2003/08/11 23:04:49 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -1516,8 +1516,6 @@ expandRelAttrs(ParseState *pstate, RangeTblEntry *rte) char * get_rte_attribute_name(RangeTblEntry *rte, AttrNumber attnum) { - char *attname; - if (attnum == InvalidAttrNumber) return "*"; @@ -1535,13 +1533,7 @@ get_rte_attribute_name(RangeTblEntry *rte, AttrNumber attnum) * built (which can easily happen for rules). */ if (rte->rtekind == RTE_RELATION) - { - attname = get_attname(rte->relid, attnum); - if (attname == NULL) - elog(ERROR, "cache lookup failed for attribute %d of relation %u", - attnum, rte->relid); - return attname; - } + return get_relid_attribute_name(rte->relid, attnum); /* * Otherwise use the column name from eref. There should always be -- cgit v1.2.3