From 17467bb7fb760e003c43f046890486ce28c1af25 Mon Sep 17 00:00:00 2001
From: Bruce Momjian <bruce@momjian.us>
Date: Sun, 24 Jan 1999 00:28:37 +0000
Subject: [PATCH] Rename Aggreg to Aggref.

---
 src/backend/executor/execQual.c        |  12 +-
 src/backend/executor/nodeAgg.c         |  10 +-
 src/backend/nodes/copyfuncs.c          |  14 +-
 src/backend/nodes/outfuncs.c           |  10 +-
 src/backend/nodes/readfuncs.c          |  16 +-
 src/backend/optimizer/plan/setrefs.c   |  24 +--
 src/backend/optimizer/plan/subselect.c |  14 +-
 src/backend/optimizer/util/clauses.c   |   6 +-
 src/backend/optimizer/util/tlist.c     |   4 +-
 src/backend/optimizer/util/var.c       |   6 +-
 src/backend/parser/gram.c              |   2 +-
 src/backend/parser/parse_agg.c         |  28 +--
 src/backend/parser/parse_expr.c        |   6 +-
 src/backend/parser/parse_target.c      |   6 +-
 src/backend/rewrite/locks.c            |   6 +-
 src/backend/rewrite/rewriteHandler.c   | 228 ++++++++++++-------------
 src/backend/rewrite/rewriteManip.c     |  22 +--
 src/backend/utils/adt/ruleutils.c      |  10 +-
 src/include/nodes/nodes.h              |   4 +-
 src/include/nodes/primnodes.h          |   8 +-
 src/include/parser/parse_agg.h         |   6 +-
 21 files changed, 221 insertions(+), 221 deletions(-)

diff --git a/src/backend/executor/execQual.c b/src/backend/executor/execQual.c
index d751b2cb6e4..8bed5baf3b1 100644
--- a/src/backend/executor/execQual.c
+++ b/src/backend/executor/execQual.c
@@ -7,7 +7,7 @@
  *
  *
  * IDENTIFICATION
- *	  $Header: /cvsroot/pgsql/src/backend/executor/execQual.c,v 1.39 1998/12/04 15:33:19 thomas Exp $
+ *	  $Header: /cvsroot/pgsql/src/backend/executor/execQual.c,v 1.40 1999/01/24 00:28:18 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -67,7 +67,7 @@ bool		execConstByVal;
 int			execConstLen;
 
 /* static functions decls */
-static Datum ExecEvalAggreg(Aggreg *agg, ExprContext *econtext, bool *isNull);
+static Datum ExecEvalAggref(Aggref *agg, ExprContext *econtext, bool *isNull);
 static Datum ExecEvalArrayRef(ArrayRef *arrayRef, ExprContext *econtext,
 				 bool *isNull, bool *isDone);
 static Datum ExecEvalAnd(Expr *andExpr, ExprContext *econtext, bool *isNull);
@@ -185,14 +185,14 @@ ExecEvalArrayRef(ArrayRef *arrayRef,
 
 
 /* ----------------------------------------------------------------
- *		ExecEvalAggreg
+ *		ExecEvalAggref
  *
  *		Returns a Datum whose value is the value of the precomputed
  *		aggregate found in the given expression context.
  * ----------------------------------------------------------------
  */
 static Datum
-ExecEvalAggreg(Aggreg *agg, ExprContext *econtext, bool *isNull)
+ExecEvalAggref(Aggref *agg, ExprContext *econtext, bool *isNull)
 {
 	*isNull = econtext->ecxt_nulls[agg->aggno];
 	return econtext->ecxt_values[agg->aggno];
@@ -1268,8 +1268,8 @@ ExecEvalExpr(Node *expression,
 											isNull,
 											isDone);
 			break;
-		case T_Aggreg:
-			retDatum = (Datum) ExecEvalAggreg((Aggreg *) expression,
+		case T_Aggref:
+			retDatum = (Datum) ExecEvalAggref((Aggref *) expression,
 											  econtext,
 											  isNull);
 			break;
diff --git a/src/backend/executor/nodeAgg.c b/src/backend/executor/nodeAgg.c
index dbb86bb0f7d..a20ef4baa6f 100644
--- a/src/backend/executor/nodeAgg.c
+++ b/src/backend/executor/nodeAgg.c
@@ -45,7 +45,7 @@ typedef struct AggFuncInfo
 	FmgrInfo	finalfn;
 } AggFuncInfo;
 
-static Datum aggGetAttr(TupleTableSlot *tuple, Aggreg *agg, bool *isNull);
+static Datum aggGetAttr(TupleTableSlot *tuple, Aggref *agg, bool *isNull);
 
 
 /* ---------------------------------------
@@ -90,7 +90,7 @@ ExecAgg(Agg *node)
 {
 	AggState   *aggstate;
 	EState	   *estate;
-	Aggreg	  **aggregates;
+	Aggref	  **aggregates;
 	Plan	   *outerPlan;
 	int			i,
 				nagg;
@@ -133,7 +133,7 @@ ExecAgg(Agg *node)
 
 		nagg = length(node->aggs);
 
-		aggregates = (Aggreg **) palloc(sizeof(Aggreg *) * nagg);
+		aggregates = (Aggref **) palloc(sizeof(Aggref *) * nagg);
 
 		/* take List* and make it an array that can be quickly indexed */
 		alist = node->aggs;
@@ -163,7 +163,7 @@ ExecAgg(Agg *node)
 
 		for (i = 0; i < nagg; i++)
 		{
-			Aggreg	   *agg;
+			Aggref	   *agg;
 			char	   *aggname;
 			HeapTuple	aggTuple;
 			Form_pg_aggregate aggp;
@@ -628,7 +628,7 @@ ExecEndAgg(Agg *node)
  */
 static Datum
 aggGetAttr(TupleTableSlot *slot,
-		   Aggreg *agg,
+		   Aggref *agg,
 		   bool *isNull)
 {
 	Datum		result;
diff --git a/src/backend/nodes/copyfuncs.c b/src/backend/nodes/copyfuncs.c
index 46776ae5e06..94b788882d2 100644
--- a/src/backend/nodes/copyfuncs.c
+++ b/src/backend/nodes/copyfuncs.c
@@ -7,7 +7,7 @@
  *
  *
  * IDENTIFICATION
- *	  $Header: /cvsroot/pgsql/src/backend/nodes/copyfuncs.c,v 1.53 1999/01/21 22:55:41 momjian Exp $
+ *	  $Header: /cvsroot/pgsql/src/backend/nodes/copyfuncs.c,v 1.54 1999/01/24 00:28:19 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -899,13 +899,13 @@ _copyFunc(Func *from)
 }
 
 /* ----------------
- *		_copyAggreg
+ *		_copyAggref
  * ----------------
  */
-static Aggreg *
-_copyAggreg(Aggreg *from)
+static Aggref *
+_copyAggref(Aggref *from)
 {
-	Aggreg	   *newnode = makeNode(Aggreg);
+	Aggref	   *newnode = makeNode(Aggref);
 
 	/* ----------------
 	 *	copy remainder of node
@@ -1782,8 +1782,8 @@ copyObject(void *from)
 		case T_ArrayRef:
 			retval = _copyArrayRef(from);
 			break;
-		case T_Aggreg:
-			retval = _copyAggreg(from);
+		case T_Aggref:
+			retval = _copyAggref(from);
 			break;
 		case T_SubLink:
 			retval = _copySubLink(from);
diff --git a/src/backend/nodes/outfuncs.c b/src/backend/nodes/outfuncs.c
index aa9c01ed082..eac479a880d 100644
--- a/src/backend/nodes/outfuncs.c
+++ b/src/backend/nodes/outfuncs.c
@@ -5,7 +5,7 @@
  *
  * Copyright (c) 1994, Regents of the University of California
  *
- *  $Id: outfuncs.c,v 1.60 1999/01/21 16:08:36 vadim Exp $
+ *  $Id: outfuncs.c,v 1.61 1999/01/24 00:28:20 momjian Exp $
  *
  * NOTES
  *	  Every (plan) node in POSTGRES has an associated "out" routine which
@@ -686,10 +686,10 @@ _outConst(StringInfo str, Const *node)
 }
 
 /*
- *	Aggreg
+ *	Aggref
  */
 static void
-_outAggreg(StringInfo str, Aggreg *node)
+_outAggref(StringInfo str, Aggref *node)
 {
 	appendStringInfo(str, 
 			" AGGREG :aggname %s :basetype %u :aggtype %u :target ",
@@ -1506,8 +1506,8 @@ _outNode(StringInfo str, void *obj)
 			case T_Const:
 				_outConst(str, obj);
 				break;
-			case T_Aggreg:
-				_outAggreg(str, obj);
+			case T_Aggref:
+				_outAggref(str, obj);
 				break;
 			case T_SubLink:
 				_outSubLink(str, obj);
diff --git a/src/backend/nodes/readfuncs.c b/src/backend/nodes/readfuncs.c
index 6a4237def2f..3bc67693894 100644
--- a/src/backend/nodes/readfuncs.c
+++ b/src/backend/nodes/readfuncs.c
@@ -7,7 +7,7 @@
  *
  *
  * IDENTIFICATION
- *	  $Header: /cvsroot/pgsql/src/backend/nodes/readfuncs.c,v 1.42 1999/01/21 16:08:37 vadim Exp $
+ *	  $Header: /cvsroot/pgsql/src/backend/nodes/readfuncs.c,v 1.43 1999/01/24 00:28:20 momjian Exp $
  *
  * NOTES
  *	  Most of the read functions for plan nodes are tested. (In fact, they
@@ -1161,19 +1161,19 @@ _readParam()
 }
 
 /* ----------------
- *		_readAggreg
+ *		_readAggref
  *
- *	Aggreg is a subclass of Node
+ *	Aggref is a subclass of Node
  * ----------------
  */
-static Aggreg *
-_readAggreg()
+static Aggref *
+_readAggref()
 {
-	Aggreg	   *local_node;
+	Aggref	   *local_node;
 	char	   *token;
 	int			length;
 
-	local_node = makeNode(Aggreg);
+	local_node = makeNode(Aggref);
 
 	token = lsptok(NULL, &length);		/* eat :aggname */
 	token = lsptok(NULL, &length);		/* get aggname */
@@ -2040,7 +2040,7 @@ parsePlanString(void)
 	else if (!strncmp(token, "SORT", length))
 		return_value = _readSort();
 	else if (!strncmp(token, "AGGREG", length))
-		return_value = _readAggreg();
+		return_value = _readAggref();
 	else if (!strncmp(token, "SUBLINK", length))
 		return_value = _readSubLink();
 	else if (!strncmp(token, "AGG", length))
diff --git a/src/backend/optimizer/plan/setrefs.c b/src/backend/optimizer/plan/setrefs.c
index dd8b70a6cb7..f6a87e2883a 100644
--- a/src/backend/optimizer/plan/setrefs.c
+++ b/src/backend/optimizer/plan/setrefs.c
@@ -7,7 +7,7 @@
  *
  *
  * IDENTIFICATION
- *	  $Header: /cvsroot/pgsql/src/backend/optimizer/plan/setrefs.c,v 1.31 1999/01/23 23:28:08 momjian Exp $
+ *	  $Header: /cvsroot/pgsql/src/backend/optimizer/plan/setrefs.c,v 1.32 1999/01/24 00:28:20 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -611,8 +611,8 @@ replace_result_clause(Node *clause,
 		((Var *) clause)->varno = (Index) OUTER;
 		((Var *) clause)->varattno = subplanVar->resdom->resno;
 	}
-	else if (IsA(clause, Aggreg))
-		replace_result_clause(((Aggreg *) clause)->target, subplanTargetList);
+	else if (IsA(clause, Aggref))
+		replace_result_clause(((Aggref *) clause)->target, subplanTargetList);
 	else if (is_funcclause(clause))
 	{
 		List	   *subExpr;
@@ -704,7 +704,7 @@ OperandIsInner(Node *opnd, int inner_relid)
  *	  changes the target list of an Agg node so that it points to
  *	  the tuples returned by its left tree subplan.
  *
- *	We now also generate a linked list of Aggreg pointers for Agg.
+ *	We now also generate a linked list of Aggref pointers for Agg.
  *
  */
 List *
@@ -765,10 +765,10 @@ replace_agg_clause(Node *clause, List *subplanTargetList)
 		}
 		return agg_list;
 	}
-	else if (IsA(clause, Aggreg))
+	else if (IsA(clause, Aggref))
 	{
 		return lcons(clause,
-					 replace_agg_clause(((Aggreg *) clause)->target, subplanTargetList));
+					 replace_agg_clause(((Aggref *) clause)->target, subplanTargetList));
 	}
 	else if (IsA(clause, ArrayRef))
 	{
@@ -866,11 +866,11 @@ del_agg_clause(Node *clause)
 		foreach(t, ((Expr *) clause)->args)
 			lfirst(t) = del_agg_clause(lfirst(t));
 	}
-	else if (IsA(clause, Aggreg))
+	else if (IsA(clause, Aggref))
 	{
 
 		/* here is the real action, to remove the Agg node */
-		return del_agg_clause(((Aggreg *) clause)->target);
+		return del_agg_clause(((Aggref *) clause)->target);
 
 	}
 	else if (IsA(clause, ArrayRef))
@@ -967,10 +967,10 @@ check_having_qual_for_vars(Node *clause, List *targetlist_so_far)
 	}
       return targetlist_so_far;
     }
-  else if (IsA(clause, Aggreg))
+  else if (IsA(clause, Aggref))
     {
 	  targetlist_so_far = 
-	    check_having_qual_for_vars(((Aggreg *) clause)->target, targetlist_so_far);
+	    check_having_qual_for_vars(((Aggref *) clause)->target, targetlist_so_far);
 	  return targetlist_so_far;
     }
   else if (IsA(clause, ArrayRef))
@@ -1100,10 +1100,10 @@ check_having_qual_for_aggs(Node *clause, List *subplanTargetList, List *groupCla
 		}
 		return agg_list;
 	}
-	else if (IsA(clause, Aggreg))
+	else if (IsA(clause, Aggref))
 	{
 		return lcons(clause,
-		    check_having_qual_for_aggs(((Aggreg *) clause)->target, subplanTargetList,
+		    check_having_qual_for_aggs(((Aggref *) clause)->target, subplanTargetList,
 					       groupClause));		
 	}
 	else if (IsA(clause, ArrayRef))
diff --git a/src/backend/optimizer/plan/subselect.c b/src/backend/optimizer/plan/subselect.c
index b16203d9f7b..9529f481d57 100644
--- a/src/backend/optimizer/plan/subselect.c
+++ b/src/backend/optimizer/plan/subselect.c
@@ -282,8 +282,8 @@ _finalize_primnode(void *expr, List **subplan)
 	else if (or_clause(expr) || and_clause(expr) || is_opclause(expr) ||
 			 not_clause(expr) || is_funcclause(expr))
 		return _finalize_primnode(((Expr *) expr)->args, subplan);
-	else if (IsA(expr, Aggreg))
-		return _finalize_primnode(((Aggreg *) expr)->target, subplan);
+	else if (IsA(expr, Aggref))
+		return _finalize_primnode(((Aggref *) expr)->target, subplan);
 	else if (IsA(expr, ArrayRef))
 	{
 		result = _finalize_primnode(((ArrayRef *) expr)->refupperindexpr, subplan);
@@ -349,9 +349,9 @@ SS_replace_correlation_vars(Node *expr)
 			 not_clause(expr) || is_funcclause(expr))
 		((Expr *) expr)->args = (List *)
 			SS_replace_correlation_vars((Node *) ((Expr *) expr)->args);
-	else if (IsA(expr, Aggreg))
-		((Aggreg *) expr)->target =
-			SS_replace_correlation_vars((Node *) ((Aggreg *) expr)->target);
+	else if (IsA(expr, Aggref))
+		((Aggref *) expr)->target =
+			SS_replace_correlation_vars((Node *) ((Aggref *) expr)->target);
 	else if (IsA(expr, ArrayRef))
 	{
 		((ArrayRef *) expr)->refupperindexpr = (List *)
@@ -530,8 +530,8 @@ SS_pull_subplan(void *expr)
 	else if (or_clause(expr) || and_clause(expr) || is_opclause(expr) ||
 			 not_clause(expr) || is_funcclause(expr))
 		return SS_pull_subplan(((Expr *) expr)->args);
-	else if (IsA(expr, Aggreg))
-		return SS_pull_subplan(((Aggreg *) expr)->target);
+	else if (IsA(expr, Aggref))
+		return SS_pull_subplan(((Aggref *) expr)->target);
 	else if (IsA(expr, ArrayRef))
 	{
 		result = SS_pull_subplan(((ArrayRef *) expr)->refupperindexpr);
diff --git a/src/backend/optimizer/util/clauses.c b/src/backend/optimizer/util/clauses.c
index dfacc55518f..6fc00c65cf4 100644
--- a/src/backend/optimizer/util/clauses.c
+++ b/src/backend/optimizer/util/clauses.c
@@ -7,7 +7,7 @@
  *
  *
  * IDENTIFICATION
- *	  $Header: /cvsroot/pgsql/src/backend/optimizer/util/clauses.c,v 1.26 1998/12/04 15:34:14 thomas Exp $
+ *	  $Header: /cvsroot/pgsql/src/backend/optimizer/util/clauses.c,v 1.27 1999/01/24 00:28:21 momjian Exp $
  *
  * HISTORY
  *	  AUTHOR			DATE			MAJOR EVENT
@@ -145,7 +145,7 @@ static bool
 agg_clause(Node *clause)
 {
 	return
-	(clause != NULL && nodeTag(clause) == T_Aggreg);
+	(clause != NULL && nodeTag(clause) == T_Aggref);
 }
 
 /*****************************************************************************
@@ -548,7 +548,7 @@ fix_opid(Node *clause)
 		fix_opid((Node *) get_rightop((Expr *) clause));
 	}
 	else if (agg_clause(clause))
-		fix_opid(((Aggreg *) clause)->target);
+		fix_opid(((Aggref *) clause)->target);
 	else if (is_subplan(clause) &&
 			 ((SubPlan *) ((Expr *) clause)->oper)->sublink->subLinkType != EXISTS_SUBLINK)
 	{
diff --git a/src/backend/optimizer/util/tlist.c b/src/backend/optimizer/util/tlist.c
index 66c52404ec5..db3281dfa37 100644
--- a/src/backend/optimizer/util/tlist.c
+++ b/src/backend/optimizer/util/tlist.c
@@ -7,7 +7,7 @@
  *
  *
  * IDENTIFICATION
- *	  $Header: /cvsroot/pgsql/src/backend/optimizer/util/tlist.c,v 1.21 1998/12/04 15:34:15 thomas Exp $
+ *	  $Header: /cvsroot/pgsql/src/backend/optimizer/util/tlist.c,v 1.22 1999/01/24 00:28:22 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -483,7 +483,7 @@ flatten_tlistentry(Node *tlistentry, List *flat_tlist)
 
 		return ((Node *) make_funcclause((Func *) expr->oper, temp_result));
 	}
-	else if (IsA(tlistentry, Aggreg))
+	else if (IsA(tlistentry, Aggref))
 	{
 		return tlistentry;
 	}
diff --git a/src/backend/optimizer/util/var.c b/src/backend/optimizer/util/var.c
index 3dade59a5ca..462fd9e7df6 100644
--- a/src/backend/optimizer/util/var.c
+++ b/src/backend/optimizer/util/var.c
@@ -7,7 +7,7 @@
  *
  *
  * IDENTIFICATION
- *	  $Header: /cvsroot/pgsql/src/backend/optimizer/util/var.c,v 1.14 1998/12/04 15:34:15 thomas Exp $
+ *	  $Header: /cvsroot/pgsql/src/backend/optimizer/util/var.c,v 1.15 1999/01/24 00:28:22 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -194,8 +194,8 @@ pull_var_clause(Node *clause)
 			retval = nconc(retval,
 				 pull_var_clause(lfirst(((Expr *) lfirst(temp))->args)));
 	}
-	else if (IsA(clause, Aggreg))
-		retval = pull_var_clause(((Aggreg *) clause)->target);
+	else if (IsA(clause, Aggref))
+		retval = pull_var_clause(((Aggref *) clause)->target);
 	else if (IsA(clause, ArrayRef))
 	{
 		List	   *temp;
diff --git a/src/backend/parser/gram.c b/src/backend/parser/gram.c
index 311f113f0a3..66dffb71a26 100644
--- a/src/backend/parser/gram.c
+++ b/src/backend/parser/gram.c
@@ -239,7 +239,7 @@
  *
  *
  * IDENTIFICATION
- *	  $Header: /cvsroot/pgsql/src/backend/parser/Attic/gram.c,v 2.61 1999/01/22 19:35:49 momjian Exp $
+ *	  $Header: /cvsroot/pgsql/src/backend/parser/Attic/gram.c,v 2.62 1999/01/24 00:28:23 momjian Exp $
  *
  * HISTORY
  *	  AUTHOR			DATE			MAJOR EVENT
diff --git a/src/backend/parser/parse_agg.c b/src/backend/parser/parse_agg.c
index 8aa94041322..2e810927dc5 100644
--- a/src/backend/parser/parse_agg.c
+++ b/src/backend/parser/parse_agg.c
@@ -7,7 +7,7 @@
  *
  *
  * IDENTIFICATION
- *	  $Header: /cvsroot/pgsql/src/backend/parser/parse_agg.c,v 1.15 1998/12/08 06:18:56 thomas Exp $
+ *	  $Header: /cvsroot/pgsql/src/backend/parser/parse_agg.c,v 1.16 1999/01/24 00:28:29 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -37,7 +37,7 @@ static bool tleIsAggOrGroupCol(TargetEntry *tle, List *groupClause);
 
 /*
  * contain_agg_clause--
- *	  Recursively find aggreg nodes from a clause.
+ *	  Recursively find aggref nodes from a clause.
  *
  *	  Returns true if any aggregate found.
  */
@@ -46,7 +46,7 @@ contain_agg_clause(Node *clause)
 {
 	if (clause == NULL)
 		return FALSE;
-	else if (IsA(clause, Aggreg))
+	else if (IsA(clause, Aggref))
 		return TRUE;
 	else if (IsA(clause, Iter))
 		return contain_agg_clause(((Iter *) clause)->iterexpr);
@@ -105,7 +105,7 @@ exprIsAggOrGroupCol(Node *expr, List *groupClause)
 	List	   *gl;
 
 	if (expr == NULL || IsA(expr, Const) ||
-		IsA(expr, Param) || IsA(expr, Aggreg) || 
+		IsA(expr, Param) || IsA(expr, Aggref) || 
 		IsA(expr, SubLink))		/* can't handle currently !!! */
 		return TRUE;
 
@@ -155,7 +155,7 @@ tleIsAggOrGroupCol(TargetEntry *tle, List *groupClause)
 		}
 	}
 
-	if (IsA(expr, Aggreg))
+	if (IsA(expr, Aggref))
 		return TRUE;
 
 	if (IsA(expr, Expr))
@@ -217,7 +217,7 @@ parseCheckAggregates(ParseState *pstate, Query *qry)
 }
 
 
-Aggreg *
+Aggref *
 ParseAgg(ParseState *pstate, char *aggname, Oid basetype,
 		 List *target, int precedence)
 {
@@ -225,7 +225,7 @@ ParseAgg(ParseState *pstate, char *aggname, Oid basetype,
 	Oid			vartype;
 	Oid			xfn1;
 	Form_pg_aggregate aggform;
-	Aggreg	   *aggreg;
+	Aggref	   *aggref;
 	HeapTuple	theAggTuple;
 	bool		usenulls = false;
 
@@ -324,18 +324,18 @@ ParseAgg(ParseState *pstate, char *aggname, Oid basetype,
 		}
 	}
 
-	aggreg = makeNode(Aggreg);
-	aggreg->aggname = pstrdup(aggname);
-	aggreg->basetype = aggform->aggbasetype;
-	aggreg->aggtype = fintype;
+	aggref = makeNode(Aggref);
+	aggref->aggname = pstrdup(aggname);
+	aggref->basetype = aggform->aggbasetype;
+	aggref->aggtype = fintype;
 
-	aggreg->target = lfirst(target);
+	aggref->target = lfirst(target);
 	if (usenulls)
-		aggreg->usenulls = true;
+		aggref->usenulls = true;
 
 	pstate->p_hasAggs = true;
 
-	return aggreg;
+	return aggref;
 }
 
 /*
diff --git a/src/backend/parser/parse_expr.c b/src/backend/parser/parse_expr.c
index acdf2d7d03d..894ab9b4984 100644
--- a/src/backend/parser/parse_expr.c
+++ b/src/backend/parser/parse_expr.c
@@ -7,7 +7,7 @@
  *
  *
  * IDENTIFICATION
- *	  $Header: /cvsroot/pgsql/src/backend/parser/parse_expr.c,v 1.38 1998/12/13 23:56:43 thomas Exp $
+ *	  $Header: /cvsroot/pgsql/src/backend/parser/parse_expr.c,v 1.39 1999/01/24 00:28:29 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -586,8 +586,8 @@ exprType(Node *expr)
 		case T_ArrayRef:
 			type = ((ArrayRef *) expr)->refelemtype;
 			break;
-		case T_Aggreg:
-			type = ((Aggreg *) expr)->aggtype;
+		case T_Aggref:
+			type = ((Aggref *) expr)->aggtype;
 			break;
 		case T_Param:
 			type = ((Param *) expr)->paramtype;
diff --git a/src/backend/parser/parse_target.c b/src/backend/parser/parse_target.c
index 35d0db803a2..c400ef89bc4 100644
--- a/src/backend/parser/parse_target.c
+++ b/src/backend/parser/parse_target.c
@@ -7,7 +7,7 @@
  *
  *
  * IDENTIFICATION
- *	  $Header: /cvsroot/pgsql/src/backend/parser/parse_target.c,v 1.32 1998/12/13 23:56:44 thomas Exp $
+ *	  $Header: /cvsroot/pgsql/src/backend/parser/parse_target.c,v 1.33 1999/01/24 00:28:30 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -872,8 +872,8 @@ FigureColname(Node *expr, Node *resval)
 {
 	switch (nodeTag(expr))
 	{
-		case T_Aggreg:
-			return (char *) ((Aggreg *) expr)->aggname;
+		case T_Aggref:
+			return (char *) ((Aggref *) expr)->aggname;
 		case T_Expr:
 			if (((Expr *) expr)->opType == FUNC_EXPR)
 			{
diff --git a/src/backend/rewrite/locks.c b/src/backend/rewrite/locks.c
index 5c9b0887a1a..fe6cf9cc3a0 100644
--- a/src/backend/rewrite/locks.c
+++ b/src/backend/rewrite/locks.c
@@ -6,7 +6,7 @@
  *
  *
  * IDENTIFICATION
- *	  $Header: /cvsroot/pgsql/src/backend/rewrite/Attic/locks.c,v 1.14 1998/10/02 16:27:45 momjian Exp $
+ *	  $Header: /cvsroot/pgsql/src/backend/rewrite/Attic/locks.c,v 1.15 1999/01/24 00:28:30 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -66,9 +66,9 @@ nodeThisLockWasTriggered(Node *node, int varno, AttrNumber attnum,
 												sublevels_up);
 			}
 			break;
-		case T_Aggreg:
+		case T_Aggref:
 			{
-				Aggreg	   *agg = (Aggreg *) node;
+				Aggref	   *agg = (Aggref *) node;
 
 				return nodeThisLockWasTriggered(agg->target, varno, attnum,
 												sublevels_up);
diff --git a/src/backend/rewrite/rewriteHandler.c b/src/backend/rewrite/rewriteHandler.c
index 415f94df6d7..4430f9d07fa 100644
--- a/src/backend/rewrite/rewriteHandler.c
+++ b/src/backend/rewrite/rewriteHandler.c
@@ -6,7 +6,7 @@
  *
  *
  * IDENTIFICATION
- *	  $Header: /cvsroot/pgsql/src/backend/rewrite/rewriteHandler.c,v 1.29 1999/01/21 16:08:48 vadim Exp $
+ *	  $Header: /cvsroot/pgsql/src/backend/rewrite/rewriteHandler.c,v 1.30 1999/01/24 00:28:30 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -54,11 +54,11 @@ static RewriteInfo *gatherRewriteMeta(Query *parsetree,
 				  bool *instead_flag);
 static bool rangeTableEntry_used(Node *node, int rt_index, int sublevels_up);
 static bool attribute_used(Node *node, int rt_index, int attno, int sublevels_up);
-static void modifyAggregUplevel(Node *node);
-static void modifyAggregChangeVarnodes(Node **nodePtr, int rt_index, int new_index, int sublevels_up);
-static void modifyAggregDropQual(Node **nodePtr, Node *orignode, Expr *expr);
-static SubLink *modifyAggregMakeSublink(Expr *origexp, Query *parsetree);
-static void modifyAggregQual(Node **nodePtr, Query *parsetree);
+static void modifyAggrefUplevel(Node *node);
+static void modifyAggrefChangeVarnodes(Node **nodePtr, int rt_index, int new_index, int sublevels_up);
+static void modifyAggrefDropQual(Node **nodePtr, Node *orignode, Expr *expr);
+static SubLink *modifyAggrefMakeSublink(Expr *origexp, Query *parsetree);
+static void modifyAggrefQual(Node **nodePtr, Query *parsetree);
 
 
 static Query *fireRIRrules(Query *parsetree);
@@ -160,9 +160,9 @@ rangeTableEntry_used(Node *node, int rt_index, int sublevels_up)
 			}
 			break;
 
-		case T_Aggreg:
+		case T_Aggref:
 			{
-				Aggreg	*agg = (Aggreg *)node;
+				Aggref	*agg = (Aggref *)node;
 
 				return rangeTableEntry_used(
 						(Node *)(agg->target),
@@ -396,9 +396,9 @@ attribute_used(Node *node, int rt_index, int attno, int sublevels_up)
 			}
 			break;
 
-		case T_Aggreg:
+		case T_Aggref:
 			{
-				Aggreg	*agg = (Aggreg *)node;
+				Aggref	*agg = (Aggref *)node;
 
 				return attribute_used(
 						(Node *)(agg->target),
@@ -584,13 +584,13 @@ attribute_used(Node *node, int rt_index, int attno, int sublevels_up)
 
 
 /*
- * modifyAggregUplevel -
+ * modifyAggrefUplevel -
  *	In the newly created sublink for an aggregate column used in
  *	the qualification, we must adjust the varlevelsup in all the
  *	var nodes.
  */
 static void
-modifyAggregUplevel(Node *node)
+modifyAggrefUplevel(Node *node)
 {
 	if (node == NULL)
 		return;
@@ -600,16 +600,16 @@ modifyAggregUplevel(Node *node)
 			{
 				TargetEntry	*tle = (TargetEntry *)node;
 
-				modifyAggregUplevel(
+				modifyAggrefUplevel(
 						(Node *)(tle->expr));
 			}
 			break;
 
-		case T_Aggreg:
+		case T_Aggref:
 			{
-				Aggreg	*agg = (Aggreg *)node;
+				Aggref	*agg = (Aggref *)node;
 
-				modifyAggregUplevel(
+				modifyAggrefUplevel(
 						(Node *)(agg->target));
 			}
 			break;
@@ -618,7 +618,7 @@ modifyAggregUplevel(Node *node)
 			{
 				Expr	*exp = (Expr *)node;
 
-				modifyAggregUplevel(
+				modifyAggrefUplevel(
 						(Node *)(exp->args));
 			}
 			break;
@@ -627,7 +627,7 @@ modifyAggregUplevel(Node *node)
 			{
 				Iter	*iter = (Iter *)node;
 
-				modifyAggregUplevel(
+				modifyAggrefUplevel(
 						(Node *)(iter->iterexpr));
 			}
 			break;
@@ -636,13 +636,13 @@ modifyAggregUplevel(Node *node)
 			{
 				ArrayRef	*ref = (ArrayRef *)node;
 
-				modifyAggregUplevel(
+				modifyAggrefUplevel(
 						(Node *)(ref->refupperindexpr));
-				modifyAggregUplevel(
+				modifyAggrefUplevel(
 						(Node *)(ref->reflowerindexpr));
-				modifyAggregUplevel(
+				modifyAggrefUplevel(
 						(Node *)(ref->refexpr));
-				modifyAggregUplevel(
+				modifyAggrefUplevel(
 						(Node *)(ref->refassgnexpr));
 			}
 			break;
@@ -666,7 +666,7 @@ modifyAggregUplevel(Node *node)
 				List	*l;
 
 				foreach (l, (List *)node)
-					modifyAggregUplevel(
+					modifyAggrefUplevel(
 							(Node *)lfirst(l));
 			}
 			break;
@@ -675,13 +675,13 @@ modifyAggregUplevel(Node *node)
 			{
 				SubLink	*sub = (SubLink *)node;
 
-				modifyAggregUplevel(
+				modifyAggrefUplevel(
 						(Node *)(sub->lefthand));
 
-				modifyAggregUplevel(
+				modifyAggrefUplevel(
 						(Node *)(sub->oper));
 
-				modifyAggregUplevel(
+				modifyAggrefUplevel(
 						(Node *)(sub->subselect));
 			}
 			break;
@@ -690,22 +690,22 @@ modifyAggregUplevel(Node *node)
 			{
 				Query	*qry = (Query *)node;
 
-				modifyAggregUplevel(
+				modifyAggrefUplevel(
 						(Node *)(qry->targetList));
 
-				modifyAggregUplevel(
+				modifyAggrefUplevel(
 						(Node *)(qry->qual));
 
-				modifyAggregUplevel(
+				modifyAggrefUplevel(
 						(Node *)(qry->havingQual));
 
-				modifyAggregUplevel(
+				modifyAggrefUplevel(
 						(Node *)(qry->groupClause));
 			}
 			break;
 
 		default:
-			elog(NOTICE, "unknown node tag %d in modifyAggregUplevel()", nodeTag(node));
+			elog(NOTICE, "unknown node tag %d in modifyAggrefUplevel()", nodeTag(node));
 			elog(NOTICE, "Node is: %s", nodeToString(node));
 			break;
 
@@ -715,13 +715,13 @@ modifyAggregUplevel(Node *node)
 
 
 /*
- * modifyAggregChangeVarnodes -
+ * modifyAggrefChangeVarnodes -
  *	Change the var nodes in a sublink created for an aggregate column
  *	used in the qualification that is subject of the aggregate
  *	function to point to the correct local RTE.
  */
 static void
-modifyAggregChangeVarnodes(Node **nodePtr, int rt_index, int new_index, int sublevels_up)
+modifyAggrefChangeVarnodes(Node **nodePtr, int rt_index, int new_index, int sublevels_up)
 {
 	Node	*node = *nodePtr;
 
@@ -733,7 +733,7 @@ modifyAggregChangeVarnodes(Node **nodePtr, int rt_index, int new_index, int subl
 			{
 				TargetEntry	*tle = (TargetEntry *)node;
 
-				modifyAggregChangeVarnodes(
+				modifyAggrefChangeVarnodes(
 						(Node **)(&(tle->expr)),
 						rt_index,
 						new_index,
@@ -741,11 +741,11 @@ modifyAggregChangeVarnodes(Node **nodePtr, int rt_index, int new_index, int subl
 			}
 			break;
 
-		case T_Aggreg:
+		case T_Aggref:
 			{
-				Aggreg	*agg = (Aggreg *)node;
+				Aggref	*agg = (Aggref *)node;
 
-				modifyAggregChangeVarnodes(
+				modifyAggrefChangeVarnodes(
 						(Node **)(&(agg->target)),
 						rt_index,
 						new_index,
@@ -757,7 +757,7 @@ modifyAggregChangeVarnodes(Node **nodePtr, int rt_index, int new_index, int subl
 			{
 				GroupClause	*grp = (GroupClause *)node;
 
-				modifyAggregChangeVarnodes(
+				modifyAggrefChangeVarnodes(
 						(Node **)(&(grp->entry)),
 						rt_index,
 						new_index,
@@ -769,7 +769,7 @@ modifyAggregChangeVarnodes(Node **nodePtr, int rt_index, int new_index, int subl
 			{
 				Expr	*exp = (Expr *)node;
 
-				modifyAggregChangeVarnodes(
+				modifyAggrefChangeVarnodes(
 						(Node **)(&(exp->args)),
 						rt_index,
 						new_index,
@@ -781,7 +781,7 @@ modifyAggregChangeVarnodes(Node **nodePtr, int rt_index, int new_index, int subl
 			{
 				Iter	*iter = (Iter *)node;
 
-				modifyAggregChangeVarnodes(
+				modifyAggrefChangeVarnodes(
 						(Node **)(&(iter->iterexpr)),
 						rt_index,
 						new_index,
@@ -793,22 +793,22 @@ modifyAggregChangeVarnodes(Node **nodePtr, int rt_index, int new_index, int subl
 			{
 				ArrayRef	*ref = (ArrayRef *)node;
 
-				modifyAggregChangeVarnodes(
+				modifyAggrefChangeVarnodes(
 						(Node **)(&(ref->refupperindexpr)),
 						rt_index,
 						new_index,
 						sublevels_up);
-				modifyAggregChangeVarnodes(
+				modifyAggrefChangeVarnodes(
 						(Node **)(&(ref->reflowerindexpr)),
 						rt_index,
 						new_index,
 						sublevels_up);
-				modifyAggregChangeVarnodes(
+				modifyAggrefChangeVarnodes(
 						(Node **)(&(ref->refexpr)),
 						rt_index,
 						new_index,
 						sublevels_up);
-				modifyAggregChangeVarnodes(
+				modifyAggrefChangeVarnodes(
 						(Node **)(&(ref->refassgnexpr)),
 						rt_index,
 						new_index,
@@ -843,7 +843,7 @@ modifyAggregChangeVarnodes(Node **nodePtr, int rt_index, int new_index, int subl
 				List	*l;
 
 				foreach (l, (List *)node)
-					modifyAggregChangeVarnodes(
+					modifyAggrefChangeVarnodes(
 							(Node **)(&lfirst(l)),
 							rt_index,
 							new_index,
@@ -855,19 +855,19 @@ modifyAggregChangeVarnodes(Node **nodePtr, int rt_index, int new_index, int subl
 			{
 				SubLink	*sub = (SubLink *)node;
 
-				modifyAggregChangeVarnodes(
+				modifyAggrefChangeVarnodes(
 						(Node **)(&(sub->lefthand)),
 						rt_index,
 						new_index,
 						sublevels_up);
 
-				modifyAggregChangeVarnodes(
+				modifyAggrefChangeVarnodes(
 						(Node **)(&(sub->oper)),
 						rt_index,
 						new_index,
 						sublevels_up);
 
-				modifyAggregChangeVarnodes(
+				modifyAggrefChangeVarnodes(
 						(Node **)(&(sub->subselect)),
 						rt_index,
 						new_index,
@@ -879,25 +879,25 @@ modifyAggregChangeVarnodes(Node **nodePtr, int rt_index, int new_index, int subl
 			{
 				Query	*qry = (Query *)node;
 
-				modifyAggregChangeVarnodes(
+				modifyAggrefChangeVarnodes(
 						(Node **)(&(qry->targetList)),
 						rt_index,
 						new_index,
 						sublevels_up);
 
-				modifyAggregChangeVarnodes(
+				modifyAggrefChangeVarnodes(
 						(Node **)(&(qry->qual)),
 						rt_index,
 						new_index,
 						sublevels_up);
 
-				modifyAggregChangeVarnodes(
+				modifyAggrefChangeVarnodes(
 						(Node **)(&(qry->havingQual)),
 						rt_index,
 						new_index,
 						sublevels_up);
 
-				modifyAggregChangeVarnodes(
+				modifyAggrefChangeVarnodes(
 						(Node **)(&(qry->groupClause)),
 						rt_index,
 						new_index,
@@ -906,7 +906,7 @@ modifyAggregChangeVarnodes(Node **nodePtr, int rt_index, int new_index, int subl
 			break;
 
 		default:
-			elog(NOTICE, "unknown node tag %d in modifyAggregChangeVarnodes()", nodeTag(node));
+			elog(NOTICE, "unknown node tag %d in modifyAggrefChangeVarnodes()", nodeTag(node));
 			elog(NOTICE, "Node is: %s", nodeToString(node));
 			break;
 
@@ -916,11 +916,11 @@ modifyAggregChangeVarnodes(Node **nodePtr, int rt_index, int new_index, int subl
 
 
 /*
- * modifyAggregDropQual -
- *	remove the pure aggreg clase from a qualification
+ * modifyAggrefDropQual -
+ *	remove the pure aggref clase from a qualification
  */
 static void
-modifyAggregDropQual(Node **nodePtr, Node *orignode, Expr *expr)
+modifyAggrefDropQual(Node **nodePtr, Node *orignode, Expr *expr)
 {
 	Node	*node = *nodePtr;
 
@@ -931,12 +931,12 @@ modifyAggregDropQual(Node **nodePtr, Node *orignode, Expr *expr)
 		case T_Var:
 			break;
 
-		case T_Aggreg:
+		case T_Aggref:
 			{
-				Aggreg	*agg = (Aggreg *)node;
-				Aggreg	*oagg = (Aggreg *)orignode;
+				Aggref	*agg = (Aggref *)node;
+				Aggref	*oagg = (Aggref *)orignode;
 
-				modifyAggregDropQual(
+				modifyAggrefDropQual(
 						(Node **)(&(agg->target)),
 						(Node *)(oagg->target),
 						expr);
@@ -973,7 +973,7 @@ modifyAggregDropQual(Node **nodePtr, Node *orignode, Expr *expr)
 					*nodePtr = (Node *)ctrue;
 				}
 				else
-					modifyAggregDropQual(
+					modifyAggrefDropQual(
 						(Node **)(&(this_expr->args)),
 						(Node *)(orig_expr->args),
 						expr);
@@ -985,7 +985,7 @@ modifyAggregDropQual(Node **nodePtr, Node *orignode, Expr *expr)
 				Iter	*iter = (Iter *)node;
 				Iter	*oiter = (Iter *)orignode;
 
-				modifyAggregDropQual(
+				modifyAggrefDropQual(
 						(Node **)(&(iter->iterexpr)),
 						(Node *)(oiter->iterexpr),
 						expr);
@@ -997,19 +997,19 @@ modifyAggregDropQual(Node **nodePtr, Node *orignode, Expr *expr)
 				ArrayRef	*ref = (ArrayRef *)node;
 				ArrayRef	*oref = (ArrayRef *)orignode;
 
-				modifyAggregDropQual(
+				modifyAggrefDropQual(
 						(Node **)(&(ref->refupperindexpr)),
 						(Node *)(oref->refupperindexpr),
 						expr);
-				modifyAggregDropQual(
+				modifyAggrefDropQual(
 						(Node **)(&(ref->reflowerindexpr)),
 						(Node *)(oref->reflowerindexpr),
 						expr);
-				modifyAggregDropQual(
+				modifyAggrefDropQual(
 						(Node **)(&(ref->refexpr)),
 						(Node *)(oref->refexpr),
 						expr);
-				modifyAggregDropQual(
+				modifyAggrefDropQual(
 						(Node **)(&(ref->refassgnexpr)),
 						(Node *)(oref->refassgnexpr),
 						expr);
@@ -1023,7 +1023,7 @@ modifyAggregDropQual(Node **nodePtr, Node *orignode, Expr *expr)
 				int	li = 0;
 
 				foreach (l, (List *)node) {
-					modifyAggregDropQual(
+					modifyAggrefDropQual(
 							(Node **)(&(lfirst(l))),
 							(Node *)nth(li, ol),
 							expr);
@@ -1037,7 +1037,7 @@ modifyAggregDropQual(Node **nodePtr, Node *orignode, Expr *expr)
 				SubLink	*sub = (SubLink *)node;
 				SubLink	*osub = (SubLink *)orignode;
 
-				modifyAggregDropQual(
+				modifyAggrefDropQual(
 						(Node **)(&(sub->subselect)),
 						(Node *)(osub->subselect),
 						expr);
@@ -1049,12 +1049,12 @@ modifyAggregDropQual(Node **nodePtr, Node *orignode, Expr *expr)
 				Query	*qry = (Query *)node;
 				Query	*oqry = (Query *)orignode;
 
-				modifyAggregDropQual(
+				modifyAggrefDropQual(
 						(Node **)(&(qry->qual)),
 						(Node *)(oqry->qual),
 						expr);
 
-				modifyAggregDropQual(
+				modifyAggrefDropQual(
 						(Node **)(&(qry->havingQual)),
 						(Node *)(oqry->havingQual),
 						expr);
@@ -1062,7 +1062,7 @@ modifyAggregDropQual(Node **nodePtr, Node *orignode, Expr *expr)
 			break;
 
 		default:
-			elog(NOTICE, "unknown node tag %d in modifyAggregDropQual()", nodeTag(node));
+			elog(NOTICE, "unknown node tag %d in modifyAggrefDropQual()", nodeTag(node));
 			elog(NOTICE, "Node is: %s", nodeToString(node));
 			break;
 
@@ -1072,38 +1072,38 @@ modifyAggregDropQual(Node **nodePtr, Node *orignode, Expr *expr)
 
 
 /*
- * modifyAggregMakeSublink -
+ * modifyAggrefMakeSublink -
  *	Create a sublink node for a qualification expression that
  *	uses an aggregate column of a view
  */
 static SubLink *
-modifyAggregMakeSublink(Expr *origexp, Query *parsetree)
+modifyAggrefMakeSublink(Expr *origexp, Query *parsetree)
 {
 	SubLink		*sublink;
 	Query		*subquery;
 	Node		*subqual;
 	RangeTblEntry	*rte;
-	Aggreg		*aggreg;
+	Aggref		*aggref;
 	Var		*target;
 	TargetEntry	*tle;
 	Resdom		*resdom;
 	Expr		*exp = copyObject(origexp);
 
-	if (nodeTag(nth(0, exp->args)) == T_Aggreg)
+	if (nodeTag(nth(0, exp->args)) == T_Aggref)
 	{
-		if (nodeTag(nth(1, exp->args)) == T_Aggreg)
+		if (nodeTag(nth(1, exp->args)) == T_Aggref)
 			elog(ERROR, "rewrite: comparision of 2 aggregate columns not supported");
 		else
 			elog(ERROR, "rewrite: aggregate column of view must be at rigth side in qual");
 	}
 
-	aggreg = (Aggreg *)nth(1, exp->args);
-	target	= (Var *)(aggreg->target);
+	aggref = (Aggref *)nth(1, exp->args);
+	target	= (Var *)(aggref->target);
 	rte	= (RangeTblEntry *)nth(target->varno - 1, parsetree->rtable);
 	tle	= makeNode(TargetEntry);
 	resdom	= makeNode(Resdom);
 
-	aggreg->usenulls = TRUE;
+	aggref->usenulls = TRUE;
 
 	resdom->resno	= 1;
 	resdom->restype	= ((Oper *)(exp->oper))->opresulttype;
@@ -1114,10 +1114,10 @@ modifyAggregMakeSublink(Expr *origexp, Query *parsetree)
 	resdom->resjunk	= 0;
 
 	tle->resdom	= resdom;
-	tle->expr	= (Node *)aggreg;
+	tle->expr	= (Node *)aggref;
 
 	subqual = copyObject(parsetree->qual);
-	modifyAggregDropQual((Node **)&subqual, (Node *)parsetree->qual, origexp);
+	modifyAggrefDropQual((Node **)&subqual, (Node *)parsetree->qual, origexp);
 
 	sublink = makeNode(SubLink);
 	sublink->subLinkType	= EXPR_SUBLINK;
@@ -1148,13 +1148,13 @@ modifyAggregMakeSublink(Expr *origexp, Query *parsetree)
 	subquery->unionClause		= NULL;
 
 
-	modifyAggregUplevel((Node *)sublink);
+	modifyAggrefUplevel((Node *)sublink);
 
-	modifyAggregChangeVarnodes((Node **)&(sublink->lefthand), target->varno,
+	modifyAggrefChangeVarnodes((Node **)&(sublink->lefthand), target->varno,
 			1, target->varlevelsup);
-	modifyAggregChangeVarnodes((Node **)&(sublink->oper), target->varno,
+	modifyAggrefChangeVarnodes((Node **)&(sublink->oper), target->varno,
 			1, target->varlevelsup);
-	modifyAggregChangeVarnodes((Node **)&(sublink->subselect), target->varno,
+	modifyAggrefChangeVarnodes((Node **)&(sublink->subselect), target->varno,
 			1, target->varlevelsup);
 
 	return sublink;
@@ -1162,14 +1162,14 @@ modifyAggregMakeSublink(Expr *origexp, Query *parsetree)
 
 
 /*
- * modifyAggregQual -
+ * modifyAggrefQual -
  *	Search for qualification expressions that contain aggregate
  *	functions and substiture them by sublinks. These expressions
  *	originally come from qualifications that use aggregate columns
  *	of a view.
  */
 static void
-modifyAggregQual(Node **nodePtr, Query *parsetree)
+modifyAggrefQual(Node **nodePtr, Query *parsetree)
 {
 	Node	*node = *nodePtr;
 
@@ -1190,7 +1190,7 @@ modifyAggregQual(Node **nodePtr, Query *parsetree)
 			{
 				GroupClause	*grp = (GroupClause *)node;
 
-				modifyAggregQual(
+				modifyAggrefQual(
 						(Node **)(&(grp->entry)),
 						parsetree);
 			}
@@ -1203,22 +1203,22 @@ modifyAggregQual(Node **nodePtr, Query *parsetree)
 
 
 				if (length(exp->args) != 2) {
-					modifyAggregQual(
+					modifyAggrefQual(
 						(Node **)(&(exp->args)),
 						parsetree);
 					break;
 				}
 
-				if (nodeTag(nth(0, exp->args)) != T_Aggreg &&
-					nodeTag(nth(1, exp->args)) != T_Aggreg) {
+				if (nodeTag(nth(0, exp->args)) != T_Aggref &&
+					nodeTag(nth(1, exp->args)) != T_Aggref) {
 
-					modifyAggregQual(
+					modifyAggrefQual(
 						(Node **)(&(exp->args)),
 						parsetree);
 					break;
 				}
 
-				sub = modifyAggregMakeSublink(exp,
+				sub = modifyAggrefMakeSublink(exp,
 						parsetree);
 
 				*nodePtr = (Node *)sub;
@@ -1231,11 +1231,11 @@ modifyAggregQual(Node **nodePtr, Query *parsetree)
 				/* We're calling recursively,
 				 * and this routine knows how to handle lists
 				 * so let it do the work to handle the WHEN clauses... */
-				modifyAggregQual(
+				modifyAggrefQual(
 						(Node **)(&(((CaseExpr *)node)->args)),
 						parsetree);
 
-				modifyAggregQual(
+				modifyAggrefQual(
 						(Node **)(&(((CaseExpr *)node)->defresult)),
 						parsetree);
 			}
@@ -1243,11 +1243,11 @@ modifyAggregQual(Node **nodePtr, Query *parsetree)
 
 		case T_CaseWhen:
 			{
-				modifyAggregQual(
+				modifyAggrefQual(
 						(Node **)(&(((CaseWhen *)node)->expr)),
 						parsetree);
 
-				modifyAggregQual(
+				modifyAggrefQual(
 						(Node **)(&(((CaseWhen *)node)->result)),
 						parsetree);
 			}
@@ -1257,7 +1257,7 @@ modifyAggregQual(Node **nodePtr, Query *parsetree)
 			{
 				Iter	*iter = (Iter *)node;
 
-				modifyAggregQual(
+				modifyAggrefQual(
 						(Node **)(&(iter->iterexpr)),
 						parsetree);
 			}
@@ -1267,16 +1267,16 @@ modifyAggregQual(Node **nodePtr, Query *parsetree)
 			{
 				ArrayRef	*ref = (ArrayRef *)node;
 
-				modifyAggregQual(
+				modifyAggrefQual(
 						(Node **)(&(ref->refupperindexpr)),
 						parsetree);
-				modifyAggregQual(
+				modifyAggrefQual(
 						(Node **)(&(ref->reflowerindexpr)),
 						parsetree);
-				modifyAggregQual(
+				modifyAggrefQual(
 						(Node **)(&(ref->refexpr)),
 						parsetree);
-				modifyAggregQual(
+				modifyAggrefQual(
 						(Node **)(&(ref->refassgnexpr)),
 						parsetree);
 			}
@@ -1287,7 +1287,7 @@ modifyAggregQual(Node **nodePtr, Query *parsetree)
 				List	*l;
 
 				foreach (l, (List *)node)
-					modifyAggregQual(
+					modifyAggrefQual(
 							(Node **)(&(lfirst(l))),
 							parsetree);
 			}
@@ -1297,7 +1297,7 @@ modifyAggregQual(Node **nodePtr, Query *parsetree)
 			{
 				SubLink	*sub = (SubLink *)node;
 
-				modifyAggregQual(
+				modifyAggrefQual(
 						(Node **)(&(sub->subselect)),
 						(Query *)(sub->subselect));
 			}
@@ -1307,18 +1307,18 @@ modifyAggregQual(Node **nodePtr, Query *parsetree)
 			{
 				Query	*qry = (Query *)node;
 
-				modifyAggregQual(
+				modifyAggrefQual(
 						(Node **)(&(qry->qual)),
 						parsetree);
 
-				modifyAggregQual(
+				modifyAggrefQual(
 						(Node **)(&(qry->havingQual)),
 						parsetree);
 			}
 			break;
 
 		default:
-			elog(NOTICE, "unknown node tag %d in modifyAggregQual()", nodeTag(node));
+			elog(NOTICE, "unknown node tag %d in modifyAggrefQual()", nodeTag(node));
 			elog(NOTICE, "Node is: %s", nodeToString(node));
 			break;
 
@@ -1376,9 +1376,9 @@ apply_RIR_adjust_sublevel(Node *node, int sublevels_up)
 			}
 			break;
 
-		case T_Aggreg:
+		case T_Aggref:
 			{
-				Aggreg	*agg = (Aggreg *)node;
+				Aggref	*agg = (Aggref *)node;
 
 				apply_RIR_adjust_sublevel(
 						(Node *)(agg->target),
@@ -1525,9 +1525,9 @@ apply_RIR_view(Node **nodePtr, int rt_index, RangeTblEntry *rte, List *tlist, in
 			}
 			break;
 
-		case T_Aggreg:
+		case T_Aggref:
 			{
-				Aggreg	*agg = (Aggreg *)node;
+				Aggref	*agg = (Aggref *)node;
 
 				apply_RIR_view(
 						(Node **)(&(agg->target)),
@@ -1924,9 +1924,9 @@ fireRIRonSubselect(Node *node)
 			}
 			break;
 
-		case T_Aggreg:
+		case T_Aggref:
 			{
-				Aggreg	*agg = (Aggreg *)node;
+				Aggref	*agg = (Aggref *)node;
 
 				fireRIRonSubselect(
 						(Node *)(agg->target));
@@ -2143,7 +2143,7 @@ fireRIRrules(Query *parsetree)
 	}
 
 	fireRIRonSubselect((Node *) parsetree);
-	modifyAggregQual((Node **) &(parsetree->qual), parsetree);
+	modifyAggrefQual((Node **) &(parsetree->qual), parsetree);
 
 	return parsetree;
 }
diff --git a/src/backend/rewrite/rewriteManip.c b/src/backend/rewrite/rewriteManip.c
index c958c7810f6..d5aa077bdc1 100644
--- a/src/backend/rewrite/rewriteManip.c
+++ b/src/backend/rewrite/rewriteManip.c
@@ -6,7 +6,7 @@
  *
  *
  * IDENTIFICATION
- *	  $Header: /cvsroot/pgsql/src/backend/rewrite/rewriteManip.c,v 1.24 1999/01/18 00:09:56 momjian Exp $
+ *	  $Header: /cvsroot/pgsql/src/backend/rewrite/rewriteManip.c,v 1.25 1999/01/24 00:28:31 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -53,9 +53,9 @@ OffsetVarNodes(Node *node, int offset, int sublevels_up)
 			}
 			break;
 
-		case T_Aggreg:
+		case T_Aggref:
 			{
-				Aggreg	*agg = (Aggreg *)node;
+				Aggref	*agg = (Aggref *)node;
 
 				OffsetVarNodes(
 						(Node *)(agg->target),
@@ -271,9 +271,9 @@ ChangeVarNodes(Node *node, int rt_index, int new_index, int sublevels_up)
 			}
 			break;
 
-		case T_Aggreg:
+		case T_Aggref:
 			{
-				Aggreg	*agg = (Aggreg *)node;
+				Aggref	*agg = (Aggref *)node;
 
 				ChangeVarNodes(
 						(Node *)(agg->target),
@@ -641,8 +641,8 @@ ResolveNew(RewriteInfo *info, List *targetlist, Node **nodePtr,
 			ResolveNew(info, targetlist, &((TargetEntry *) node)->expr,
 					   sublevels_up);
 			break;
-		case T_Aggreg:
-			ResolveNew(info, targetlist, &((Aggreg *) node)->target,
+		case T_Aggref:
+			ResolveNew(info, targetlist, &((Aggref *) node)->target,
 					   sublevels_up);
 			break;
 		case T_Expr:
@@ -746,9 +746,9 @@ nodeHandleRIRAttributeRule(Node **nodePtr,
 										   sublevels_up);
 			}
 			break;
-		case T_Aggreg:
+		case T_Aggref:
 			{
-				Aggreg	   *agg = (Aggreg *) node;
+				Aggref	   *agg = (Aggref *) node;
 
 				nodeHandleRIRAttributeRule(&agg->target, rtable, targetlist,
 									rt_index, attr_num, modified, badsql,
@@ -911,9 +911,9 @@ nodeHandleViewRule(Node **nodePtr,
 								   rt_index, modified, sublevels_up);
 			}
 			break;
-		case T_Aggreg:
+		case T_Aggref:
 			{
-				Aggreg	   *agg = (Aggreg *) node;
+				Aggref	   *agg = (Aggref *) node;
 
 				nodeHandleViewRule(&(agg->target), rtable, targetlist,
 								   rt_index, modified, sublevels_up);
diff --git a/src/backend/utils/adt/ruleutils.c b/src/backend/utils/adt/ruleutils.c
index 7e7b27b82cb..4c9ae3d5020 100644
--- a/src/backend/utils/adt/ruleutils.c
+++ b/src/backend/utils/adt/ruleutils.c
@@ -3,7 +3,7 @@
  *			  out of it's tuple
  *
  * IDENTIFICATION
- *	  $Header: /cvsroot/pgsql/src/backend/utils/adt/ruleutils.c,v 1.6 1998/10/26 01:01:35 tgl Exp $
+ *	  $Header: /cvsroot/pgsql/src/backend/utils/adt/ruleutils.c,v 1.7 1999/01/24 00:28:32 momjian Exp $
  *
  *	  This software is copyrighted by Jan Wieck - Hamburg.
  *
@@ -1245,9 +1245,9 @@ get_rule_expr(QryHier *qh, int rt_index, Node *node, bool varprefix)
 			}
 			break;
 
-		case T_Aggreg:
+		case T_Aggref:
 			{
-				Aggreg	   *agg = (Aggreg *) node;
+				Aggref	   *agg = (Aggref *) node;
 
 				strcat(buf, "\"");
 				strcat(buf, agg->aggname);
@@ -1727,9 +1727,9 @@ check_if_rte_used(int rt_index, Node *node, int sup)
 			}
 			break;
 
-		case T_Aggreg:
+		case T_Aggref:
 			{
-				Aggreg	   *agg = (Aggreg *) node;
+				Aggref	   *agg = (Aggref *) node;
 
 				return check_if_rte_used(rt_index,
 										 (Node *) (agg->target), sup);
diff --git a/src/include/nodes/nodes.h b/src/include/nodes/nodes.h
index 6482fd66fbd..db7b402da47 100644
--- a/src/include/nodes/nodes.h
+++ b/src/include/nodes/nodes.h
@@ -6,7 +6,7 @@
  *
  * Copyright (c) 1994, Regents of the University of California
  *
- * $Id: nodes.h,v 1.34 1999/01/21 16:08:53 vadim Exp $
+ * $Id: nodes.h,v 1.35 1999/01/24 00:28:33 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -60,7 +60,7 @@ typedef enum NodeTag
 	T_Oper,
 	T_Const,
 	T_Param,
-	T_Aggreg,
+	T_Aggref,
 	T_SubLink,
 	T_Func,
 	T_Array,
diff --git a/src/include/nodes/primnodes.h b/src/include/nodes/primnodes.h
index 32701e075e9..c56c3bebf9b 100644
--- a/src/include/nodes/primnodes.h
+++ b/src/include/nodes/primnodes.h
@@ -6,7 +6,7 @@
  *
  * Copyright (c) 1994, Regents of the University of California
  *
- * $Id: primnodes.h,v 1.23 1998/09/01 04:36:47 momjian Exp $
+ * $Id: primnodes.h,v 1.24 1999/01/24 00:28:34 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -255,7 +255,7 @@ typedef struct Func
 } Func;
 
 /* ----------------
- * Aggreg
+ * Aggref
  *		aggname			- name of the aggregate
  *		basetype		- base type Oid of the aggregate
  *		aggtype			- type Oid of final result of the aggregate
@@ -263,7 +263,7 @@ typedef struct Func
  *		aggno			- index to ecxt_values
  * ----------------
  */
-typedef struct Aggreg
+typedef struct Aggref
 {
 	NodeTag		type;
 	char	   *aggname;
@@ -272,7 +272,7 @@ typedef struct Aggreg
 	Node	   *target;
 	int			aggno;
 	bool		usenulls;
-} Aggreg;
+} Aggref;
 
 /* ----------------
  * SubLink
diff --git a/src/include/parser/parse_agg.h b/src/include/parser/parse_agg.h
index d7f2e08c4f1..e68e5ac735a 100644
--- a/src/include/parser/parse_agg.h
+++ b/src/include/parser/parse_agg.h
@@ -6,7 +6,7 @@
  *
  * Copyright (c) 1994, Regents of the University of California
  *
- * $Id: parse_agg.h,v 1.7 1998/09/01 04:37:29 momjian Exp $
+ * $Id: parse_agg.h,v 1.8 1999/01/24 00:28:37 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -18,9 +18,9 @@
 #include <nodes/primnodes.h>
 #include <parser/parse_node.h>
 
-extern void AddAggToParseState(ParseState *pstate, Aggreg *aggreg);
+extern void AddAggToParseState(ParseState *pstate, Aggref *aggref);
 extern void parseCheckAggregates(ParseState *pstate, Query *qry);
-extern Aggreg *ParseAgg(ParseState *pstate, char *aggname, Oid basetype,
+extern Aggref *ParseAgg(ParseState *pstate, char *aggname, Oid basetype,
 		 List *target, int precedence);
 extern void agg_error(char *caller, char *aggname, Oid basetypeID);
 
-- 
GitLab