Commit 17467bb7 authored by Bruce Momjian's avatar Bruce Momjian

Rename Aggreg to Aggref.

parent 157349e3
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
* *
* *
* IDENTIFICATION * 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; ...@@ -67,7 +67,7 @@ bool execConstByVal;
int execConstLen; int execConstLen;
/* static functions decls */ /* 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, static Datum ExecEvalArrayRef(ArrayRef *arrayRef, ExprContext *econtext,
bool *isNull, bool *isDone); bool *isNull, bool *isDone);
static Datum ExecEvalAnd(Expr *andExpr, ExprContext *econtext, bool *isNull); static Datum ExecEvalAnd(Expr *andExpr, ExprContext *econtext, bool *isNull);
...@@ -185,14 +185,14 @@ ExecEvalArrayRef(ArrayRef *arrayRef, ...@@ -185,14 +185,14 @@ ExecEvalArrayRef(ArrayRef *arrayRef,
/* ---------------------------------------------------------------- /* ----------------------------------------------------------------
* ExecEvalAggreg * ExecEvalAggref
* *
* Returns a Datum whose value is the value of the precomputed * Returns a Datum whose value is the value of the precomputed
* aggregate found in the given expression context. * aggregate found in the given expression context.
* ---------------------------------------------------------------- * ----------------------------------------------------------------
*/ */
static Datum static Datum
ExecEvalAggreg(Aggreg *agg, ExprContext *econtext, bool *isNull) ExecEvalAggref(Aggref *agg, ExprContext *econtext, bool *isNull)
{ {
*isNull = econtext->ecxt_nulls[agg->aggno]; *isNull = econtext->ecxt_nulls[agg->aggno];
return econtext->ecxt_values[agg->aggno]; return econtext->ecxt_values[agg->aggno];
...@@ -1268,8 +1268,8 @@ ExecEvalExpr(Node *expression, ...@@ -1268,8 +1268,8 @@ ExecEvalExpr(Node *expression,
isNull, isNull,
isDone); isDone);
break; break;
case T_Aggreg: case T_Aggref:
retDatum = (Datum) ExecEvalAggreg((Aggreg *) expression, retDatum = (Datum) ExecEvalAggref((Aggref *) expression,
econtext, econtext,
isNull); isNull);
break; break;
......
...@@ -45,7 +45,7 @@ typedef struct AggFuncInfo ...@@ -45,7 +45,7 @@ typedef struct AggFuncInfo
FmgrInfo finalfn; FmgrInfo finalfn;
} AggFuncInfo; } 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) ...@@ -90,7 +90,7 @@ ExecAgg(Agg *node)
{ {
AggState *aggstate; AggState *aggstate;
EState *estate; EState *estate;
Aggreg **aggregates; Aggref **aggregates;
Plan *outerPlan; Plan *outerPlan;
int i, int i,
nagg; nagg;
...@@ -133,7 +133,7 @@ ExecAgg(Agg *node) ...@@ -133,7 +133,7 @@ ExecAgg(Agg *node)
nagg = length(node->aggs); 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 */ /* take List* and make it an array that can be quickly indexed */
alist = node->aggs; alist = node->aggs;
...@@ -163,7 +163,7 @@ ExecAgg(Agg *node) ...@@ -163,7 +163,7 @@ ExecAgg(Agg *node)
for (i = 0; i < nagg; i++) for (i = 0; i < nagg; i++)
{ {
Aggreg *agg; Aggref *agg;
char *aggname; char *aggname;
HeapTuple aggTuple; HeapTuple aggTuple;
Form_pg_aggregate aggp; Form_pg_aggregate aggp;
...@@ -628,7 +628,7 @@ ExecEndAgg(Agg *node) ...@@ -628,7 +628,7 @@ ExecEndAgg(Agg *node)
*/ */
static Datum static Datum
aggGetAttr(TupleTableSlot *slot, aggGetAttr(TupleTableSlot *slot,
Aggreg *agg, Aggref *agg,
bool *isNull) bool *isNull)
{ {
Datum result; Datum result;
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
* *
* *
* IDENTIFICATION * 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) ...@@ -899,13 +899,13 @@ _copyFunc(Func *from)
} }
/* ---------------- /* ----------------
* _copyAggreg * _copyAggref
* ---------------- * ----------------
*/ */
static Aggreg * static Aggref *
_copyAggreg(Aggreg *from) _copyAggref(Aggref *from)
{ {
Aggreg *newnode = makeNode(Aggreg); Aggref *newnode = makeNode(Aggref);
/* ---------------- /* ----------------
* copy remainder of node * copy remainder of node
...@@ -1782,8 +1782,8 @@ copyObject(void *from) ...@@ -1782,8 +1782,8 @@ copyObject(void *from)
case T_ArrayRef: case T_ArrayRef:
retval = _copyArrayRef(from); retval = _copyArrayRef(from);
break; break;
case T_Aggreg: case T_Aggref:
retval = _copyAggreg(from); retval = _copyAggref(from);
break; break;
case T_SubLink: case T_SubLink:
retval = _copySubLink(from); retval = _copySubLink(from);
......
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
* *
* Copyright (c) 1994, Regents of the University of California * 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 * NOTES
* Every (plan) node in POSTGRES has an associated "out" routine which * Every (plan) node in POSTGRES has an associated "out" routine which
...@@ -686,10 +686,10 @@ _outConst(StringInfo str, Const *node) ...@@ -686,10 +686,10 @@ _outConst(StringInfo str, Const *node)
} }
/* /*
* Aggreg * Aggref
*/ */
static void static void
_outAggreg(StringInfo str, Aggreg *node) _outAggref(StringInfo str, Aggref *node)
{ {
appendStringInfo(str, appendStringInfo(str,
" AGGREG :aggname %s :basetype %u :aggtype %u :target ", " AGGREG :aggname %s :basetype %u :aggtype %u :target ",
...@@ -1506,8 +1506,8 @@ _outNode(StringInfo str, void *obj) ...@@ -1506,8 +1506,8 @@ _outNode(StringInfo str, void *obj)
case T_Const: case T_Const:
_outConst(str, obj); _outConst(str, obj);
break; break;
case T_Aggreg: case T_Aggref:
_outAggreg(str, obj); _outAggref(str, obj);
break; break;
case T_SubLink: case T_SubLink:
_outSubLink(str, obj); _outSubLink(str, obj);
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
* *
* *
* IDENTIFICATION * 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 * NOTES
* Most of the read functions for plan nodes are tested. (In fact, they * Most of the read functions for plan nodes are tested. (In fact, they
...@@ -1161,19 +1161,19 @@ _readParam() ...@@ -1161,19 +1161,19 @@ _readParam()
} }
/* ---------------- /* ----------------
* _readAggreg * _readAggref
* *
* Aggreg is a subclass of Node * Aggref is a subclass of Node
* ---------------- * ----------------
*/ */
static Aggreg * static Aggref *
_readAggreg() _readAggref()
{ {
Aggreg *local_node; Aggref *local_node;
char *token; char *token;
int length; int length;
local_node = makeNode(Aggreg); local_node = makeNode(Aggref);
token = lsptok(NULL, &length); /* eat :aggname */ token = lsptok(NULL, &length); /* eat :aggname */
token = lsptok(NULL, &length); /* get aggname */ token = lsptok(NULL, &length); /* get aggname */
...@@ -2040,7 +2040,7 @@ parsePlanString(void) ...@@ -2040,7 +2040,7 @@ parsePlanString(void)
else if (!strncmp(token, "SORT", length)) else if (!strncmp(token, "SORT", length))
return_value = _readSort(); return_value = _readSort();
else if (!strncmp(token, "AGGREG", length)) else if (!strncmp(token, "AGGREG", length))
return_value = _readAggreg(); return_value = _readAggref();
else if (!strncmp(token, "SUBLINK", length)) else if (!strncmp(token, "SUBLINK", length))
return_value = _readSubLink(); return_value = _readSubLink();
else if (!strncmp(token, "AGG", length)) else if (!strncmp(token, "AGG", length))
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
* *
* *
* IDENTIFICATION * 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, ...@@ -611,8 +611,8 @@ replace_result_clause(Node *clause,
((Var *) clause)->varno = (Index) OUTER; ((Var *) clause)->varno = (Index) OUTER;
((Var *) clause)->varattno = subplanVar->resdom->resno; ((Var *) clause)->varattno = subplanVar->resdom->resno;
} }
else if (IsA(clause, Aggreg)) else if (IsA(clause, Aggref))
replace_result_clause(((Aggreg *) clause)->target, subplanTargetList); replace_result_clause(((Aggref *) clause)->target, subplanTargetList);
else if (is_funcclause(clause)) else if (is_funcclause(clause))
{ {
List *subExpr; List *subExpr;
...@@ -704,7 +704,7 @@ OperandIsInner(Node *opnd, int inner_relid) ...@@ -704,7 +704,7 @@ OperandIsInner(Node *opnd, int inner_relid)
* changes the target list of an Agg node so that it points to * changes the target list of an Agg node so that it points to
* the tuples returned by its left tree subplan. * 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 * List *
...@@ -765,10 +765,10 @@ replace_agg_clause(Node *clause, List *subplanTargetList) ...@@ -765,10 +765,10 @@ replace_agg_clause(Node *clause, List *subplanTargetList)
} }
return agg_list; return agg_list;
} }
else if (IsA(clause, Aggreg)) else if (IsA(clause, Aggref))
{ {
return lcons(clause, return lcons(clause,
replace_agg_clause(((Aggreg *) clause)->target, subplanTargetList)); replace_agg_clause(((Aggref *) clause)->target, subplanTargetList));
} }
else if (IsA(clause, ArrayRef)) else if (IsA(clause, ArrayRef))
{ {
...@@ -866,11 +866,11 @@ del_agg_clause(Node *clause) ...@@ -866,11 +866,11 @@ del_agg_clause(Node *clause)
foreach(t, ((Expr *) clause)->args) foreach(t, ((Expr *) clause)->args)
lfirst(t) = del_agg_clause(lfirst(t)); 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 */ /* 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)) else if (IsA(clause, ArrayRef))
...@@ -967,10 +967,10 @@ check_having_qual_for_vars(Node *clause, List *targetlist_so_far) ...@@ -967,10 +967,10 @@ check_having_qual_for_vars(Node *clause, List *targetlist_so_far)
} }
return targetlist_so_far; return targetlist_so_far;
} }
else if (IsA(clause, Aggreg)) else if (IsA(clause, Aggref))
{ {
targetlist_so_far = 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; return targetlist_so_far;
} }
else if (IsA(clause, ArrayRef)) else if (IsA(clause, ArrayRef))
...@@ -1100,10 +1100,10 @@ check_having_qual_for_aggs(Node *clause, List *subplanTargetList, List *groupCla ...@@ -1100,10 +1100,10 @@ check_having_qual_for_aggs(Node *clause, List *subplanTargetList, List *groupCla
} }
return agg_list; return agg_list;
} }
else if (IsA(clause, Aggreg)) else if (IsA(clause, Aggref))
{ {
return lcons(clause, return lcons(clause,
check_having_qual_for_aggs(((Aggreg *) clause)->target, subplanTargetList, check_having_qual_for_aggs(((Aggref *) clause)->target, subplanTargetList,
groupClause)); groupClause));
} }
else if (IsA(clause, ArrayRef)) else if (IsA(clause, ArrayRef))
......
...@@ -282,8 +282,8 @@ _finalize_primnode(void *expr, List **subplan) ...@@ -282,8 +282,8 @@ _finalize_primnode(void *expr, List **subplan)
else if (or_clause(expr) || and_clause(expr) || is_opclause(expr) || else if (or_clause(expr) || and_clause(expr) || is_opclause(expr) ||
not_clause(expr) || is_funcclause(expr)) not_clause(expr) || is_funcclause(expr))
return _finalize_primnode(((Expr *) expr)->args, subplan); return _finalize_primnode(((Expr *) expr)->args, subplan);
else if (IsA(expr, Aggreg)) else if (IsA(expr, Aggref))
return _finalize_primnode(((Aggreg *) expr)->target, subplan); return _finalize_primnode(((Aggref *) expr)->target, subplan);
else if (IsA(expr, ArrayRef)) else if (IsA(expr, ArrayRef))
{ {
result = _finalize_primnode(((ArrayRef *) expr)->refupperindexpr, subplan); result = _finalize_primnode(((ArrayRef *) expr)->refupperindexpr, subplan);
...@@ -349,9 +349,9 @@ SS_replace_correlation_vars(Node *expr) ...@@ -349,9 +349,9 @@ SS_replace_correlation_vars(Node *expr)
not_clause(expr) || is_funcclause(expr)) not_clause(expr) || is_funcclause(expr))
((Expr *) expr)->args = (List *) ((Expr *) expr)->args = (List *)
SS_replace_correlation_vars((Node *) ((Expr *) expr)->args); SS_replace_correlation_vars((Node *) ((Expr *) expr)->args);
else if (IsA(expr, Aggreg)) else if (IsA(expr, Aggref))
((Aggreg *) expr)->target = ((Aggref *) expr)->target =
SS_replace_correlation_vars((Node *) ((Aggreg *) expr)->target); SS_replace_correlation_vars((Node *) ((Aggref *) expr)->target);
else if (IsA(expr, ArrayRef)) else if (IsA(expr, ArrayRef))
{ {
((ArrayRef *) expr)->refupperindexpr = (List *) ((ArrayRef *) expr)->refupperindexpr = (List *)
...@@ -530,8 +530,8 @@ SS_pull_subplan(void *expr) ...@@ -530,8 +530,8 @@ SS_pull_subplan(void *expr)
else if (or_clause(expr) || and_clause(expr) || is_opclause(expr) || else if (or_clause(expr) || and_clause(expr) || is_opclause(expr) ||
not_clause(expr) || is_funcclause(expr)) not_clause(expr) || is_funcclause(expr))
return SS_pull_subplan(((Expr *) expr)->args); return SS_pull_subplan(((Expr *) expr)->args);
else if (IsA(expr, Aggreg)) else if (IsA(expr, Aggref))
return SS_pull_subplan(((Aggreg *) expr)->target); return SS_pull_subplan(((Aggref *) expr)->target);
else if (IsA(expr, ArrayRef)) else if (IsA(expr, ArrayRef))
{ {
result = SS_pull_subplan(((ArrayRef *) expr)->refupperindexpr); result = SS_pull_subplan(((ArrayRef *) expr)->refupperindexpr);
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
* *
* *
* IDENTIFICATION * 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 * HISTORY
* AUTHOR DATE MAJOR EVENT * AUTHOR DATE MAJOR EVENT
...@@ -145,7 +145,7 @@ static bool ...@@ -145,7 +145,7 @@ static bool
agg_clause(Node *clause) agg_clause(Node *clause)
{ {
return return
(clause != NULL && nodeTag(clause) == T_Aggreg); (clause != NULL && nodeTag(clause) == T_Aggref);
} }
/***************************************************************************** /*****************************************************************************
...@@ -548,7 +548,7 @@ fix_opid(Node *clause) ...@@ -548,7 +548,7 @@ fix_opid(Node *clause)
fix_opid((Node *) get_rightop((Expr *) clause)); fix_opid((Node *) get_rightop((Expr *) clause));
} }
else if (agg_clause(clause)) else if (agg_clause(clause))
fix_opid(((Aggreg *) clause)->target); fix_opid(((Aggref *) clause)->target);
else if (is_subplan(clause) && else if (is_subplan(clause) &&
((SubPlan *) ((Expr *) clause)->oper)->sublink->subLinkType != EXISTS_SUBLINK) ((SubPlan *) ((Expr *) clause)->oper)->sublink->subLinkType != EXISTS_SUBLINK)
{ {
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
* *
* *
* IDENTIFICATION * 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) ...@@ -483,7 +483,7 @@ flatten_tlistentry(Node *tlistentry, List *flat_tlist)
return ((Node *) make_funcclause((Func *) expr->oper, temp_result)); return ((Node *) make_funcclause((Func *) expr->oper, temp_result));
} }
else if (IsA(tlistentry, Aggreg)) else if (IsA(tlistentry, Aggref))
{ {
return tlistentry; return tlistentry;
} }
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
* *
* *
* IDENTIFICATION * 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) ...@@ -194,8 +194,8 @@ pull_var_clause(Node *clause)
retval = nconc(retval, retval = nconc(retval,
pull_var_clause(lfirst(((Expr *) lfirst(temp))->args))); pull_var_clause(lfirst(((Expr *) lfirst(temp))->args)));
} }
else if (IsA(clause, Aggreg)) else if (IsA(clause, Aggref))
retval = pull_var_clause(((Aggreg *) clause)->target); retval = pull_var_clause(((Aggref *) clause)->target);
else if (IsA(clause, ArrayRef)) else if (IsA(clause, ArrayRef))
{ {
List *temp; List *temp;
......
...@@ -239,7 +239,7 @@ ...@@ -239,7 +239,7 @@
* *
* *
* IDENTIFICATION * 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 * HISTORY
* AUTHOR DATE MAJOR EVENT * AUTHOR DATE MAJOR EVENT
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
* *
* *
* IDENTIFICATION * 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); ...@@ -37,7 +37,7 @@ static bool tleIsAggOrGroupCol(TargetEntry *tle, List *groupClause);
/* /*
* contain_agg_clause-- * contain_agg_clause--
* Recursively find aggreg nodes from a clause. * Recursively find aggref nodes from a clause.
* *
* Returns true if any aggregate found. * Returns true if any aggregate found.
*/ */
...@@ -46,7 +46,7 @@ contain_agg_clause(Node *clause) ...@@ -46,7 +46,7 @@ contain_agg_clause(Node *clause)
{ {
if (clause == NULL) if (clause == NULL)
return FALSE; return FALSE;
else if (IsA(clause, Aggreg)) else if (IsA(clause, Aggref))
return TRUE; return TRUE;
else if (IsA(clause, Iter)) else if (IsA(clause, Iter))
return contain_agg_clause(((Iter *) clause)->iterexpr); return contain_agg_clause(((Iter *) clause)->iterexpr);
...@@ -105,7 +105,7 @@ exprIsAggOrGroupCol(Node *expr, List *groupClause) ...@@ -105,7 +105,7 @@ exprIsAggOrGroupCol(Node *expr, List *groupClause)
List *gl; List *gl;
if (expr == NULL || IsA(expr, Const) || 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 !!! */ IsA(expr, SubLink)) /* can't handle currently !!! */
return TRUE; return TRUE;
...@@ -155,7 +155,7 @@ tleIsAggOrGroupCol(TargetEntry *tle, List *groupClause) ...@@ -155,7 +155,7 @@ tleIsAggOrGroupCol(TargetEntry *tle, List *groupClause)
} }
} }
if (IsA(expr, Aggreg)) if (IsA(expr, Aggref))
return TRUE; return TRUE;
if (IsA(expr, Expr)) if (IsA(expr, Expr))
...@@ -217,7 +217,7 @@ parseCheckAggregates(ParseState *pstate, Query *qry) ...@@ -217,7 +217,7 @@ parseCheckAggregates(ParseState *pstate, Query *qry)
} }
Aggreg * Aggref *
ParseAgg(ParseState *pstate, char *aggname, Oid basetype, ParseAgg(ParseState *pstate, char *aggname, Oid basetype,
List *target, int precedence) List *target, int precedence)
{ {
...@@ -225,7 +225,7 @@ ParseAgg(ParseState *pstate, char *aggname, Oid basetype, ...@@ -225,7 +225,7 @@ ParseAgg(ParseState *pstate, char *aggname, Oid basetype,
Oid vartype; Oid vartype;
Oid xfn1; Oid xfn1;
Form_pg_aggregate aggform; Form_pg_aggregate aggform;
Aggreg *aggreg; Aggref *aggref;
HeapTuple theAggTuple; HeapTuple theAggTuple;
bool usenulls = false; bool usenulls = false;
...@@ -324,18 +324,18 @@ ParseAgg(ParseState *pstate, char *aggname, Oid basetype, ...@@ -324,18 +324,18 @@ ParseAgg(ParseState *pstate, char *aggname, Oid basetype,
} }
} }
aggreg = makeNode(Aggreg); aggref = makeNode(Aggref);
aggreg->aggname = pstrdup(aggname); aggref->aggname = pstrdup(aggname);
aggreg->basetype = aggform->aggbasetype; aggref->basetype = aggform->aggbasetype;
aggreg->aggtype = fintype; aggref->aggtype = fintype;
aggreg->target = lfirst(target); aggref->target = lfirst(target);
if (usenulls) if (usenulls)
aggreg->usenulls = true; aggref->usenulls = true;
pstate->p_hasAggs = true; pstate->p_hasAggs = true;
return aggreg; return aggref;
} }
/* /*
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
* *
* *
* IDENTIFICATION * 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) ...@@ -586,8 +586,8 @@ exprType(Node *expr)
case T_ArrayRef: case T_ArrayRef:
type = ((ArrayRef *) expr)->refelemtype; type = ((ArrayRef *) expr)->refelemtype;
break; break;
case T_Aggreg: case T_Aggref:
type = ((Aggreg *) expr)->aggtype; type = ((Aggref *) expr)->aggtype;
break; break;
case T_Param: case T_Param:
type = ((Param *) expr)->paramtype; type = ((Param *) expr)->paramtype;
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
* *
* *
* IDENTIFICATION * 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) ...@@ -872,8 +872,8 @@ FigureColname(Node *expr, Node *resval)
{ {
switch (nodeTag(expr)) switch (nodeTag(expr))
{ {
case T_Aggreg: case T_Aggref:
return (char *) ((Aggreg *) expr)->aggname; return (char *) ((Aggref *) expr)->aggname;
case T_Expr: case T_Expr:
if (((Expr *) expr)->opType == FUNC_EXPR) if (((Expr *) expr)->opType == FUNC_EXPR)
{ {
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
* *
* *
* IDENTIFICATION * 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, ...@@ -66,9 +66,9 @@ nodeThisLockWasTriggered(Node *node, int varno, AttrNumber attnum,
sublevels_up); sublevels_up);
} }
break; break;
case T_Aggreg: case T_Aggref:
{ {
Aggreg *agg = (Aggreg *) node; Aggref *agg = (Aggref *) node;
return nodeThisLockWasTriggered(agg->target, varno, attnum, return nodeThisLockWasTriggered(agg->target, varno, attnum,
sublevels_up); sublevels_up);
......
This diff is collapsed.
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
* *
* *
* IDENTIFICATION * 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) ...@@ -53,9 +53,9 @@ OffsetVarNodes(Node *node, int offset, int sublevels_up)
} }
break; break;
case T_Aggreg: case T_Aggref:
{ {
Aggreg *agg = (Aggreg *)node; Aggref *agg = (Aggref *)node;
OffsetVarNodes( OffsetVarNodes(
(Node *)(agg->target), (Node *)(agg->target),
...@@ -271,9 +271,9 @@ ChangeVarNodes(Node *node, int rt_index, int new_index, int sublevels_up) ...@@ -271,9 +271,9 @@ ChangeVarNodes(Node *node, int rt_index, int new_index, int sublevels_up)
} }
break; break;
case T_Aggreg: case T_Aggref:
{ {
Aggreg *agg = (Aggreg *)node; Aggref *agg = (Aggref *)node;
ChangeVarNodes( ChangeVarNodes(
(Node *)(agg->target), (Node *)(agg->target),
...@@ -641,8 +641,8 @@ ResolveNew(RewriteInfo *info, List *targetlist, Node **nodePtr, ...@@ -641,8 +641,8 @@ ResolveNew(RewriteInfo *info, List *targetlist, Node **nodePtr,
ResolveNew(info, targetlist, &((TargetEntry *) node)->expr, ResolveNew(info, targetlist, &((TargetEntry *) node)->expr,
sublevels_up); sublevels_up);
break; break;
case T_Aggreg: case T_Aggref:
ResolveNew(info, targetlist, &((Aggreg *) node)->target, ResolveNew(info, targetlist, &((Aggref *) node)->target,
sublevels_up); sublevels_up);
break; break;
case T_Expr: case T_Expr:
...@@ -746,9 +746,9 @@ nodeHandleRIRAttributeRule(Node **nodePtr, ...@@ -746,9 +746,9 @@ nodeHandleRIRAttributeRule(Node **nodePtr,
sublevels_up); sublevels_up);
} }
break; break;
case T_Aggreg: case T_Aggref:
{ {
Aggreg *agg = (Aggreg *) node; Aggref *agg = (Aggref *) node;
nodeHandleRIRAttributeRule(&agg->target, rtable, targetlist, nodeHandleRIRAttributeRule(&agg->target, rtable, targetlist,
rt_index, attr_num, modified, badsql, rt_index, attr_num, modified, badsql,
...@@ -911,9 +911,9 @@ nodeHandleViewRule(Node **nodePtr, ...@@ -911,9 +911,9 @@ nodeHandleViewRule(Node **nodePtr,
rt_index, modified, sublevels_up); rt_index, modified, sublevels_up);
} }
break; break;
case T_Aggreg: case T_Aggref:
{ {
Aggreg *agg = (Aggreg *) node; Aggref *agg = (Aggref *) node;
nodeHandleViewRule(&(agg->target), rtable, targetlist, nodeHandleViewRule(&(agg->target), rtable, targetlist,
rt_index, modified, sublevels_up); rt_index, modified, sublevels_up);
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
* out of it's tuple * out of it's tuple
* *
* IDENTIFICATION * 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. * This software is copyrighted by Jan Wieck - Hamburg.
* *
...@@ -1245,9 +1245,9 @@ get_rule_expr(QryHier *qh, int rt_index, Node *node, bool varprefix) ...@@ -1245,9 +1245,9 @@ get_rule_expr(QryHier *qh, int rt_index, Node *node, bool varprefix)
} }
break; break;
case T_Aggreg: case T_Aggref:
{ {
Aggreg *agg = (Aggreg *) node; Aggref *agg = (Aggref *) node;
strcat(buf, "\""); strcat(buf, "\"");
strcat(buf, agg->aggname); strcat(buf, agg->aggname);
...@@ -1727,9 +1727,9 @@ check_if_rte_used(int rt_index, Node *node, int sup) ...@@ -1727,9 +1727,9 @@ check_if_rte_used(int rt_index, Node *node, int sup)
} }
break; break;
case T_Aggreg: case T_Aggref:
{ {
Aggreg *agg = (Aggreg *) node; Aggref *agg = (Aggref *) node;
return check_if_rte_used(rt_index, return check_if_rte_used(rt_index,
(Node *) (agg->target), sup); (Node *) (agg->target), sup);
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
* *
* Copyright (c) 1994, Regents of the University of California * 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 ...@@ -60,7 +60,7 @@ typedef enum NodeTag
T_Oper, T_Oper,
T_Const, T_Const,
T_Param, T_Param,
T_Aggreg, T_Aggref,
T_SubLink, T_SubLink,
T_Func, T_Func,
T_Array, T_Array,
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
* *
* Copyright (c) 1994, Regents of the University of California * 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 ...@@ -255,7 +255,7 @@ typedef struct Func
} Func; } Func;
/* ---------------- /* ----------------
* Aggreg * Aggref
* aggname - name of the aggregate * aggname - name of the aggregate
* basetype - base type Oid of the aggregate * basetype - base type Oid of the aggregate
* aggtype - type Oid of final result of the aggregate * aggtype - type Oid of final result of the aggregate
...@@ -263,7 +263,7 @@ typedef struct Func ...@@ -263,7 +263,7 @@ typedef struct Func
* aggno - index to ecxt_values * aggno - index to ecxt_values
* ---------------- * ----------------
*/ */
typedef struct Aggreg typedef struct Aggref
{ {
NodeTag type; NodeTag type;
char *aggname; char *aggname;
...@@ -272,7 +272,7 @@ typedef struct Aggreg ...@@ -272,7 +272,7 @@ typedef struct Aggreg
Node *target; Node *target;
int aggno; int aggno;
bool usenulls; bool usenulls;
} Aggreg; } Aggref;
/* ---------------- /* ----------------
* SubLink * SubLink
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
* *
* Copyright (c) 1994, Regents of the University of California * 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 @@ ...@@ -18,9 +18,9 @@
#include <nodes/primnodes.h> #include <nodes/primnodes.h>
#include <parser/parse_node.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 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); List *target, int precedence);
extern void agg_error(char *caller, char *aggname, Oid basetypeID); extern void agg_error(char *caller, char *aggname, Oid basetypeID);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment