summaryrefslogtreecommitdiff
path: root/src/backend/utils/adt/ruleutils.c
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2000-09-25 18:14:55 +0000
committerTom Lane <tgl@sss.pgh.pa.us>2000-09-25 18:14:55 +0000
commit8bdc2bf030acae0bdac98c645a3c80f205e7e10a (patch)
tree4a006a48c92f0de9945eb38a2a0b05cdf49a9514 /src/backend/utils/adt/ruleutils.c
parent164caa3951a80d3e9f31f598460ee7582850c71b (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/utils/adt/ruleutils.c')
-rw-r--r--src/backend/utils/adt/ruleutils.c33
1 files changed, 1 insertions, 32 deletions
diff --git a/src/backend/utils/adt/ruleutils.c b/src/backend/utils/adt/ruleutils.c
index 45282fd94c8..2eaef859f48 100644
--- a/src/backend/utils/adt/ruleutils.c
+++ b/src/backend/utils/adt/ruleutils.c
@@ -3,7 +3,7 @@
* back to source text
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/utils/adt/ruleutils.c,v 1.62 2000/09/18 20:14:23 tgl Exp $
+ * $Header: /cvsroot/pgsql/src/backend/utils/adt/ruleutils.c,v 1.63 2000/09/25 18:14:54 tgl Exp $
*
* This software is copyrighted by Jan Wieck - Hamburg.
*
@@ -110,7 +110,6 @@ static bool tleIsArrayAssign(TargetEntry *tle);
static char *quote_identifier(char *ident);
static char *get_relation_name(Oid relid);
static char *get_relid_attribute_name(Oid relid, AttrNumber attnum);
-static char *get_rte_attribute_name(RangeTblEntry *rte, AttrNumber attnum);
#define only_marker(rte) ((rte)->inh ? "" : "ONLY ")
@@ -2020,33 +2019,3 @@ get_relid_attribute_name(Oid relid, AttrNumber attnum)
attnum, relid);
return attname;
}
-
-/* ----------
- * get_rte_attribute_name
- * Get an attribute name from a RangeTblEntry
- *
- * This is unlike get_relid_attribute_name() because we use aliases if
- * available.
- * ----------
- */
-static char *
-get_rte_attribute_name(RangeTblEntry *rte, AttrNumber attnum)
-{
- /*
- * If there is an alias, use it
- */
- if (attnum > 0 && attnum <= length(rte->eref->attrs))
- return strVal(nth(attnum-1, rte->eref->attrs));
- /*
- * Can get here for a system attribute (which never has an alias),
- * or if alias name list is too short (which probably can't happen
- * anymore). Neither of these cases is valid for a subselect RTE.
- */
- if (rte->relid == InvalidOid)
- elog(ERROR, "Invalid attnum %d for rangetable entry %s",
- attnum, rte->eref->relname);
- /*
- * Use the real name of the table's column
- */
- return get_relid_attribute_name(rte->relid, attnum);
-}