aboutsummaryrefslogtreecommitdiff
path: root/src/backend/executor
diff options
context:
space:
mode:
authorBruce Momjian <bruce@momjian.us>2001-03-22 04:01:46 +0000
committerBruce Momjian <bruce@momjian.us>2001-03-22 04:01:46 +0000
commit9e1552607a9dc6bc23e43d46770a9063ade4f3f0 (patch)
tree6a230d81917ebc004e40cd46c48f2aa27eec153e /src/backend/executor
parent6cf8707b828b14b5c2336076ce358b18b67829d6 (diff)
downloadpostgresql-9e1552607a9dc6bc23e43d46770a9063ade4f3f0.tar.gz
postgresql-9e1552607a9dc6bc23e43d46770a9063ade4f3f0.zip
pgindent run. Make it all clean.
Diffstat (limited to 'src/backend/executor')
-rw-r--r--src/backend/executor/execAmi.c10
-rw-r--r--src/backend/executor/execJunk.c3
-rw-r--r--src/backend/executor/execMain.c116
-rw-r--r--src/backend/executor/execQual.c162
-rw-r--r--src/backend/executor/execScan.c6
-rw-r--r--src/backend/executor/execTuples.c18
-rw-r--r--src/backend/executor/execUtils.c20
-rw-r--r--src/backend/executor/functions.c29
-rw-r--r--src/backend/executor/nodeAgg.c151
-rw-r--r--src/backend/executor/nodeGroup.c14
-rw-r--r--src/backend/executor/nodeHash.c4
-rw-r--r--src/backend/executor/nodeHashjoin.c12
-rw-r--r--src/backend/executor/nodeIndexscan.c29
-rw-r--r--src/backend/executor/nodeLimit.c18
-rw-r--r--src/backend/executor/nodeMaterial.c18
-rw-r--r--src/backend/executor/nodeMergejoin.c128
-rw-r--r--src/backend/executor/nodeNestloop.c20
-rw-r--r--src/backend/executor/nodeResult.c4
-rw-r--r--src/backend/executor/nodeSeqscan.c8
-rw-r--r--src/backend/executor/nodeSetOp.c29
-rw-r--r--src/backend/executor/nodeSubplan.c10
-rw-r--r--src/backend/executor/nodeSubqueryscan.c7
-rw-r--r--src/backend/executor/nodeTidscan.c3
-rw-r--r--src/backend/executor/spi.c39
24 files changed, 475 insertions, 383 deletions
diff --git a/src/backend/executor/execAmi.c b/src/backend/executor/execAmi.c
index 0888e2638b2..a9c5bd40372 100644
--- a/src/backend/executor/execAmi.c
+++ b/src/backend/executor/execAmi.c
@@ -6,7 +6,7 @@
* Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $Id: execAmi.c,v 1.56 2001/01/24 19:42:53 momjian Exp $
+ * $Id: execAmi.c,v 1.57 2001/03/22 03:59:25 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -19,7 +19,7 @@
* ExecInsert \ executor interface / aminsert
* ExecReScanR / to access methods \ amrescan
* ExecMarkPos / \ ammarkpos
- * ExecRestrPos / \ amrestpos
+ * ExecRestrPos / \ amrestpos
*/
#include "postgres.h"
@@ -91,7 +91,7 @@ ExecOpenScanR(Oid relOid,
* on whether this is a heap relation or an index relation.
*
* For a table, acquire AccessShareLock for the duration of the query
- * execution. For indexes, acquire no lock here; the index machinery
+ * execution. For indexes, acquire no lock here; the index machinery
* does its own locks and unlocks. (We rely on having some kind of
* lock on the parent table to ensure the index won't go away!)
* ----------------
@@ -413,7 +413,7 @@ ExecMarkPos(Plan *node)
{
switch (nodeTag(node))
{
- case T_SeqScan:
+ case T_SeqScan:
ExecSeqMarkPos((SeqScan *) node);
break;
@@ -455,7 +455,7 @@ ExecRestrPos(Plan *node)
{
switch (nodeTag(node))
{
- case T_SeqScan:
+ case T_SeqScan:
ExecSeqRestrPos((SeqScan *) node);
break;
diff --git a/src/backend/executor/execJunk.c b/src/backend/executor/execJunk.c
index f23ba273462..d288a8de735 100644
--- a/src/backend/executor/execJunk.c
+++ b/src/backend/executor/execJunk.c
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/executor/execJunk.c,v 1.25 2001/01/29 00:39:17 tgl Exp $
+ * $Header: /cvsroot/pgsql/src/backend/executor/execJunk.c,v 1.26 2001/03/22 03:59:26 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -265,6 +265,7 @@ ExecInitJunkFilter(List *targetList, TupleDesc tupType)
void
ExecFreeJunkFilter(JunkFilter *junkfilter)
{
+
/*
* Since the junkfilter is inside its own context, we just have to
* delete the context and we're set.
diff --git a/src/backend/executor/execMain.c b/src/backend/executor/execMain.c
index 929134209ba..fc1dccd0467 100644
--- a/src/backend/executor/execMain.c
+++ b/src/backend/executor/execMain.c
@@ -27,7 +27,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/executor/execMain.c,v 1.138 2001/01/29 00:39:18 tgl Exp $
+ * $Header: /cvsroot/pgsql/src/backend/executor/execMain.c,v 1.139 2001/03/22 03:59:26 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -51,15 +51,15 @@ static TupleDesc InitPlan(CmdType operation,
Plan *plan,
EState *estate);
static void initResultRelInfo(ResultRelInfo *resultRelInfo,
- Index resultRelationIndex,
- List *rangeTable,
- CmdType operation);
+ Index resultRelationIndex,
+ List *rangeTable,
+ CmdType operation);
static void EndPlan(Plan *plan, EState *estate);
static TupleTableSlot *ExecutePlan(EState *estate, Plan *plan,
- CmdType operation,
- long numberTuples,
- ScanDirection direction,
- DestReceiver *destfunc);
+ CmdType operation,
+ long numberTuples,
+ ScanDirection direction,
+ DestReceiver *destfunc);
static void ExecRetrieve(TupleTableSlot *slot,
DestReceiver *destfunc,
EState *estate);
@@ -72,9 +72,9 @@ static void ExecReplace(TupleTableSlot *slot, ItemPointer tupleid,
static TupleTableSlot *EvalPlanQualNext(EState *estate);
static void EndEvalPlanQual(EState *estate);
static void ExecCheckQueryPerms(CmdType operation, Query *parseTree,
- Plan *plan);
+ Plan *plan);
static void ExecCheckPlanPerms(Plan *plan, List *rangeTable,
- CmdType operation);
+ CmdType operation);
static void ExecCheckRTPerms(List *rangeTable, CmdType operation);
static void ExecCheckRTEPerms(RangeTblEntry *rte, CmdType operation);
@@ -91,7 +91,7 @@ static void ExecCheckRTEPerms(RangeTblEntry *rte, CmdType operation);
* be returned by the query.
*
* NB: the CurrentMemoryContext when this is called must be the context
- * to be used as the per-query context for the query plan. ExecutorRun()
+ * to be used as the per-query context for the query plan. ExecutorRun()
* and ExecutorEnd() must be called in this same memory context.
* ----------------------------------------------------------------
*/
@@ -287,6 +287,7 @@ ExecutorEnd(QueryDesc *queryDesc, EState *estate)
static void
ExecCheckQueryPerms(CmdType operation, Query *parseTree, Plan *plan)
{
+
/*
* Check RTEs in the query's primary rangetable.
*/
@@ -339,7 +340,7 @@ ExecCheckPlanPerms(Plan *plan, List *rangeTable, CmdType operation)
{
case T_SubqueryScan:
{
- SubqueryScan *scan = (SubqueryScan *) plan;
+ SubqueryScan *scan = (SubqueryScan *) plan;
RangeTblEntry *rte;
/* Recursively check the subquery */
@@ -405,12 +406,13 @@ ExecCheckRTEPerms(RangeTblEntry *rte, CmdType operation)
relName = rte->relname;
/*
- * userid to check as: current user unless we have a setuid indication.
+ * userid to check as: current user unless we have a setuid
+ * indication.
*
- * Note: GetUserId() is presently fast enough that there's no harm
- * in calling it separately for each RTE. If that stops being true,
- * we could call it once in ExecCheckQueryPerms and pass the userid
- * down from there. But for now, no need for the extra clutter.
+ * Note: GetUserId() is presently fast enough that there's no harm in
+ * calling it separately for each RTE. If that stops being true, we
+ * could call it once in ExecCheckQueryPerms and pass the userid down
+ * from there. But for now, no need for the extra clutter.
*/
userid = rte->checkAsUser ? rte->checkAsUser : GetUserId();
@@ -426,6 +428,7 @@ ExecCheckRTEPerms(RangeTblEntry *rte, CmdType operation)
if (rte->checkForWrite)
{
+
/*
* Note: write access in a SELECT context means SELECT FOR UPDATE.
* Right now we don't distinguish that from true update as far as
@@ -519,6 +522,7 @@ InitPlan(CmdType operation, Query *parseTree, Plan *plan, EState *estate)
if (resultRelations != NIL)
{
+
/*
* Multiple result relations (due to inheritance)
* parseTree->resultRelations identifies them all
@@ -541,8 +545,10 @@ InitPlan(CmdType operation, Query *parseTree, Plan *plan, EState *estate)
}
else
{
+
/*
- * Single result relation identified by parseTree->resultRelation
+ * Single result relation identified by
+ * parseTree->resultRelation
*/
numResultRelations = 1;
resultRelInfos = (ResultRelInfo *) palloc(sizeof(ResultRelInfo));
@@ -559,6 +565,7 @@ InitPlan(CmdType operation, Query *parseTree, Plan *plan, EState *estate)
}
else
{
+
/*
* if no result relation, then set state appropriately
*/
@@ -616,10 +623,10 @@ InitPlan(CmdType operation, Query *parseTree, Plan *plan, EState *estate)
tupType = ExecGetTupType(plan); /* tuple descriptor */
/*
- * Initialize the junk filter if needed. SELECT and INSERT queries need
- * a filter if there are any junk attrs in the tlist. UPDATE and
- * DELETE always need one, since there's always a junk 'ctid' attribute
- * present --- no need to look first.
+ * Initialize the junk filter if needed. SELECT and INSERT queries
+ * need a filter if there are any junk attrs in the tlist. UPDATE and
+ * DELETE always need one, since there's always a junk 'ctid'
+ * attribute present --- no need to look first.
*/
{
bool junk_filter_needed = false;
@@ -650,11 +657,12 @@ InitPlan(CmdType operation, Query *parseTree, Plan *plan, EState *estate)
if (junk_filter_needed)
{
+
/*
- * If there are multiple result relations, each one needs
- * its own junk filter. Note this is only possible for
- * UPDATE/DELETE, so we can't be fooled by some needing
- * a filter and some not.
+ * If there are multiple result relations, each one needs its
+ * own junk filter. Note this is only possible for
+ * UPDATE/DELETE, so we can't be fooled by some needing a
+ * filter and some not.
*/
if (parseTree->resultRelations != NIL)
{
@@ -678,6 +686,7 @@ InitPlan(CmdType operation, Query *parseTree, Plan *plan, EState *estate)
resultRelInfo++;
subplans = lnext(subplans);
}
+
/*
* Set active junkfilter too; at this point ExecInitAppend
* has already selected an active result relation...
@@ -750,10 +759,10 @@ InitPlan(CmdType operation, Query *parseTree, Plan *plan, EState *estate)
CommandCounterIncrement();
/*
- * If necessary, create a TOAST table for the into relation.
- * Note that AlterTableCreateToastTable ends with
- * CommandCounterIncrement(), so that the TOAST table will
- * be visible for insertion.
+ * If necessary, create a TOAST table for the into
+ * relation. Note that AlterTableCreateToastTable ends
+ * with CommandCounterIncrement(), so that the TOAST table
+ * will be visible for insertion.
*/
AlterTableCreateToastTable(intoName, true);
@@ -817,9 +826,8 @@ initResultRelInfo(ResultRelInfo *resultRelInfo,
/*
* If there are indices on the result relation, open them and save
* descriptors in the result relation info, so that we can add new
- * index entries for the tuples we add/update. We need not do
- * this for a DELETE, however, since deletion doesn't affect
- * indexes.
+ * index entries for the tuples we add/update. We need not do this
+ * for a DELETE, however, since deletion doesn't affect indexes.
*/
if (resultRelationDesc->rd_rel->relhasindex &&
operation != CMD_DELETE)
@@ -857,8 +865,8 @@ EndPlan(Plan *plan, EState *estate)
estate->es_tupleTable = NULL;
/*
- * close the result relation(s) if any, but hold locks
- * until xact commit. Also clean up junkfilters if present.
+ * close the result relation(s) if any, but hold locks until xact
+ * commit. Also clean up junkfilters if present.
*/
resultRelInfo = estate->es_result_relations;
for (i = estate->es_num_result_relations; i > 0; i--)
@@ -1033,7 +1041,7 @@ lnext: ;
/*
* Unlike the UPDATE/DELETE case, a null result is
* possible here, when the referenced table is on the
- * nullable side of an outer join. Ignore nulls.
+ * nullable side of an outer join. Ignore nulls.
*/
if (isNull)
continue;
@@ -1216,7 +1224,7 @@ ExecAppend(TupleTableSlot *slot,
/* BEFORE ROW INSERT Triggers */
if (resultRelationDesc->trigdesc &&
- resultRelationDesc->trigdesc->n_before_row[TRIGGER_EVENT_INSERT] > 0)
+ resultRelationDesc->trigdesc->n_before_row[TRIGGER_EVENT_INSERT] > 0)
{
HeapTuple newtuple;
@@ -1227,11 +1235,12 @@ ExecAppend(TupleTableSlot *slot,
if (newtuple != tuple) /* modified by Trigger(s) */
{
+
/*
* Insert modified tuple into tuple table slot, replacing the
* original. We assume that it was allocated in per-tuple
- * memory context, and therefore will go away by itself.
- * The tuple table slot should not try to clear it.
+ * memory context, and therefore will go away by itself. The
+ * tuple table slot should not try to clear it.
*/
ExecStoreTuple(newtuple, slot, InvalidBuffer, false);
tuple = newtuple;
@@ -1294,7 +1303,7 @@ ExecDelete(TupleTableSlot *slot,
/* BEFORE ROW DELETE Triggers */
if (resultRelationDesc->trigdesc &&
- resultRelationDesc->trigdesc->n_before_row[TRIGGER_EVENT_DELETE] > 0)
+ resultRelationDesc->trigdesc->n_before_row[TRIGGER_EVENT_DELETE] > 0)
{
bool dodelete;
@@ -1323,7 +1332,7 @@ ldelete:;
else if (!(ItemPointerEquals(tupleid, &ctid)))
{
TupleTableSlot *epqslot = EvalPlanQual(estate,
- resultRelInfo->ri_RangeTableIndex, &ctid);
+ resultRelInfo->ri_RangeTableIndex, &ctid);
if (!TupIsNull(epqslot))
{
@@ -1400,7 +1409,7 @@ ExecReplace(TupleTableSlot *slot,
/* BEFORE ROW UPDATE Triggers */
if (resultRelationDesc->trigdesc &&
- resultRelationDesc->trigdesc->n_before_row[TRIGGER_EVENT_UPDATE] > 0)
+ resultRelationDesc->trigdesc->n_before_row[TRIGGER_EVENT_UPDATE] > 0)
{
HeapTuple newtuple;
@@ -1411,11 +1420,12 @@ ExecReplace(TupleTableSlot *slot,
if (newtuple != tuple) /* modified by Trigger(s) */
{
+
/*
* Insert modified tuple into tuple table slot, replacing the
* original. We assume that it was allocated in per-tuple
- * memory context, and therefore will go away by itself.
- * The tuple table slot should not try to clear it.
+ * memory context, and therefore will go away by itself. The
+ * tuple table slot should not try to clear it.
*/
ExecStoreTuple(newtuple, slot, InvalidBuffer, false);
tuple = newtuple;
@@ -1447,7 +1457,7 @@ lreplace:;
else if (!(ItemPointerEquals(tupleid, &ctid)))
{
TupleTableSlot *epqslot = EvalPlanQual(estate,
- resultRelInfo->ri_RangeTableIndex, &ctid);
+ resultRelInfo->ri_RangeTableIndex, &ctid);
if (!TupIsNull(epqslot))
{
@@ -1469,10 +1479,10 @@ lreplace:;
/*
* Note: instead of having to update the old index tuples associated
- * with the heap tuple, all we do is form and insert new index
- * tuples. This is because replaces are actually deletes and inserts
- * and index tuple deletion is done automagically by the vacuum
- * daemon. All we do is insert new index tuples. -cim 9/27/89
+ * with the heap tuple, all we do is form and insert new index tuples.
+ * This is because replaces are actually deletes and inserts and index
+ * tuple deletion is done automagically by the vacuum daemon. All we
+ * do is insert new index tuples. -cim 9/27/89
*/
/*
@@ -1525,8 +1535,8 @@ ExecRelCheck(ResultRelInfo *resultRelInfo,
}
/*
- * We will use the EState's per-tuple context for evaluating constraint
- * expressions (creating it if it's not already there).
+ * We will use the EState's per-tuple context for evaluating
+ * constraint expressions (creating it if it's not already there).
*/
econtext = GetPerTupleExprContext(estate);
@@ -1568,10 +1578,10 @@ ExecConstraints(char *caller, ResultRelInfo *resultRelInfo,
for (attrChk = 1; attrChk <= natts; attrChk++)
{
- if (rel->rd_att->attrs[attrChk-1]->attnotnull &&
+ if (rel->rd_att->attrs[attrChk - 1]->attnotnull &&
heap_attisnull(tuple, attrChk))
elog(ERROR, "%s: Fail to add null value in not null attribute %s",
- caller, NameStr(rel->rd_att->attrs[attrChk-1]->attname));
+ caller, NameStr(rel->rd_att->attrs[attrChk - 1]->attname));
}
}
diff --git a/src/backend/executor/execQual.c b/src/backend/executor/execQual.c
index bab2851df9d..79873073b7a 100644
--- a/src/backend/executor/execQual.c
+++ b/src/backend/executor/execQual.c
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/executor/execQual.c,v 1.83 2001/01/29 00:39:18 tgl Exp $
+ * $Header: /cvsroot/pgsql/src/backend/executor/execQual.c,v 1.84 2001/03/22 03:59:26 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -46,22 +46,22 @@
/* static function decls */
static Datum ExecEvalAggref(Aggref *aggref, ExprContext *econtext,
- bool *isNull);
+ bool *isNull);
static Datum ExecEvalArrayRef(ArrayRef *arrayRef, ExprContext *econtext,
- bool *isNull, ExprDoneCond *isDone);
+ bool *isNull, ExprDoneCond *isDone);
static Datum ExecEvalVar(Var *variable, ExprContext *econtext, bool *isNull);
static Datum ExecEvalOper(Expr *opClause, ExprContext *econtext,
- bool *isNull, ExprDoneCond *isDone);
+ bool *isNull, ExprDoneCond *isDone);
static Datum ExecEvalFunc(Expr *funcClause, ExprContext *econtext,
- bool *isNull, ExprDoneCond *isDone);
+ bool *isNull, ExprDoneCond *isDone);
static ExprDoneCond ExecEvalFuncArgs(FunctionCachePtr fcache,
- List *argList,
- ExprContext *econtext);
+ List *argList,
+ ExprContext *econtext);
static Datum ExecEvalNot(Expr *notclause, ExprContext *econtext, bool *isNull);
static Datum ExecEvalAnd(Expr *andExpr, ExprContext *econtext, bool *isNull);
static Datum ExecEvalOr(Expr *orExpr, ExprContext *econtext, bool *isNull);
static Datum ExecEvalCase(CaseExpr *caseExpr, ExprContext *econtext,
- bool *isNull, ExprDoneCond *isDone);
+ bool *isNull, ExprDoneCond *isDone);
/*----------
@@ -77,7 +77,7 @@ static Datum ExecEvalCase(CaseExpr *caseExpr, ExprContext *econtext,
* done in versions up through 7.0) then an assignment like
* UPDATE table SET arrayfield[4] = NULL
* will result in setting the whole array to NULL, which is certainly not
- * very desirable. By returning the source array we make the assignment
+ * very desirable. By returning the source array we make the assignment
* into a no-op, instead. (Eventually we need to redesign arrays so that
* individual elements can be NULL, but for now, let's try to protect users
* from shooting themselves in the foot.)
@@ -112,10 +112,11 @@ ExecEvalArrayRef(ArrayRef *arrayRef,
econtext,
isNull,
isDone));
+
/*
* If refexpr yields NULL, result is always NULL, for now anyway.
- * (This means you cannot assign to an element or slice of an array
- * that's NULL; it'll just stay NULL.)
+ * (This means you cannot assign to an element or slice of an
+ * array that's NULL; it'll just stay NULL.)
*/
if (*isNull)
return (Datum) NULL;
@@ -147,7 +148,7 @@ ExecEvalArrayRef(ArrayRef *arrayRef,
/* If any index expr yields NULL, result is NULL or source array */
if (*isNull)
{
- if (! isAssignment || array_source == NULL)
+ if (!isAssignment || array_source == NULL)
return (Datum) NULL;
*isNull = false;
return PointerGetDatum(array_source);
@@ -166,10 +167,14 @@ ExecEvalArrayRef(ArrayRef *arrayRef,
econtext,
isNull,
NULL));
- /* If any index expr yields NULL, result is NULL or source array */
+
+ /*
+ * If any index expr yields NULL, result is NULL or source
+ * array
+ */
if (*isNull)
{
- if (! isAssignment || array_source == NULL)
+ if (!isAssignment || array_source == NULL)
return (Datum) NULL;
*isNull = false;
return PointerGetDatum(array_source);
@@ -189,9 +194,10 @@ ExecEvalArrayRef(ArrayRef *arrayRef,
econtext,
isNull,
NULL);
+
/*
- * For now, can't cope with inserting NULL into an array,
- * so make it a no-op per discussion above...
+ * For now, can't cope with inserting NULL into an array, so make
+ * it a no-op per discussion above...
*/
if (*isNull)
{
@@ -202,7 +208,7 @@ ExecEvalArrayRef(ArrayRef *arrayRef,
}
if (array_source == NULL)
- return sourceData; /* XXX do something else? */
+ return sourceData; /* XXX do something else? */
if (lIndex == NULL)
resultArray = array_set(array_source, i,
@@ -215,7 +221,7 @@ ExecEvalArrayRef(ArrayRef *arrayRef,
else
resultArray = array_set_slice(array_source, i,
upper.indx, lower.indx,
- (ArrayType *) DatumGetPointer(sourceData),
+ (ArrayType *) DatumGetPointer(sourceData),
arrayRef->refelembyval,
arrayRef->refelemlength,
arrayRef->refattrlength,
@@ -587,12 +593,12 @@ ExecEvalFuncArgs(FunctionCachePtr fcache,
int i;
List *arg;
- argIsDone = ExprSingleResult; /* default assumption */
+ argIsDone = ExprSingleResult; /* default assumption */
i = 0;
foreach(arg, argList)
{
- ExprDoneCond thisArgIsDone;
+ ExprDoneCond thisArgIsDone;
fcache->fcinfo.arg[i] = ExecEvalExpr((Node *) lfirst(arg),
econtext,
@@ -601,10 +607,12 @@ ExecEvalFuncArgs(FunctionCachePtr fcache,
if (thisArgIsDone != ExprSingleResult)
{
+
/*
* We allow only one argument to have a set value; we'd need
- * much more complexity to keep track of multiple set arguments
- * (cf. ExecTargetList) and it doesn't seem worth it.
+ * much more complexity to keep track of multiple set
+ * arguments (cf. ExecTargetList) and it doesn't seem worth
+ * it.
*/
if (argIsDone != ExprSingleResult)
elog(ERROR, "Functions and operators can take only one set argument");
@@ -632,15 +640,15 @@ ExecMakeFunctionResult(FunctionCachePtr fcache,
bool *isNull,
ExprDoneCond *isDone)
{
- Datum result;
- ExprDoneCond argDone;
- int i;
+ Datum result;
+ ExprDoneCond argDone;
+ int i;
/*
* arguments is a list of expressions to evaluate before passing to
* the function manager. We skip the evaluation if it was already
- * done in the previous call (ie, we are continuing the evaluation
- * of a set-valued function). Otherwise, collect the current argument
+ * done in the previous call (ie, we are continuing the evaluation of
+ * a set-valued function). Otherwise, collect the current argument
* values into fcache->fcinfo.
*/
if (fcache->fcinfo.nargs > 0 && !fcache->argsValid)
@@ -664,28 +672,30 @@ ExecMakeFunctionResult(FunctionCachePtr fcache,
*/
if (fcache->func.fn_retset || fcache->hasSetArg)
{
+
/*
- * We need to return a set result. Complain if caller not ready
+ * We need to return a set result. Complain if caller not ready
* to accept one.
*/
if (isDone == NULL)
elog(ERROR, "Set-valued function called in context that cannot accept a set");
/*
- * This loop handles the situation where we have both a set argument
- * and a set-valued function. Once we have exhausted the function's
- * value(s) for a particular argument value, we have to get the next
- * argument value and start the function over again. We might have
- * to do it more than once, if the function produces an empty result
- * set for a particular input value.
+ * This loop handles the situation where we have both a set
+ * argument and a set-valued function. Once we have exhausted the
+ * function's value(s) for a particular argument value, we have to
+ * get the next argument value and start the function over again.
+ * We might have to do it more than once, if the function produces
+ * an empty result set for a particular input value.
*/
for (;;)
{
+
/*
* If function is strict, and there are any NULL arguments,
* skip calling the function (at least for this set of args).
*/
- bool callit = true;
+ bool callit = true;
if (fcache->func.fn_strict)
{
@@ -716,13 +726,15 @@ ExecMakeFunctionResult(FunctionCachePtr fcache,
if (*isDone != ExprEndResult)
{
+
/*
- * Got a result from current argument. If function itself
- * returns set, flag that we want to reuse current argument
- * values on next call.
+ * Got a result from current argument. If function itself
+ * returns set, flag that we want to reuse current
+ * argument values on next call.
*/
if (fcache->func.fn_retset)
fcache->argsValid = true;
+
/*
* Make sure we say we are returning a set, even if the
* function itself doesn't return sets.
@@ -762,11 +774,12 @@ ExecMakeFunctionResult(FunctionCachePtr fcache,
}
else
{
+
/*
* Non-set case: much easier.
*
- * If function is strict, and there are any NULL arguments,
- * skip calling the function and return NULL.
+ * If function is strict, and there are any NULL arguments, skip
+ * calling the function and return NULL.
*/
if (fcache->func.fn_strict)
{
@@ -852,9 +865,9 @@ ExecEvalFunc(Expr *funcClause,
FunctionCachePtr fcache;
/*
- * we extract the oid of the function associated with the func node and
- * then pass the work onto ExecMakeFunctionResult which evaluates the
- * arguments and returns the result of calling the function on the
+ * we extract the oid of the function associated with the func node
+ * and then pass the work onto ExecMakeFunctionResult which evaluates
+ * the arguments and returns the result of calling the function on the
* evaluated arguments.
*
* this is nearly identical to the ExecEvalOper code.
@@ -915,7 +928,7 @@ ExecEvalNot(Expr *notclause, ExprContext *econtext, bool *isNull)
* evaluation of 'not' is simple.. expr is false, then return 'true'
* and vice versa.
*/
- return BoolGetDatum(! DatumGetBool(expr_value));
+ return BoolGetDatum(!DatumGetBool(expr_value));
}
/* ----------------------------------------------------------------
@@ -999,7 +1012,7 @@ ExecEvalAnd(Expr *andExpr, ExprContext *econtext, bool *isNull)
*/
if (*isNull)
AnyNull = true; /* remember we got a null */
- else if (! DatumGetBool(clause_value))
+ else if (!DatumGetBool(clause_value))
return clause_value;
}
@@ -1079,7 +1092,7 @@ ExecEvalFieldSelect(FieldSelect *fselect,
bool *isNull,
ExprDoneCond *isDone)
{
- Datum result;
+ Datum result;
TupleTableSlot *resSlot;
result = ExecEvalExpr(fselect->arg, econtext, isNull, isDone);
@@ -1111,7 +1124,7 @@ ExecEvalFieldSelect(FieldSelect *fselect,
*
* A caller that can only accept a singleton (non-set) result should pass
* NULL for isDone; if the expression computes a set result then an elog()
- * error will be reported. If the caller does pass an isDone pointer then
+ * error will be reported. If the caller does pass an isDone pointer then
* *isDone is set to one of these three states:
* ExprSingleResult singleton result (not a set)
* ExprMultipleResult return value is one element of a set
@@ -1127,7 +1140,7 @@ ExecEvalFieldSelect(FieldSelect *fselect,
* The caller should already have switched into the temporary memory
* context econtext->ecxt_per_tuple_memory. The convenience entry point
* ExecEvalExprSwitchContext() is provided for callers who don't prefer to
- * do the switch in an outer loop. We do not do the switch here because
+ * do the switch in an outer loop. We do not do the switch here because
* it'd be a waste of cycles during recursive entries to ExecEvalExpr().
*
* This routine is an inner loop routine and must be as fast as possible.
@@ -1353,15 +1366,15 @@ ExecQual(List *qual, ExprContext *econtext, bool resultForNull)
{
if (resultForNull == false)
{
- result = false; /* treat NULL as FALSE */
+ result = false; /* treat NULL as FALSE */
break;
}
}
else
{
- if (! DatumGetBool(expr_value))
+ if (!DatumGetBool(expr_value))
{
- result = false; /* definitely FALSE */
+ result = false; /* definitely FALSE */
break;
}
}
@@ -1383,7 +1396,7 @@ ExecTargetListLength(List *targetlist)
foreach(tl, targetlist)
{
- TargetEntry *curTle = (TargetEntry *) lfirst(tl);
+ TargetEntry *curTle = (TargetEntry *) lfirst(tl);
if (curTle->resdom != NULL)
len++;
@@ -1404,17 +1417,15 @@ ExecCleanTargetListLength(List *targetlist)
foreach(tl, targetlist)
{
- TargetEntry *curTle = (TargetEntry *) lfirst(tl);
+ TargetEntry *curTle = (TargetEntry *) lfirst(tl);
if (curTle->resdom != NULL)
{
- if (! curTle->resdom->resjunk)
+ if (!curTle->resdom->resjunk)
len++;
}
else
- {
len += curTle->fjoin->fj_nNodes;
- }
}
return len;
}
@@ -1440,6 +1451,7 @@ ExecTargetList(List *targetlist,
ExprDoneCond *isDone)
{
MemoryContext oldContext;
+
#define NPREALLOCDOMAINS 64
char nullsArray[NPREALLOCDOMAINS];
bool fjIsNullArray[NPREALLOCDOMAINS];
@@ -1484,10 +1496,11 @@ ExecTargetList(List *targetlist,
* we have a really large targetlist. otherwise we use the stack.
*
* We also allocate a bool array that is used to hold fjoin result state,
- * and another array that holds the isDone status for each targetlist item.
- * The isDone status is needed so that we can iterate, generating multiple
- * tuples, when one or more tlist items return sets. (We expect the caller
- * to call us again if we return *isDone = ExprMultipleResult.)
+ * and another array that holds the isDone status for each targetlist
+ * item. The isDone status is needed so that we can iterate,
+ * generating multiple tuples, when one or more tlist items return
+ * sets. (We expect the caller to call us again if we return *isDone
+ * = ExprMultipleResult.)
*/
if (nodomains > NPREALLOCDOMAINS)
{
@@ -1507,7 +1520,7 @@ ExecTargetList(List *targetlist,
*/
if (isDone)
- *isDone = ExprSingleResult; /* until proven otherwise */
+ *isDone = ExprSingleResult; /* until proven otherwise */
haveDoneSets = false; /* any exhausted set exprs in tlist? */
@@ -1554,8 +1567,10 @@ ExecTargetList(List *targetlist,
ExecEvalFjoin(tle, econtext, fjIsNull, isDone);
- /* XXX this is wrong, but since fjoin code is completely broken
- * anyway, I'm not going to worry about it now --- tgl 8/23/00
+ /*
+ * XXX this is wrong, but since fjoin code is completely
+ * broken anyway, I'm not going to worry about it now --- tgl
+ * 8/23/00
*/
if (isDone && *isDone == ExprEndResult)
{
@@ -1594,6 +1609,7 @@ ExecTargetList(List *targetlist,
if (haveDoneSets)
{
+
/*
* note: can't get here unless we verified isDone != NULL
*/
@@ -1601,7 +1617,8 @@ ExecTargetList(List *targetlist,
{
/*
- * all sets are done, so report that tlist expansion is complete.
+ * all sets are done, so report that tlist expansion is
+ * complete.
*/
*isDone = ExprEndResult;
MemoryContextSwitchTo(oldContext);
@@ -1612,7 +1629,7 @@ ExecTargetList(List *targetlist,
{
/*
- * We have some done and some undone sets. Restart the done
+ * We have some done and some undone sets. Restart the done
* ones so that we can deliver a tuple (if possible).
*/
foreach(tl, targetlist)
@@ -1628,7 +1645,7 @@ ExecTargetList(List *targetlist,
values[resind] = ExecEvalExpr(tle->expr,
econtext,
&isNull,
- &itemIsDone[resind]);
+ &itemIsDone[resind]);
nulls[resind] = isNull ? 'n' : ' ';
if (itemIsDone[resind] == ExprEndResult)
@@ -1644,10 +1661,11 @@ ExecTargetList(List *targetlist,
}
}
}
+
/*
- * If we cannot make a tuple because some sets are empty,
- * we still have to cycle the nonempty sets to completion,
- * else resources will not be released from subplans etc.
+ * If we cannot make a tuple because some sets are empty, we
+ * still have to cycle the nonempty sets to completion, else
+ * resources will not be released from subplans etc.
*/
if (*isDone == ExprEndResult)
{
@@ -1752,8 +1770,8 @@ ExecProject(ProjectionInfo *projInfo, ExprDoneCond *isDone)
/*
* store the tuple in the projection slot and return the slot.
*/
- return ExecStoreTuple(newTuple, /* tuple to store */
- slot, /* slot to store in */
- InvalidBuffer, /* tuple has no buffer */
+ return ExecStoreTuple(newTuple, /* tuple to store */
+ slot, /* slot to store in */
+ InvalidBuffer, /* tuple has no buffer */
true);
}
diff --git a/src/backend/executor/execScan.c b/src/backend/executor/execScan.c
index 3a2e79dbdd4..58a3b5edea4 100644
--- a/src/backend/executor/execScan.c
+++ b/src/backend/executor/execScan.c
@@ -12,7 +12,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/executor/execScan.c,v 1.15 2001/01/24 19:42:54 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/executor/execScan.c,v 1.16 2001/03/22 03:59:26 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -46,7 +46,7 @@
*/
TupleTableSlot *
ExecScan(Scan *node,
- ExecScanAccessMtd accessMtd) /* function returning a tuple */
+ ExecScanAccessMtd accessMtd) /* function returning a tuple */
{
CommonScanState *scanstate;
EState *estate;
@@ -81,7 +81,7 @@ ExecScan(Scan *node,
/* ----------------
* Reset per-tuple memory context to free any expression evaluation
- * storage allocated in the previous tuple cycle. Note this can't
+ * storage allocated in the previous tuple cycle. Note this can't
* happen until we're done projecting out tuples from a scan tuple.
* ----------------
*/
diff --git a/src/backend/executor/execTuples.c b/src/backend/executor/execTuples.c
index e5f1a269d81..3e75aef337c 100644
--- a/src/backend/executor/execTuples.c
+++ b/src/backend/executor/execTuples.c
@@ -15,7 +15,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/executor/execTuples.c,v 1.46 2001/01/29 00:39:18 tgl Exp $
+ * $Header: /cvsroot/pgsql/src/backend/executor/execTuples.c,v 1.47 2001/03/22 03:59:26 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -40,7 +40,7 @@
* TupIsNull - true when slot contains no tuple(Macro)
*
* CONVENIENCE INITIALIZATION ROUTINES
- * ExecInitResultTupleSlot \ convenience routines to initialize
+ * ExecInitResultTupleSlot \ convenience routines to initialize
* ExecInitScanTupleSlot \ the various tuple slots for nodes
* ExecInitExtraTupleSlot / which store copies of tuples.
* ExecInitNullTupleSlot /
@@ -422,7 +422,7 @@ ExecClearTuple(TupleTableSlot *slot) /* slot in which to store tuple */
slot->val = (HeapTuple) NULL;
- slot->ttc_shouldFree = true; /* probably useless code... */
+ slot->ttc_shouldFree = true;/* probably useless code... */
/* ----------------
* Drop the pin on the referenced buffer, if there is one.
@@ -446,7 +446,7 @@ ExecClearTuple(TupleTableSlot *slot) /* slot in which to store tuple */
void
ExecSetSlotDescriptor(TupleTableSlot *slot, /* slot to change */
TupleDesc tupdesc, /* new tuple descriptor */
- bool shouldFree) /* is desc owned by slot? */
+ bool shouldFree) /* is desc owned by slot? */
{
if (slot->ttc_shouldFreeDesc &&
slot->ttc_tupleDescriptor != NULL)
@@ -482,7 +482,7 @@ ExecSetSlotDescriptorIsNew(TupleTableSlot *slot, /* slot to change */
* ExecInit{Result,Scan,Extra}TupleSlot
*
* These are convenience routines to initialize the specified slot
- * in nodes inheriting the appropriate state. ExecInitExtraTupleSlot
+ * in nodes inheriting the appropriate state. ExecInitExtraTupleSlot
* is used for initializing special-purpose slots.
* --------------------------------
*/
@@ -541,11 +541,13 @@ ExecInitExtraTupleSlot(EState *estate)
TupleTableSlot *
ExecInitNullTupleSlot(EState *estate, TupleDesc tupType)
{
- TupleTableSlot* slot = ExecInitExtraTupleSlot(estate);
+ TupleTableSlot *slot = ExecInitExtraTupleSlot(estate);
+
/*
* Since heap_getattr() will treat attributes beyond a tuple's t_natts
- * as being NULL, we can make an all-nulls tuple just by making it be of
- * zero length. However, the slot descriptor must match the real tupType.
+ * as being NULL, we can make an all-nulls tuple just by making it be
+ * of zero length. However, the slot descriptor must match the real
+ * tupType.
*/
HeapTuple nullTuple;
Datum values[1];
diff --git a/src/backend/executor/execUtils.c b/src/backend/executor/execUtils.c
index 6b030b64a0e..6ee0d2e26ed 100644
--- a/src/backend/executor/execUtils.c
+++ b/src/backend/executor/execUtils.c
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/executor/execUtils.c,v 1.73 2001/01/29 00:39:19 tgl Exp $
+ * $Header: /cvsroot/pgsql/src/backend/executor/execUtils.c,v 1.74 2001/03/22 03:59:26 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -148,6 +148,7 @@ ExecAssignExprContext(EState *estate, CommonState *commonstate)
econtext->ecxt_innertuple = NULL;
econtext->ecxt_outertuple = NULL;
econtext->ecxt_per_query_memory = CurrentMemoryContext;
+
/*
* Create working memory for expression evaluation in this context.
*/
@@ -184,14 +185,16 @@ MakeExprContext(TupleTableSlot *slot,
econtext->ecxt_innertuple = NULL;
econtext->ecxt_outertuple = NULL;
econtext->ecxt_per_query_memory = queryContext;
+
/*
* We make the temporary context a child of current working context,
* not of the specified queryContext. This seems reasonable but I'm
* not totally sure about it...
*
* Expression contexts made via this routine typically don't live long
- * enough to get reset, so specify a minsize of 0. That avoids alloc'ing
- * any memory in the common case where expr eval doesn't use any.
+ * enough to get reset, so specify a minsize of 0. That avoids
+ * alloc'ing any memory in the common case where expr eval doesn't use
+ * any.
*/
econtext->ecxt_per_tuple_memory =
AllocSetContextCreate(CurrentMemoryContext,
@@ -209,7 +212,7 @@ MakeExprContext(TupleTableSlot *slot,
/*
* Free an ExprContext made by MakeExprContext, including the temporary
- * context used for expression evaluation. Note this will cause any
+ * context used for expression evaluation. Note this will cause any
* pass-by-reference expression result to go away!
*/
void
@@ -447,7 +450,7 @@ ExecAssignScanTypeFromOuterPlan(Plan *node, CommonScanState *csstate)
* resultRelInfo->ri_RelationDesc.
*
* This used to be horribly ugly code, and slow too because it
- * did a sequential scan of pg_index. Now we rely on the relcache
+ * did a sequential scan of pg_index. Now we rely on the relcache
* to cache a list of the OIDs of the indices associated with any
* specific relation, and we use the pg_index syscache to get the
* entries we need from pg_index.
@@ -467,7 +470,7 @@ ExecOpenIndices(ResultRelInfo *resultRelInfo)
resultRelInfo->ri_NumIndices = 0;
/* checks for disabled indexes */
- if (! RelationGetForm(resultRelation)->relhasindex)
+ if (!RelationGetForm(resultRelation)->relhasindex)
return;
if (IsIgnoringSystemIndexes() &&
IsSystemRelationName(RelationGetRelationName(resultRelation)))
@@ -635,8 +638,9 @@ ExecInsertIndexTuples(TupleTableSlot *slot,
heapDescriptor = RelationGetDescr(heapRelation);
/*
- * We will use the EState's per-tuple context for evaluating predicates
- * and functional-index functions (creating it if it's not already there).
+ * We will use the EState's per-tuple context for evaluating
+ * predicates and functional-index functions (creating it if it's not
+ * already there).
*/
econtext = GetPerTupleExprContext(estate);
diff --git a/src/backend/executor/functions.c b/src/backend/executor/functions.c
index 575f33d84b6..4cc1dc27926 100644
--- a/src/backend/executor/functions.c
+++ b/src/backend/executor/functions.c
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/executor/functions.c,v 1.43 2001/01/29 00:39:19 tgl Exp $
+ * $Header: /cvsroot/pgsql/src/backend/executor/functions.c,v 1.44 2001/03/22 03:59:26 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -70,15 +70,15 @@ typedef SQLFunctionCache *SQLFunctionCachePtr;
/* non-export function prototypes */
static execution_state *init_execution_state(char *src,
- Oid *argOidVect, int nargs);
+ Oid *argOidVect, int nargs);
static void init_sql_fcache(FmgrInfo *finfo);
static void postquel_start(execution_state *es);
static TupleTableSlot *postquel_getnext(execution_state *es);
static void postquel_end(execution_state *es);
static void postquel_sub_params(execution_state *es, FunctionCallInfo fcinfo);
static Datum postquel_execute(execution_state *es,
- FunctionCallInfo fcinfo,
- SQLFunctionCachePtr fcache);
+ FunctionCallInfo fcinfo,
+ SQLFunctionCachePtr fcache);
static execution_state *
@@ -180,7 +180,7 @@ init_sql_fcache(FmgrInfo *finfo)
* ----------------
*/
typeTuple = SearchSysCache(TYPEOID,
- ObjectIdGetDatum(procedureStruct->prorettype),
+ ObjectIdGetDatum(procedureStruct->prorettype),
0, 0, 0);
if (!HeapTupleIsValid(typeTuple))
elog(ERROR, "init_sql_fcache: Cache lookup failed for type %u",
@@ -235,9 +235,7 @@ init_sql_fcache(FmgrInfo *finfo)
nargs * sizeof(Oid));
}
else
- {
argOidVect = (Oid *) NULL;
- }
tmp = SysCacheGetAttr(PROCOID,
procedureTuple,
@@ -346,8 +344,8 @@ copy_function_result(SQLFunctionCachePtr fcache,
return resultSlot; /* no need to copy result */
/*
- * If first time through, we have to initialize the funcSlot's
- * tuple descriptor.
+ * If first time through, we have to initialize the funcSlot's tuple
+ * descriptor.
*/
if (funcSlot->ttc_tupleDescriptor == NULL)
{
@@ -415,12 +413,14 @@ postquel_execute(execution_state *es,
/*
* If we are supposed to return a tuple, we return the tuple slot
- * pointer converted to Datum. If we are supposed to return a simple
- * value, then project out the first attribute of the result tuple
- * (ie, take the first result column of the final SELECT).
+ * pointer converted to Datum. If we are supposed to return a
+ * simple value, then project out the first attribute of the
+ * result tuple (ie, take the first result column of the final
+ * SELECT).
*/
if (fcache->returnsTuple)
{
+
/*
* XXX do we need to remove junk attrs from the result tuple?
* Probably OK to leave them, as long as they are at the end.
@@ -434,6 +434,7 @@ postquel_execute(execution_state *es,
1,
resSlot->ttc_tupleDescriptor,
&(fcinfo->isnull));
+
/*
* Note: if result type is pass-by-reference then we are
* returning a pointer into the tuple copied by
@@ -546,7 +547,7 @@ fmgr_sql(PG_FUNCTION_ARGS)
*/
if (fcinfo->flinfo->fn_retset)
{
- ReturnSetInfo *rsi = (ReturnSetInfo *) fcinfo->resultinfo;
+ ReturnSetInfo *rsi = (ReturnSetInfo *) fcinfo->resultinfo;
if (rsi && IsA(rsi, ReturnSetInfo))
rsi->isDone = ExprEndResult;
@@ -572,7 +573,7 @@ fmgr_sql(PG_FUNCTION_ARGS)
*/
if (fcinfo->flinfo->fn_retset)
{
- ReturnSetInfo *rsi = (ReturnSetInfo *) fcinfo->resultinfo;
+ ReturnSetInfo *rsi = (ReturnSetInfo *) fcinfo->resultinfo;
if (rsi && IsA(rsi, ReturnSetInfo))
rsi->isDone = ExprMultipleResult;
diff --git a/src/backend/executor/nodeAgg.c b/src/backend/executor/nodeAgg.c
index f60f499e6be..e0f50bd66d1 100644
--- a/src/backend/executor/nodeAgg.c
+++ b/src/backend/executor/nodeAgg.c
@@ -19,7 +19,7 @@
* The agg's input type and transtype must be the same in this case!
*
* If transfunc is marked "strict" then NULL input_values are skipped,
- * keeping the previous transvalue. If transfunc is not strict then it
+ * keeping the previous transvalue. If transfunc is not strict then it
* is called for every input tuple and must deal with NULL initcond
* or NULL input_value for itself.
*
@@ -34,7 +34,7 @@
* are not allowed to accumulate until end of query. We do this by
* "ping-ponging" between two memory contexts; successive calls to the
* transfunc are executed in alternate contexts, passing the previous
- * transvalue that is in the other context. At the beginning of each
+ * transvalue that is in the other context. At the beginning of each
* tuple cycle we can reset the current output context to avoid memory
* usage growth. Note: we must use MemoryContextContains() to check
* whether the transfunc has perhaps handed us back one of its input
@@ -46,7 +46,7 @@
* Portions Copyright (c) 1994, Regents of the University of California
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/executor/nodeAgg.c,v 1.75 2001/02/16 03:16:57 tgl Exp $
+ * $Header: /cvsroot/pgsql/src/backend/executor/nodeAgg.c,v 1.76 2001/03/22 03:59:27 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -130,8 +130,8 @@ typedef struct AggStatePerAggData
* an input tuple group and updated for each input tuple.
*
* For a simple (non DISTINCT) aggregate, we just feed the input values
- * straight to the transition function. If it's DISTINCT, we pass
- * the input values into a Tuplesort object; then at completion of the
+ * straight to the transition function. If it's DISTINCT, we pass the
+ * input values into a Tuplesort object; then at completion of the
* input tuple group, we scan the sorted values, eliminate duplicates,
* and run the transition function on the rest.
*/
@@ -144,20 +144,21 @@ typedef struct AggStatePerAggData
bool noTransValue; /* true if transValue not set yet */
/*
- * Note: noTransValue initially has the same value as transValueIsNull,
- * and if true both are cleared to false at the same time. They are
- * not the same though: if transfn later returns a NULL, we want to
- * keep that NULL and not auto-replace it with a later input value.
- * Only the first non-NULL input will be auto-substituted.
+ * Note: noTransValue initially has the same value as
+ * transValueIsNull, and if true both are cleared to false at the same
+ * time. They are not the same though: if transfn later returns a
+ * NULL, we want to keep that NULL and not auto-replace it with a
+ * later input value. Only the first non-NULL input will be
+ * auto-substituted.
*/
} AggStatePerAggData;
static void initialize_aggregate(AggStatePerAgg peraggstate);
static void advance_transition_function(AggStatePerAgg peraggstate,
- Datum newVal, bool isNull);
+ Datum newVal, bool isNull);
static void process_sorted_aggregate(AggState *aggstate,
- AggStatePerAgg peraggstate);
+ AggStatePerAgg peraggstate);
static void finalize_aggregate(AggStatePerAgg peraggstate,
Datum *resultVal, bool *resultIsNull);
@@ -195,8 +196,8 @@ initialize_aggregate(AggStatePerAgg peraggstate)
* (Re)set transValue to the initial value.
*
* Note that when the initial value is pass-by-ref, we just reuse it
- * without copying for each group. Hence, transition function
- * had better not scribble on its input, or it will fail for GROUP BY!
+ * without copying for each group. Hence, transition function had
+ * better not scribble on its input, or it will fail for GROUP BY!
*/
peraggstate->transValue = peraggstate->initValue;
peraggstate->transValueIsNull = peraggstate->initValueIsNull;
@@ -222,50 +223,55 @@ static void
advance_transition_function(AggStatePerAgg peraggstate,
Datum newVal, bool isNull)
{
- FunctionCallInfoData fcinfo;
+ FunctionCallInfoData fcinfo;
if (peraggstate->transfn.fn_strict)
{
if (isNull)
{
+
/*
- * For a strict transfn, nothing happens at a NULL input tuple;
- * we just keep the prior transValue. However, if the transtype
- * is pass-by-ref, we have to copy it into the new context
- * because the old one is going to get reset.
+ * For a strict transfn, nothing happens at a NULL input
+ * tuple; we just keep the prior transValue. However, if the
+ * transtype is pass-by-ref, we have to copy it into the new
+ * context because the old one is going to get reset.
*/
if (!peraggstate->transValueIsNull)
peraggstate->transValue = datumCopy(peraggstate->transValue,
- peraggstate->transtypeByVal,
- peraggstate->transtypeLen);
+ peraggstate->transtypeByVal,
+ peraggstate->transtypeLen);
return;
}
if (peraggstate->noTransValue)
{
+
/*
- * transValue has not been initialized. This is the first non-NULL
- * input value. We use it as the initial value for transValue.
- * (We already checked that the agg's input type is binary-
- * compatible with its transtype, so straight copy here is OK.)
+ * transValue has not been initialized. This is the first
+ * non-NULL input value. We use it as the initial value for
+ * transValue. (We already checked that the agg's input type
+ * is binary- compatible with its transtype, so straight copy
+ * here is OK.)
*
- * We had better copy the datum if it is pass-by-ref, since
- * the given pointer may be pointing into a scan tuple that
- * will be freed on the next iteration of the scan.
+ * We had better copy the datum if it is pass-by-ref, since the
+ * given pointer may be pointing into a scan tuple that will
+ * be freed on the next iteration of the scan.
*/
peraggstate->transValue = datumCopy(newVal,
- peraggstate->transtypeByVal,
- peraggstate->transtypeLen);
+ peraggstate->transtypeByVal,
+ peraggstate->transtypeLen);
peraggstate->transValueIsNull = false;
peraggstate->noTransValue = false;
return;
}
if (peraggstate->transValueIsNull)
{
+
/*
* Don't call a strict function with NULL inputs. Note it is
- * possible to get here despite the above tests, if the transfn
- * is strict *and* returned a NULL on a prior cycle. If that
- * happens we will propagate the NULL all the way to the end.
+ * possible to get here despite the above tests, if the
+ * transfn is strict *and* returned a NULL on a prior cycle.
+ * If that happens we will propagate the NULL all the way to
+ * the end.
*/
return;
}
@@ -283,14 +289,14 @@ advance_transition_function(AggStatePerAgg peraggstate,
newVal = FunctionCallInvoke(&fcinfo);
/*
- * If the transition function was uncooperative, it may have
- * given us a pass-by-ref result that points at the scan tuple
- * or the prior-cycle working memory. Copy it into the active
- * context if it doesn't look right.
+ * If the transition function was uncooperative, it may have given us
+ * a pass-by-ref result that points at the scan tuple or the
+ * prior-cycle working memory. Copy it into the active context if it
+ * doesn't look right.
*/
if (!peraggstate->transtypeByVal && !fcinfo.isnull &&
- ! MemoryContextContains(CurrentMemoryContext,
- DatumGetPointer(newVal)))
+ !MemoryContextContains(CurrentMemoryContext,
+ DatumGetPointer(newVal)))
newVal = datumCopy(newVal,
peraggstate->transtypeByVal,
peraggstate->transtypeLen);
@@ -302,7 +308,7 @@ advance_transition_function(AggStatePerAgg peraggstate,
/*
* Run the transition function for a DISTINCT aggregate. This is called
* after we have completed entering all the input values into the sort
- * object. We complete the sort, read out the values in sorted order,
+ * object. We complete the sort, read out the values in sorted order,
* and run the transition function on each non-duplicate value.
*
* When called, CurrentMemoryContext should be the per-query context.
@@ -321,19 +327,21 @@ process_sorted_aggregate(AggState *aggstate,
/*
* Note: if input type is pass-by-ref, the datums returned by the sort
- * are freshly palloc'd in the per-query context, so we must be careful
- * to pfree them when they are no longer needed.
+ * are freshly palloc'd in the per-query context, so we must be
+ * careful to pfree them when they are no longer needed.
*/
while (tuplesort_getdatum(peraggstate->sortstate, true,
&newVal, &isNull))
{
+
/*
* DISTINCT always suppresses nulls, per SQL spec, regardless of
* the transition function's strictness.
*/
if (isNull)
continue;
+
/*
* Clear and select the current working context for evaluation of
* the equality function and transition function.
@@ -349,6 +357,7 @@ process_sorted_aggregate(AggState *aggstate,
/* equal to prior, so forget this one */
if (!peraggstate->inputtypeByVal)
pfree(DatumGetPointer(newVal));
+
/*
* note we do NOT flip contexts in this case, so no need to
* copy prior transValue to other context.
@@ -357,6 +366,7 @@ process_sorted_aggregate(AggState *aggstate,
else
{
advance_transition_function(peraggstate, newVal, false);
+
/*
* Make the other context current so that this transition
* result is preserved.
@@ -389,12 +399,13 @@ static void
finalize_aggregate(AggStatePerAgg peraggstate,
Datum *resultVal, bool *resultIsNull)
{
+
/*
* Apply the agg's finalfn if one is provided, else return transValue.
*/
if (OidIsValid(peraggstate->finalfn_oid))
{
- FunctionCallInfoData fcinfo;
+ FunctionCallInfoData fcinfo;
MemSet(&fcinfo, 0, sizeof(fcinfo));
fcinfo.flinfo = &peraggstate->finalfn;
@@ -422,9 +433,9 @@ finalize_aggregate(AggStatePerAgg peraggstate,
/*
* If result is pass-by-ref, make sure it is in the right context.
*/
- if (!peraggstate->resulttypeByVal && ! *resultIsNull &&
- ! MemoryContextContains(CurrentMemoryContext,
- DatumGetPointer(*resultVal)))
+ if (!peraggstate->resulttypeByVal && !*resultIsNull &&
+ !MemoryContextContains(CurrentMemoryContext,
+ DatumGetPointer(*resultVal)))
*resultVal = datumCopy(*resultVal,
peraggstate->resulttypeByVal,
peraggstate->resulttypeLen);
@@ -480,7 +491,8 @@ ExecAgg(Agg *node)
peragg = aggstate->peragg;
/*
- * We loop retrieving groups until we find one matching node->plan.qual
+ * We loop retrieving groups until we find one matching
+ * node->plan.qual
*/
do
{
@@ -578,19 +590,19 @@ ExecAgg(Agg *node)
* calculation, and stash results in the per-output-tuple context.
*
* This is a bit tricky when there are both DISTINCT and plain
- * aggregates: we must first finalize all the plain aggs and then all
- * the DISTINCT ones. This is needed because the last transition
- * values for the plain aggs are stored in the not-current working
- * context, and we have to evaluate those aggs (and stash the results
- * in the output tup_cxt!) before we start flipping contexts again
- * in process_sorted_aggregate.
+ * aggregates: we must first finalize all the plain aggs and then
+ * all the DISTINCT ones. This is needed because the last
+ * transition values for the plain aggs are stored in the
+ * not-current working context, and we have to evaluate those aggs
+ * (and stash the results in the output tup_cxt!) before we start
+ * flipping contexts again in process_sorted_aggregate.
*/
oldContext = MemoryContextSwitchTo(aggstate->tup_cxt);
for (aggno = 0; aggno < aggstate->numaggs; aggno++)
{
AggStatePerAgg peraggstate = &peragg[aggno];
- if (! peraggstate->aggref->aggdistinct)
+ if (!peraggstate->aggref->aggdistinct)
finalize_aggregate(peraggstate,
&aggvalues[aggno], &aggnulls[aggno]);
}
@@ -766,21 +778,22 @@ ExecInitAgg(Agg *node, EState *estate, Plan *parent)
ExecAssignExprContext(estate, &aggstate->csstate.cstate);
/*
- * We actually need three separate expression memory contexts: one
- * for calculating per-output-tuple values (ie, the finished aggregate
+ * We actually need three separate expression memory contexts: one for
+ * calculating per-output-tuple values (ie, the finished aggregate
* results), and two that we ping-pong between for per-input-tuple
* evaluation of input expressions and transition functions. The
- * context made by ExecAssignExprContext() is used as the output context.
+ * context made by ExecAssignExprContext() is used as the output
+ * context.
*/
aggstate->tup_cxt =
aggstate->csstate.cstate.cs_ExprContext->ecxt_per_tuple_memory;
- aggstate->agg_cxt[0] =
+ aggstate->agg_cxt[0] =
AllocSetContextCreate(CurrentMemoryContext,
"AggExprContext1",
ALLOCSET_DEFAULT_MINSIZE,
ALLOCSET_DEFAULT_INITSIZE,
ALLOCSET_DEFAULT_MAXSIZE);
- aggstate->agg_cxt[1] =
+ aggstate->agg_cxt[1] =
AllocSetContextCreate(CurrentMemoryContext,
"AggExprContext2",
ALLOCSET_DEFAULT_MINSIZE,
@@ -882,30 +895,32 @@ ExecInitAgg(Agg *node, EState *estate, Plan *parent)
/*
* If the transfn is strict and the initval is NULL, make sure
* input type and transtype are the same (or at least binary-
- * compatible), so that it's OK to use the first input value
- * as the initial transValue. This should have been checked at
- * agg definition time, but just in case...
+ * compatible), so that it's OK to use the first input value as
+ * the initial transValue. This should have been checked at agg
+ * definition time, but just in case...
*/
if (peraggstate->transfn.fn_strict && peraggstate->initValueIsNull)
{
+
/*
- * Note: use the type from the input expression here,
- * not aggform->aggbasetype, because the latter might be 0.
+ * Note: use the type from the input expression here, not
+ * aggform->aggbasetype, because the latter might be 0.
* (Consider COUNT(*).)
*/
Oid inputType = exprType(aggref->target);
if (inputType != aggform->aggtranstype &&
- ! IS_BINARY_COMPATIBLE(inputType, aggform->aggtranstype))
+ !IS_BINARY_COMPATIBLE(inputType, aggform->aggtranstype))
elog(ERROR, "Aggregate %s needs to have compatible input type and transition type",
aggname);
}
if (aggref->aggdistinct)
{
+
/*
- * Note: use the type from the input expression here,
- * not aggform->aggbasetype, because the latter might be 0.
+ * Note: use the type from the input expression here, not
+ * aggform->aggbasetype, because the latter might be 0.
* (Consider COUNT(*).)
*/
Oid inputType = exprType(aggref->target);
@@ -947,12 +962,14 @@ ExecEndAgg(Agg *node)
Plan *outerPlan;
ExecFreeProjectionInfo(&aggstate->csstate.cstate);
+
/*
* Make sure ExecFreeExprContext() frees the right expr context...
*/
aggstate->csstate.cstate.cs_ExprContext->ecxt_per_tuple_memory =
aggstate->tup_cxt;
ExecFreeExprContext(&aggstate->csstate.cstate);
+
/*
* ... and I free the others.
*/
diff --git a/src/backend/executor/nodeGroup.c b/src/backend/executor/nodeGroup.c
index e4ede51852a..500e9c07c43 100644
--- a/src/backend/executor/nodeGroup.c
+++ b/src/backend/executor/nodeGroup.c
@@ -15,7 +15,7 @@
* locate group boundaries.
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/executor/nodeGroup.c,v 1.41 2001/02/16 03:16:57 tgl Exp $
+ * $Header: /cvsroot/pgsql/src/backend/executor/nodeGroup.c,v 1.42 2001/03/22 03:59:27 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -88,8 +88,8 @@ ExecGroupEveryTuple(Group *node)
tupdesc = ExecGetScanType(&grpstate->csstate);
/*
- * We need not call ResetExprContext here because execTuplesMatch
- * will reset the per-tuple memory context once per input tuple.
+ * We need not call ResetExprContext here because execTuplesMatch will
+ * reset the per-tuple memory context once per input tuple.
*/
/* if we haven't returned first tuple of a new group yet ... */
@@ -199,8 +199,8 @@ ExecGroupOneTuple(Group *node)
tupdesc = ExecGetScanType(&grpstate->csstate);
/*
- * We need not call ResetExprContext here because execTuplesMatch
- * will reset the per-tuple memory context once per input tuple.
+ * We need not call ResetExprContext here because execTuplesMatch will
+ * reset the per-tuple memory context once per input tuple.
*/
firsttuple = grpstate->grp_firstTuple;
@@ -465,8 +465,8 @@ execTuplesMatch(HeapTuple tuple1,
/* Apply the type-specific equality function */
- if (! DatumGetBool(FunctionCall2(&eqfunctions[i],
- attr1, attr2)))
+ if (!DatumGetBool(FunctionCall2(&eqfunctions[i],
+ attr1, attr2)))
{
result = false; /* they aren't equal */
break;
diff --git a/src/backend/executor/nodeHash.c b/src/backend/executor/nodeHash.c
index 070354ace7c..7b5e3d4cced 100644
--- a/src/backend/executor/nodeHash.c
+++ b/src/backend/executor/nodeHash.c
@@ -7,7 +7,7 @@
* Portions Copyright (c) 1994, Regents of the University of California
*
*
- * $Id: nodeHash.c,v 1.54 2001/01/24 19:42:54 momjian Exp $
+ * $Id: nodeHash.c,v 1.55 2001/03/22 03:59:27 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -540,9 +540,7 @@ ExecHashGetBucket(HashJoinTable hashtable,
* ------------------
*/
if (isNull)
- {
bucketno = 0;
- }
else
{
bucketno = hashFunc(keyval,
diff --git a/src/backend/executor/nodeHashjoin.c b/src/backend/executor/nodeHashjoin.c
index a3fc2f545cb..dae06d2c937 100644
--- a/src/backend/executor/nodeHashjoin.c
+++ b/src/backend/executor/nodeHashjoin.c
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/executor/nodeHashjoin.c,v 1.36 2001/01/29 00:39:19 tgl Exp $
+ * $Header: /cvsroot/pgsql/src/backend/executor/nodeHashjoin.c,v 1.37 2001/03/22 03:59:27 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -105,7 +105,7 @@ ExecHashJoin(HashJoin *node)
/* ----------------
* Reset per-tuple memory context to free any expression evaluation
- * storage allocated in the previous tuple cycle. Note this can't
+ * storage allocated in the previous tuple cycle. Note this can't
* happen until we're done projecting out tuples from a join tuple.
* ----------------
*/
@@ -155,6 +155,7 @@ ExecHashJoin(HashJoin *node)
for (;;)
{
+
/*
* If we don't have an outer tuple, get the next one
*/
@@ -276,14 +277,15 @@ ExecHashJoin(HashJoin *node)
*/
hjstate->hj_NeedNewOuter = true;
- if (! hjstate->hj_MatchedOuter &&
+ if (!hjstate->hj_MatchedOuter &&
node->join.jointype == JOIN_LEFT)
{
+
/*
* We are doing an outer join and there were no join matches
* for this outer tuple. Generate a fake join tuple with
- * nulls for the inner tuple, and return it if it passes
- * the non-join quals.
+ * nulls for the inner tuple, and return it if it passes the
+ * non-join quals.
*/
econtext->ecxt_innertuple = hjstate->hj_NullInnerTupleSlot;
diff --git a/src/backend/executor/nodeIndexscan.c b/src/backend/executor/nodeIndexscan.c
index c0369e8f4cd..a6e6e45e9dc 100644
--- a/src/backend/executor/nodeIndexscan.c
+++ b/src/backend/executor/nodeIndexscan.c
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/executor/nodeIndexscan.c,v 1.57 2001/01/29 00:39:19 tgl Exp $
+ * $Header: /cvsroot/pgsql/src/backend/executor/nodeIndexscan.c,v 1.58 2001/03/22 03:59:28 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -224,7 +224,7 @@ IndexNext(IndexScan *node)
qual = lnext(qual);
}
if (!prev_matches)
- return slot; /* OK to return tuple */
+ return slot;/* OK to return tuple */
/* Duplicate tuple, so drop it and loop back for another */
ExecClearTuple(slot);
}
@@ -326,7 +326,8 @@ ExecIndexReScan(IndexScan *node, ExprContext *exprCtxt, Plan *parent)
estate = node->scan.plan.state;
indexstate = node->indxstate;
- econtext = indexstate->iss_RuntimeContext; /* context for runtime keys */
+ econtext = indexstate->iss_RuntimeContext; /* context for runtime
+ * keys */
direction = estate->es_direction;
numIndices = indexstate->iss_NumIndices;
scanDescs = indexstate->iss_ScanDescs;
@@ -340,16 +341,18 @@ ExecIndexReScan(IndexScan *node, ExprContext *exprCtxt, Plan *parent)
if (econtext)
{
+
/*
- * If we are being passed an outer tuple,
- * save it for runtime key calc
+ * If we are being passed an outer tuple, save it for runtime key
+ * calc
*/
if (exprCtxt != NULL)
econtext->ecxt_outertuple = exprCtxt->ecxt_outertuple;
+
/*
- * Reset the runtime-key context so we don't leak memory as
- * each outer tuple is scanned. Note this assumes that we
- * will recalculate *all* runtime keys on each call.
+ * Reset the runtime-key context so we don't leak memory as each
+ * outer tuple is scanned. Note this assumes that we will
+ * recalculate *all* runtime keys on each call.
*/
ResetExprContext(econtext);
}
@@ -385,8 +388,8 @@ ExecIndexReScan(IndexScan *node, ExprContext *exprCtxt, Plan *parent)
* outer tuple. We then stick the result into the scan
* key.
*
- * Note: the result of the eval could be a pass-by-ref
- * value that's stored in the outer scan's tuple, not in
+ * Note: the result of the eval could be a pass-by-ref value
+ * that's stored in the outer scan's tuple, not in
* econtext->ecxt_per_tuple_memory. We assume that the
* outer tuple will stay put throughout our scan. If this
* is wrong, we could copy the result into our context
@@ -790,7 +793,7 @@ ExecInitIndexScan(IndexScan *node, EState *estate, Plan *parent)
Assert(leftop != NULL);
- if (IsA(leftop, Var) && var_is_rel((Var *) leftop))
+ if (IsA(leftop, Var) &&var_is_rel((Var *) leftop))
{
/* ----------------
* if the leftop is a "rel-var", then it means
@@ -862,7 +865,7 @@ ExecInitIndexScan(IndexScan *node, EState *estate, Plan *parent)
Assert(rightop != NULL);
- if (IsA(rightop, Var) && var_is_rel((Var *) rightop))
+ if (IsA(rightop, Var) &&var_is_rel((Var *) rightop))
{
/* ----------------
* here we make sure only one op identifies the
@@ -986,7 +989,7 @@ ExecInitIndexScan(IndexScan *node, EState *estate, Plan *parent)
*/
if (have_runtime_keys)
{
- ExprContext *stdecontext = scanstate->cstate.cs_ExprContext;
+ ExprContext *stdecontext = scanstate->cstate.cs_ExprContext;
ExecAssignExprContext(estate, &scanstate->cstate);
indexstate->iss_RuntimeKeyInfo = runtimeKeyInfo;
diff --git a/src/backend/executor/nodeLimit.c b/src/backend/executor/nodeLimit.c
index c7cc76f0a70..534c3a419d1 100644
--- a/src/backend/executor/nodeLimit.c
+++ b/src/backend/executor/nodeLimit.c
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/executor/nodeLimit.c,v 1.3 2001/01/24 19:42:55 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/executor/nodeLimit.c,v 1.4 2001/03/22 03:59:28 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -59,7 +59,7 @@ ExecLimit(Limit *node)
* may not be set until now.)
* ----------------
*/
- if (! limitstate->parmsSet)
+ if (!limitstate->parmsSet)
recompute_limits(node);
netlimit = limitstate->offset + limitstate->count;
@@ -89,7 +89,7 @@ ExecLimit(Limit *node)
{
if (limitstate->atEnd)
return NULL;
- if (! limitstate->noCount && limitstate->position > netlimit)
+ if (!limitstate->noCount && limitstate->position > netlimit)
return NULL;
}
else
@@ -104,13 +104,14 @@ ExecLimit(Limit *node)
slot = ExecProcNode(outerPlan, (Plan *) node);
if (TupIsNull(slot))
{
+
/*
* We are at start or end of the subplan. Update local state
* appropriately, but always return NULL.
*/
if (ScanDirectionIsForward(direction))
{
- Assert(! limitstate->atEnd);
+ Assert(!limitstate->atEnd);
/* must bump position to stay in sync for backwards fetch */
limitstate->position++;
limitstate->atEnd = true;
@@ -122,6 +123,7 @@ ExecLimit(Limit *node)
}
return NULL;
}
+
/*
* We got the next subplan tuple successfully, so adjust state.
*/
@@ -135,7 +137,7 @@ ExecLimit(Limit *node)
limitstate->atEnd = false;
/* ----------------
- * Now, is this a tuple we want? If not, loop around to fetch
+ * Now, is this a tuple we want? If not, loop around to fetch
* another tuple from the subplan.
* ----------------
*/
@@ -185,9 +187,9 @@ recompute_limits(Limit *node)
if (node->limitCount)
{
limitstate->count = DatumGetInt32(ExecEvalExpr(node->limitCount,
- econtext,
- &isNull,
- NULL));
+ econtext,
+ &isNull,
+ NULL));
/* Interpret NULL count as no count (LIMIT ALL) */
if (isNull)
limitstate->noCount = true;
diff --git a/src/backend/executor/nodeMaterial.c b/src/backend/executor/nodeMaterial.c
index dd09c6ac1c1..1f55f852f0e 100644
--- a/src/backend/executor/nodeMaterial.c
+++ b/src/backend/executor/nodeMaterial.c
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/executor/nodeMaterial.c,v 1.33 2001/01/24 19:42:55 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/executor/nodeMaterial.c,v 1.34 2001/03/22 03:59:28 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -31,7 +31,7 @@
*
* The first time this is called, ExecMaterial retrieves tuples
* from this node's outer subplan and inserts them into a tuplestore
- * (a temporary tuple storage structure). The first tuple is then
+ * (a temporary tuple storage structure). The first tuple is then
* returned. Successive calls to ExecMaterial return successive
* tuples from the tuplestore.
*
@@ -85,7 +85,7 @@ ExecMaterial(Material *node)
* Initialize tuplestore module.
* ----------------
*/
- tuplestorestate = tuplestore_begin_heap(true, /* randomAccess */
+ tuplestorestate = tuplestore_begin_heap(true, /* randomAccess */
SortMem);
matstate->tuplestorestate = (void *) tuplestorestate;
@@ -250,7 +250,7 @@ ExecEndMaterial(Material *node)
void
ExecMaterialMarkPos(Material *node)
{
- MaterialState *matstate = node->matstate;
+ MaterialState *matstate = node->matstate;
/* ----------------
* if we haven't materialized yet, just return.
@@ -271,7 +271,7 @@ ExecMaterialMarkPos(Material *node)
void
ExecMaterialRestrPos(Material *node)
{
- MaterialState *matstate = node->matstate;
+ MaterialState *matstate = node->matstate;
/* ----------------
* if we haven't materialized yet, just return.
@@ -299,8 +299,8 @@ ExecMaterialReScan(Material *node, ExprContext *exprCtxt, Plan *parent)
MaterialState *matstate = node->matstate;
/*
- * If we haven't materialized yet, just return. If outerplan' chgParam is
- * not NULL then it will be re-scanned by ExecProcNode, else - no
+ * If we haven't materialized yet, just return. If outerplan' chgParam
+ * is not NULL then it will be re-scanned by ExecProcNode, else - no
* reason to re-scan it at all.
*/
if (!matstate->tuplestorestate)
@@ -309,8 +309,8 @@ ExecMaterialReScan(Material *node, ExprContext *exprCtxt, Plan *parent)
ExecClearTuple(matstate->csstate.cstate.cs_ResultTupleSlot);
/*
- * If subnode is to be rescanned then we forget previous stored results;
- * we have to re-read the subplan and re-store.
+ * If subnode is to be rescanned then we forget previous stored
+ * results; we have to re-read the subplan and re-store.
*
* Otherwise we can just rewind and rescan the stored output.
*/
diff --git a/src/backend/executor/nodeMergejoin.c b/src/backend/executor/nodeMergejoin.c
index fd8868a4a54..e3617c032b0 100644
--- a/src/backend/executor/nodeMergejoin.c
+++ b/src/backend/executor/nodeMergejoin.c
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/executor/nodeMergejoin.c,v 1.42 2001/01/29 00:39:19 tgl Exp $
+ * $Header: /cvsroot/pgsql/src/backend/executor/nodeMergejoin.c,v 1.43 2001/03/22 03:59:29 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -169,7 +169,7 @@ MJFormSkipQual(List *qualList, char *replaceopname)
CharGetDatum('b'));
if (!HeapTupleIsValid(optup))
elog(ERROR,
- "MJFormSkipQual: mergejoin operator %u has no matching %s op",
+ "MJFormSkipQual: mergejoin operator %u has no matching %s op",
op->opno, replaceopname);
opform = (Form_pg_operator) GETSTRUCT(optup);
@@ -258,7 +258,7 @@ MergeCompare(List *eqQual, List *compareQual, ExprContext *econtext)
&isNull,
NULL);
- if (! DatumGetBool(const_value) || isNull)
+ if (!DatumGetBool(const_value) || isNull)
break; /* return false */
eqclause = lnext(eqclause);
@@ -439,7 +439,7 @@ ExecMergeJoin(MergeJoin *node)
default:
elog(ERROR, "ExecMergeJoin: unsupported join type %d",
(int) node->join.jointype);
- doFillOuter = false; /* keep compiler quiet */
+ doFillOuter = false;/* keep compiler quiet */
doFillInner = false;
break;
}
@@ -464,7 +464,7 @@ ExecMergeJoin(MergeJoin *node)
if (mergestate->jstate.cs_TupFromTlist)
{
TupleTableSlot *result;
- ExprDoneCond isDone;
+ ExprDoneCond isDone;
result = ExecProject(mergestate->jstate.cs_ProjInfo, &isDone);
if (isDone == ExprMultipleResult)
@@ -475,7 +475,7 @@ ExecMergeJoin(MergeJoin *node)
/* ----------------
* Reset per-tuple memory context to free any expression evaluation
- * storage allocated in the previous tuple cycle. Note this can't
+ * storage allocated in the previous tuple cycle. Note this can't
* happen until we're done projecting out tuples from a join tuple.
* ----------------
*/
@@ -500,9 +500,9 @@ ExecMergeJoin(MergeJoin *node)
/*
* EXEC_MJ_INITIALIZE means that this is the first time
- * ExecMergeJoin() has been called and so we have to
- * fetch the first tuple for both outer and inner subplans.
- * If we fail to get a tuple here, then that subplan is
+ * ExecMergeJoin() has been called and so we have to fetch
+ * the first tuple for both outer and inner subplans. If
+ * we fail to get a tuple here, then that subplan is
* empty, and we either end the join or go to one of the
* fill-remaining-tuples states.
*/
@@ -516,6 +516,7 @@ ExecMergeJoin(MergeJoin *node)
MJ_printf("ExecMergeJoin: outer subplan is empty\n");
if (doFillInner)
{
+
/*
* Need to emit right-join tuples for remaining
* inner tuples. We set MatchedInner = true to
@@ -536,11 +537,13 @@ ExecMergeJoin(MergeJoin *node)
MJ_printf("ExecMergeJoin: inner subplan is empty\n");
if (doFillOuter)
{
+
/*
- * Need to emit left-join tuples for all outer tuples,
- * including the one we just fetched. We set
- * MatchedOuter = false to force the ENDINNER state
- * to emit this tuple before advancing outer.
+ * Need to emit left-join tuples for all outer
+ * tuples, including the one we just fetched. We
+ * set MatchedOuter = false to force the ENDINNER
+ * state to emit this tuple before advancing
+ * outer.
*/
mergestate->mj_JoinState = EXEC_MJ_ENDINNER;
mergestate->mj_MatchedOuter = false;
@@ -614,17 +617,17 @@ ExecMergeJoin(MergeJoin *node)
/*
* Check the extra qual conditions to see if we actually
- * want to return this join tuple. If not, can proceed with
- * merge. We must distinguish the additional joinquals
- * (which must pass to consider the tuples "matched" for
- * outer-join logic) from the otherquals (which must pass
- * before we actually return the tuple).
+ * want to return this join tuple. If not, can proceed
+ * with merge. We must distinguish the additional
+ * joinquals (which must pass to consider the tuples
+ * "matched" for outer-join logic) from the otherquals
+ * (which must pass before we actually return the tuple).
*
* We don't bother with a ResetExprContext here, on the
- * assumption that we just did one before checking the merge
- * qual. One per tuple should be sufficient. Also, the
- * econtext's tuple pointers were set up before checking
- * the merge qual, so we needn't do it again.
+ * assumption that we just did one before checking the
+ * merge qual. One per tuple should be sufficient. Also,
+ * the econtext's tuple pointers were set up before
+ * checking the merge qual, so we needn't do it again.
*/
qualResult = (joinqual == NIL ||
ExecQual(joinqual, econtext, false));
@@ -677,11 +680,13 @@ ExecMergeJoin(MergeJoin *node)
if (doFillInner && !mergestate->mj_MatchedInner)
{
+
/*
* Generate a fake join tuple with nulls for the outer
- * tuple, and return it if it passes the non-join quals.
+ * tuple, and return it if it passes the non-join
+ * quals.
*/
- mergestate->mj_MatchedInner = true; /* do it only once */
+ mergestate->mj_MatchedInner = true; /* do it only once */
ResetExprContext(econtext);
@@ -753,11 +758,13 @@ ExecMergeJoin(MergeJoin *node)
if (doFillOuter && !mergestate->mj_MatchedOuter)
{
+
/*
* Generate a fake join tuple with nulls for the inner
- * tuple, and return it if it passes the non-join quals.
+ * tuple, and return it if it passes the non-join
+ * quals.
*/
- mergestate->mj_MatchedOuter = true; /* do it only once */
+ mergestate->mj_MatchedOuter = true; /* do it only once */
ResetExprContext(econtext);
@@ -810,6 +817,7 @@ ExecMergeJoin(MergeJoin *node)
innerTupleSlot = mergestate->mj_InnerTupleSlot;
if (doFillInner && !TupIsNull(innerTupleSlot))
{
+
/*
* Need to emit right-join tuples for remaining
* inner tuples.
@@ -879,19 +887,20 @@ ExecMergeJoin(MergeJoin *node)
{
/*
- * the merge clause matched so now we restore the inner
- * scan position to the first mark, and loop back to
- * JOINTEST. Actually, since we know the mergeclause
- * matches, we can skip JOINTEST and go straight to
- * JOINTUPLES.
+ * the merge clause matched so now we restore the
+ * inner scan position to the first mark, and loop
+ * back to JOINTEST. Actually, since we know the
+ * mergeclause matches, we can skip JOINTEST and go
+ * straight to JOINTUPLES.
*
* NOTE: we do not need to worry about the MatchedInner
* state for the rescanned inner tuples. We know all
- * of them will match this new outer tuple and therefore
- * won't be emitted as fill tuples. This works *only*
- * because we require the extra joinquals to be nil when
- * doing a right or full join --- otherwise some of the
- * rescanned tuples might fail the extra joinquals.
+ * of them will match this new outer tuple and
+ * therefore won't be emitted as fill tuples. This
+ * works *only* because we require the extra joinquals
+ * to be nil when doing a right or full join ---
+ * otherwise some of the rescanned tuples might fail
+ * the extra joinquals.
*/
ExecRestrPos(innerPlan);
mergestate->mj_JoinState = EXEC_MJ_JOINTUPLES;
@@ -918,6 +927,7 @@ ExecMergeJoin(MergeJoin *node)
{
if (doFillOuter)
{
+
/*
* Need to emit left-join tuples for remaining
* outer tuples.
@@ -1044,11 +1054,13 @@ ExecMergeJoin(MergeJoin *node)
if (doFillOuter && !mergestate->mj_MatchedOuter)
{
+
/*
* Generate a fake join tuple with nulls for the inner
- * tuple, and return it if it passes the non-join quals.
+ * tuple, and return it if it passes the non-join
+ * quals.
*/
- mergestate->mj_MatchedOuter = true; /* do it only once */
+ mergestate->mj_MatchedOuter = true; /* do it only once */
ResetExprContext(econtext);
@@ -1101,6 +1113,7 @@ ExecMergeJoin(MergeJoin *node)
innerTupleSlot = mergestate->mj_InnerTupleSlot;
if (doFillInner && !TupIsNull(innerTupleSlot))
{
+
/*
* Need to emit right-join tuples for remaining
* inner tuples.
@@ -1229,11 +1242,13 @@ ExecMergeJoin(MergeJoin *node)
if (doFillInner && !mergestate->mj_MatchedInner)
{
+
/*
* Generate a fake join tuple with nulls for the outer
- * tuple, and return it if it passes the non-join quals.
+ * tuple, and return it if it passes the non-join
+ * quals.
*/
- mergestate->mj_MatchedInner = true; /* do it only once */
+ mergestate->mj_MatchedInner = true; /* do it only once */
ResetExprContext(econtext);
@@ -1286,6 +1301,7 @@ ExecMergeJoin(MergeJoin *node)
outerTupleSlot = mergestate->mj_OuterTupleSlot;
if (doFillOuter && !TupIsNull(outerTupleSlot))
{
+
/*
* Need to emit left-join tuples for remaining
* outer tuples.
@@ -1306,8 +1322,8 @@ ExecMergeJoin(MergeJoin *node)
/*
* EXEC_MJ_ENDOUTER means we have run out of outer tuples,
- * but are doing a right/full join and therefore must null-
- * fill any remaing unmatched inner tuples.
+ * but are doing a right/full join and therefore must
+ * null- fill any remaing unmatched inner tuples.
*/
case EXEC_MJ_ENDOUTER:
MJ_printf("ExecMergeJoin: EXEC_MJ_ENDOUTER\n");
@@ -1316,11 +1332,13 @@ ExecMergeJoin(MergeJoin *node)
if (!mergestate->mj_MatchedInner)
{
+
/*
* Generate a fake join tuple with nulls for the outer
- * tuple, and return it if it passes the non-join quals.
+ * tuple, and return it if it passes the non-join
+ * quals.
*/
- mergestate->mj_MatchedInner = true; /* do it only once */
+ mergestate->mj_MatchedInner = true; /* do it only once */
ResetExprContext(econtext);
@@ -1383,11 +1401,13 @@ ExecMergeJoin(MergeJoin *node)
if (!mergestate->mj_MatchedOuter)
{
+
/*
* Generate a fake join tuple with nulls for the inner
- * tuple, and return it if it passes the non-join quals.
+ * tuple, and return it if it passes the non-join
+ * quals.
*/
- mergestate->mj_MatchedOuter = true; /* do it only once */
+ mergestate->mj_MatchedOuter = true; /* do it only once */
ResetExprContext(econtext);
@@ -1515,14 +1535,16 @@ ExecInitMergeJoin(MergeJoin *node, EState *estate, Plan *parent)
case JOIN_LEFT:
mergestate->mj_NullInnerTupleSlot =
ExecInitNullTupleSlot(estate,
- ExecGetTupType(innerPlan((Plan*) node)));
+ ExecGetTupType(innerPlan((Plan *) node)));
break;
case JOIN_RIGHT:
mergestate->mj_NullOuterTupleSlot =
ExecInitNullTupleSlot(estate,
- ExecGetTupType(outerPlan((Plan*) node)));
+ ExecGetTupType(outerPlan((Plan *) node)));
+
/*
- * Can't handle right or full join with non-nil extra joinclauses.
+ * Can't handle right or full join with non-nil extra
+ * joinclauses.
*/
if (node->join.joinqual != NIL)
elog(ERROR, "RIGHT JOIN is only supported with mergejoinable join conditions");
@@ -1530,12 +1552,14 @@ ExecInitMergeJoin(MergeJoin *node, EState *estate, Plan *parent)
case JOIN_FULL:
mergestate->mj_NullOuterTupleSlot =
ExecInitNullTupleSlot(estate,
- ExecGetTupType(outerPlan((Plan*) node)));
+ ExecGetTupType(outerPlan((Plan *) node)));
mergestate->mj_NullInnerTupleSlot =
ExecInitNullTupleSlot(estate,
- ExecGetTupType(innerPlan((Plan*) node)));
+ ExecGetTupType(innerPlan((Plan *) node)));
+
/*
- * Can't handle right or full join with non-nil extra joinclauses.
+ * Can't handle right or full join with non-nil extra
+ * joinclauses.
*/
if (node->join.joinqual != NIL)
elog(ERROR, "FULL JOIN is only supported with mergejoinable join conditions");
diff --git a/src/backend/executor/nodeNestloop.c b/src/backend/executor/nodeNestloop.c
index f514b03851f..9c01ee4a1fb 100644
--- a/src/backend/executor/nodeNestloop.c
+++ b/src/backend/executor/nodeNestloop.c
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/executor/nodeNestloop.c,v 1.22 2001/01/24 19:42:55 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/executor/nodeNestloop.c,v 1.23 2001/03/22 03:59:29 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -97,7 +97,7 @@ ExecNestLoop(NestLoop *node)
if (nlstate->jstate.cs_TupFromTlist)
{
TupleTableSlot *result;
- ExprDoneCond isDone;
+ ExprDoneCond isDone;
result = ExecProject(nlstate->jstate.cs_ProjInfo, &isDone);
if (isDone == ExprMultipleResult)
@@ -108,7 +108,7 @@ ExecNestLoop(NestLoop *node)
/* ----------------
* Reset per-tuple memory context to free any expression evaluation
- * storage allocated in the previous tuple cycle. Note this can't
+ * storage allocated in the previous tuple cycle. Note this can't
* happen until we're done projecting out tuples from a join tuple.
* ----------------
*/
@@ -179,14 +179,15 @@ ExecNestLoop(NestLoop *node)
nlstate->nl_NeedNewOuter = true;
- if (! nlstate->nl_MatchedOuter &&
+ if (!nlstate->nl_MatchedOuter &&
node->join.jointype == JOIN_LEFT)
{
+
/*
- * We are doing an outer join and there were no join matches
- * for this outer tuple. Generate a fake join tuple with
- * nulls for the inner tuple, and return it if it passes
- * the non-join quals.
+ * We are doing an outer join and there were no join
+ * matches for this outer tuple. Generate a fake join
+ * tuple with nulls for the inner tuple, and return it if
+ * it passes the non-join quals.
*/
econtext->ecxt_innertuple = nlstate->nl_NullInnerTupleSlot;
@@ -215,6 +216,7 @@ ExecNestLoop(NestLoop *node)
}
}
}
+
/*
* Otherwise just return to top of loop for a new outer tuple.
*/
@@ -328,7 +330,7 @@ ExecInitNestLoop(NestLoop *node, EState *estate, Plan *parent)
case JOIN_LEFT:
nlstate->nl_NullInnerTupleSlot =
ExecInitNullTupleSlot(estate,
- ExecGetTupType(innerPlan((Plan*) node)));
+ ExecGetTupType(innerPlan((Plan *) node)));
break;
default:
elog(ERROR, "ExecInitNestLoop: unsupported join type %d",
diff --git a/src/backend/executor/nodeResult.c b/src/backend/executor/nodeResult.c
index fa401e20b24..863d4a4a56e 100644
--- a/src/backend/executor/nodeResult.c
+++ b/src/backend/executor/nodeResult.c
@@ -34,7 +34,7 @@
* Portions Copyright (c) 1994, Regents of the University of California
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/executor/nodeResult.c,v 1.17 2001/01/24 19:42:55 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/executor/nodeResult.c,v 1.18 2001/03/22 03:59:29 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -111,7 +111,7 @@ ExecResult(Result *node)
/* ----------------
* Reset per-tuple memory context to free any expression evaluation
- * storage allocated in the previous tuple cycle. Note this can't
+ * storage allocated in the previous tuple cycle. Note this can't
* happen until we're done projecting out tuples from a scan tuple.
* ----------------
*/
diff --git a/src/backend/executor/nodeSeqscan.c b/src/backend/executor/nodeSeqscan.c
index a39128ff2f0..d879cee7a75 100644
--- a/src/backend/executor/nodeSeqscan.c
+++ b/src/backend/executor/nodeSeqscan.c
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/executor/nodeSeqscan.c,v 1.27 2001/01/29 00:39:19 tgl Exp $
+ * $Header: /cvsroot/pgsql/src/backend/executor/nodeSeqscan.c,v 1.28 2001/03/22 03:59:29 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -31,7 +31,7 @@
#include "parser/parsetree.h"
static Oid InitScanRelation(SeqScan *node, EState *estate,
- CommonScanState *scanstate);
+ CommonScanState *scanstate);
static TupleTableSlot *SeqNext(SeqScan *node);
/* ----------------------------------------------------------------
@@ -174,8 +174,8 @@ InitScanRelation(SeqScan *node, EState *estate,
0, /* is index */
direction, /* scan direction */
estate->es_snapshot,
- &currentRelation, /* return: rel desc */
- (Pointer *) &currentScanDesc); /* return: scan desc */
+ &currentRelation, /* return: rel desc */
+ (Pointer *) &currentScanDesc); /* return: scan desc */
scanstate->css_currentRelation = currentRelation;
scanstate->css_currentScanDesc = currentScanDesc;
diff --git a/src/backend/executor/nodeSetOp.c b/src/backend/executor/nodeSetOp.c
index ad35a46d636..00c79992039 100644
--- a/src/backend/executor/nodeSetOp.c
+++ b/src/backend/executor/nodeSetOp.c
@@ -5,7 +5,7 @@
*
* The input of a SetOp node consists of tuples from two relations,
* which have been combined into one dataset and sorted on all the nonjunk
- * attributes. In addition there is a junk attribute that shows which
+ * attributes. In addition there is a junk attribute that shows which
* relation each tuple came from. The SetOp node scans each group of
* identical tuples to determine how many came from each input relation.
* Then it is a simple matter to emit the output demanded by the SQL spec
@@ -21,7 +21,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/executor/nodeSetOp.c,v 1.2 2001/01/24 19:42:55 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/executor/nodeSetOp.c,v 1.3 2001/03/22 03:59:29 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -93,7 +93,7 @@ ExecSetOp(SetOp *node)
* ----------------
*/
if (setopstate->cstate.cs_OuterTupleSlot == NULL &&
- ! setopstate->subplan_done)
+ !setopstate->subplan_done)
{
setopstate->cstate.cs_OuterTupleSlot =
ExecProcNode(outerPlan, (Plan *) node);
@@ -104,6 +104,7 @@ ExecSetOp(SetOp *node)
if (TupIsNull(resultTupleSlot))
{
+
/*
* First of group: save a copy in result slot, and reset
* duplicate-counters for new group.
@@ -113,13 +114,15 @@ ExecSetOp(SetOp *node)
ExecStoreTuple(heap_copytuple(inputTupleSlot->val),
resultTupleSlot,
InvalidBuffer,
- true); /* free copied tuple at ExecClearTuple */
+ true); /* free copied tuple at
+ * ExecClearTuple */
setopstate->numLeft = 0;
setopstate->numRight = 0;
endOfGroup = false;
}
else if (setopstate->subplan_done)
{
+
/*
* Reached end of input, so finish processing final group
*/
@@ -127,8 +130,10 @@ ExecSetOp(SetOp *node)
}
else
{
+
/*
- * Else test if the new tuple and the previously saved tuple match.
+ * Else test if the new tuple and the previously saved tuple
+ * match.
*/
if (execTuplesMatch(inputTupleSlot->val,
resultTupleSlot->val,
@@ -143,6 +148,7 @@ ExecSetOp(SetOp *node)
if (endOfGroup)
{
+
/*
* We've reached the end of the group containing resultTuple.
* Decide how many copies (if any) to emit. This logic is
@@ -185,12 +191,13 @@ ExecSetOp(SetOp *node)
}
else
{
+
/*
- * Current tuple is member of same group as resultTuple.
- * Count it in the appropriate counter.
+ * Current tuple is member of same group as resultTuple. Count
+ * it in the appropriate counter.
*/
- int flag;
- bool isNull;
+ int flag;
+ bool isNull;
flag = DatumGetInt32(heap_getattr(inputTupleSlot->val,
node->flagColIdx,
@@ -207,8 +214,8 @@ ExecSetOp(SetOp *node)
}
/*
- * If we fall out of loop, then we need to emit at least one copy
- * of resultTuple.
+ * If we fall out of loop, then we need to emit at least one copy of
+ * resultTuple.
*/
Assert(setopstate->numOutput > 0);
setopstate->numOutput--;
diff --git a/src/backend/executor/nodeSubplan.c b/src/backend/executor/nodeSubplan.c
index d75d9a6f052..a8df4940ae4 100644
--- a/src/backend/executor/nodeSubplan.c
+++ b/src/backend/executor/nodeSubplan.c
@@ -7,7 +7,7 @@
* Portions Copyright (c) 1994, Regents of the University of California
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/executor/nodeSubplan.c,v 1.29 2001/01/24 19:42:55 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/executor/nodeSubplan.c,v 1.30 2001/03/22 03:59:29 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -102,7 +102,7 @@ ExecSubPlan(SubPlan *node, List *pvar, ExprContext *econtext, bool *isNull)
{
HeapTuple tup = slot->val;
TupleDesc tdesc = slot->ttc_tupleDescriptor;
- Datum rowresult = BoolGetDatum(! useor);
+ Datum rowresult = BoolGetDatum(!useor);
bool rownull = false;
int col = 1;
@@ -213,7 +213,7 @@ ExecSubPlan(SubPlan *node, List *pvar, ExprContext *econtext, bool *isNull)
/* combine within row per AND semantics */
if (expnull)
rownull = true;
- else if (! DatumGetBool(expresult))
+ else if (!DatumGetBool(expresult))
{
rowresult = BoolGetDatum(false);
rownull = false;
@@ -240,7 +240,7 @@ ExecSubPlan(SubPlan *node, List *pvar, ExprContext *econtext, bool *isNull)
/* combine across rows per AND semantics */
if (rownull)
*isNull = true;
- else if (! DatumGetBool(rowresult))
+ else if (!DatumGetBool(rowresult))
{
result = BoolGetDatum(false);
*isNull = false;
@@ -332,7 +332,7 @@ ExecInitSubPlan(SubPlan *node, EState *estate, Plan *parent)
*
* This is called from ExecEvalParam() when the value of a PARAM_EXEC
* parameter is requested and the param's execPlan field is set (indicating
- * that the param has not yet been evaluated). This allows lazy evaluation
+ * that the param has not yet been evaluated). This allows lazy evaluation
* of initplans: we don't run the subplan until/unless we need its output.
* Note that this routine MUST clear the execPlan fields of the plan's
* output parameters after evaluating them!
diff --git a/src/backend/executor/nodeSubqueryscan.c b/src/backend/executor/nodeSubqueryscan.c
index 4c9144bc3a8..9b8711c9914 100644
--- a/src/backend/executor/nodeSubqueryscan.c
+++ b/src/backend/executor/nodeSubqueryscan.c
@@ -12,7 +12,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/executor/nodeSubqueryscan.c,v 1.4 2001/01/29 00:39:19 tgl Exp $
+ * $Header: /cvsroot/pgsql/src/backend/executor/nodeSubqueryscan.c,v 1.5 2001/03/22 03:59:29 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -67,8 +67,8 @@ SubqueryNext(SubqueryScan *node)
/*
* Check if we are evaluating PlanQual for tuple of this relation.
* Additional checking is not good, but no other way for now. We could
- * introduce new nodes for this case and handle SubqueryScan --> NewNode
- * switching in Init/ReScan plan...
+ * introduce new nodes for this case and handle SubqueryScan -->
+ * NewNode switching in Init/ReScan plan...
*/
if (estate->es_evTuple != NULL &&
estate->es_evTuple[node->scan.scanrelid - 1] != NULL)
@@ -202,6 +202,7 @@ ExecInitSubqueryScan(SubqueryScan *node, EState *estate, Plan *parent)
int
ExecCountSlotsSubqueryScan(SubqueryScan *node)
{
+
/*
* The subplan has its own tuple table and must not be counted here!
*/
diff --git a/src/backend/executor/nodeTidscan.c b/src/backend/executor/nodeTidscan.c
index a5c0299d289..04c9efc4b0a 100644
--- a/src/backend/executor/nodeTidscan.c
+++ b/src/backend/executor/nodeTidscan.c
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/executor/nodeTidscan.c,v 1.14 2001/01/29 00:39:19 tgl Exp $
+ * $Header: /cvsroot/pgsql/src/backend/executor/nodeTidscan.c,v 1.15 2001/03/22 03:59:29 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -371,6 +371,7 @@ ExecTidRestrPos(TidScan *node)
tidstate = node->tidstate;
tidstate->tss_TidPtr = tidstate->tss_MarkTidPtr;
}
+
#endif
/* ----------------------------------------------------------------
diff --git a/src/backend/executor/spi.c b/src/backend/executor/spi.c
index 4c4da6c3034..4aa8c475c30 100644
--- a/src/backend/executor/spi.c
+++ b/src/backend/executor/spi.c
@@ -3,17 +3,17 @@
* spi.c
* Server Programming Interface
*
- * $Id: spi.c,v 1.52 2001/02/19 19:49:52 tgl Exp $
+ * $Id: spi.c,v 1.53 2001/03/22 03:59:29 momjian Exp $
*
*-------------------------------------------------------------------------
*/
#include "executor/spi_priv.h"
#include "access/printtup.h"
-uint32 SPI_processed = 0;
-Oid SPI_lastoid = InvalidOid;
+uint32 SPI_processed = 0;
+Oid SPI_lastoid = InvalidOid;
SPITupleTable *SPI_tuptable = NULL;
-int SPI_result;
+int SPI_result;
static _SPI_connection *_SPI_stack = NULL;
static _SPI_connection *_SPI_current = NULL;
@@ -46,6 +46,7 @@ extern void ShowUsage(void);
int
SPI_connect()
{
+
/*
* When procedure called by Executor _SPI_curid expected to be equal
* to _SPI_connected
@@ -80,14 +81,14 @@ SPI_connect()
/* Create memory contexts for this procedure */
_SPI_current->procCxt = AllocSetContextCreate(TopTransactionContext,
"SPI Proc",
- ALLOCSET_DEFAULT_MINSIZE,
- ALLOCSET_DEFAULT_INITSIZE,
- ALLOCSET_DEFAULT_MAXSIZE);
+ ALLOCSET_DEFAULT_MINSIZE,
+ ALLOCSET_DEFAULT_INITSIZE,
+ ALLOCSET_DEFAULT_MAXSIZE);
_SPI_current->execCxt = AllocSetContextCreate(TopTransactionContext,
"SPI Exec",
- ALLOCSET_DEFAULT_MINSIZE,
- ALLOCSET_DEFAULT_INITSIZE,
- ALLOCSET_DEFAULT_MAXSIZE);
+ ALLOCSET_DEFAULT_MINSIZE,
+ ALLOCSET_DEFAULT_INITSIZE,
+ ALLOCSET_DEFAULT_MAXSIZE);
/* ... and switch to procedure's context */
_SPI_current->savedcxt = MemoryContextSwitchTo(_SPI_current->procCxt);
@@ -146,6 +147,7 @@ SPI_finish()
void
AtEOXact_SPI(void)
{
+
/*
* Note that memory contexts belonging to SPI stack entries will be
* freed automatically, so we can ignore them here. We just need to
@@ -425,8 +427,8 @@ SPI_getvalue(HeapTuple tuple, TupleDesc tupdesc, int fnumber)
}
/*
- * If we have a toasted datum, forcibly detoast it here to avoid memory
- * leakage inside the type's output routine.
+ * If we have a toasted datum, forcibly detoast it here to avoid
+ * memory leakage inside the type's output routine.
*/
if (typisvarlena)
val = PointerGetDatum(PG_DETOAST_DATUM(origval));
@@ -436,7 +438,7 @@ SPI_getvalue(HeapTuple tuple, TupleDesc tupdesc, int fnumber)
result = OidFunctionCall3(foutoid,
val,
ObjectIdGetDatum(typelem),
- Int32GetDatum(tupdesc->attrs[fnumber - 1]->atttypmod));
+ Int32GetDatum(tupdesc->attrs[fnumber - 1]->atttypmod));
/* Clean up detoasted copy, if any */
if (val != origval)
@@ -833,14 +835,13 @@ _SPI_pquery(QueryDesc *queryDesc, EState *state, int tcount)
#endif
tupdesc = ExecutorStart(queryDesc, state);
- /* Don't work currently --- need to rearrange callers so that
- * we prepare the portal before doing CreateExecutorState() etc.
- * See pquery.c for the correct order of operations.
+ /*
+ * Don't work currently --- need to rearrange callers so that we
+ * prepare the portal before doing CreateExecutorState() etc. See
+ * pquery.c for the correct order of operations.
*/
if (isRetrieveIntoPortal)
- {
elog(FATAL, "SPI_select: retrieve into portal not implemented");
- }
ExecutorRun(queryDesc, state, EXEC_FOR, (long) tcount);
@@ -901,9 +902,7 @@ _SPI_begin_call(bool execmem)
elog(FATAL, "SPI: stack corrupted");
if (execmem) /* switch to the Executor memory context */
- {
_SPI_execmem();
- }
return 0;
}