aboutsummaryrefslogtreecommitdiff
path: root/src/backend/executor
diff options
context:
space:
mode:
Diffstat (limited to 'src/backend/executor')
-rw-r--r--src/backend/executor/execAmi.c160
-rw-r--r--src/backend/executor/execFlatten.c38
-rw-r--r--src/backend/executor/execJunk.c104
-rw-r--r--src/backend/executor/execMain.c395
-rw-r--r--src/backend/executor/execProcnode.c592
-rw-r--r--src/backend/executor/execQual.c444
-rw-r--r--src/backend/executor/execScan.c12
-rw-r--r--src/backend/executor/execTuples.c258
-rw-r--r--src/backend/executor/execUtils.c194
-rw-r--r--src/backend/executor/functions.c70
-rw-r--r--src/backend/executor/nodeAgg.c164
-rw-r--r--src/backend/executor/nodeAppend.c88
-rw-r--r--src/backend/executor/nodeGroup.c54
-rw-r--r--src/backend/executor/nodeHash.c148
-rw-r--r--src/backend/executor/nodeHashjoin.c136
-rw-r--r--src/backend/executor/nodeIndexscan.c157
-rw-r--r--src/backend/executor/nodeMaterial.c42
-rw-r--r--src/backend/executor/nodeMergejoin.c997
-rw-r--r--src/backend/executor/nodeNestloop.c26
-rw-r--r--src/backend/executor/nodeResult.c18
-rw-r--r--src/backend/executor/nodeSeqscan.c60
-rw-r--r--src/backend/executor/nodeSort.c50
-rw-r--r--src/backend/executor/nodeTee.c72
-rw-r--r--src/backend/executor/nodeUnique.c50
-rw-r--r--src/backend/executor/spi.c252
25 files changed, 2295 insertions, 2286 deletions
diff --git a/src/backend/executor/execAmi.c b/src/backend/executor/execAmi.c
index 401924485e0..3aeb78ed370 100644
--- a/src/backend/executor/execAmi.c
+++ b/src/backend/executor/execAmi.c
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/executor/execAmi.c,v 1.6 1997/09/07 04:41:09 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/executor/execAmi.c,v 1.7 1997/09/08 02:22:23 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -74,8 +74,8 @@ ExecOpenScanR(Oid relOid,
Relation * returnRelation, /* return */
Pointer * returnScanDesc) /* return */
{
- Relation relation;
- Pointer scanDesc;
+ Relation relation;
+ Pointer scanDesc;
/* ----------------
* note: scanDesc returned by ExecBeginScan can be either
@@ -104,10 +104,10 @@ ExecOpenScanR(Oid relOid,
* returns a relation descriptor given an object id.
* ----------------------------------------------------------------
*/
-static Relation
+static Relation
ExecOpenR(Oid relationOid, bool isindex)
{
- Relation relation;
+ Relation relation;
relation = (Relation) NULL;
@@ -141,7 +141,7 @@ ExecOpenR(Oid relationOid, bool isindex)
* -cim 9/14/89
* ----------------------------------------------------------------
*/
-static Pointer
+static Pointer
ExecBeginScan(Relation relation,
int nkeys,
ScanKey skeys,
@@ -149,7 +149,7 @@ ExecBeginScan(Relation relation,
ScanDirection dir,
TimeQual time_range)
{
- Pointer scanDesc;
+ Pointer scanDesc;
scanDesc = NULL;
@@ -198,8 +198,8 @@ void
ExecCloseR(Plan * node)
{
CommonScanState *state;
- Relation relation;
- HeapScanDesc scanDesc;
+ Relation relation;
+ HeapScanDesc scanDesc;
/* ----------------
* shut down the heap scan and close the heap relation
@@ -208,29 +208,29 @@ ExecCloseR(Plan * node)
switch (nodeTag(node))
{
- case T_SeqScan:
- state = ((SeqScan *) node)->scanstate;
- break;
+ case T_SeqScan:
+ state = ((SeqScan *) node)->scanstate;
+ break;
- case T_IndexScan:
- state = ((IndexScan *) node)->scan.scanstate;
- break;
+ case T_IndexScan:
+ state = ((IndexScan *) node)->scan.scanstate;
+ break;
- case T_Material:
- state = &(((Material *) node)->matstate->csstate);
- break;
+ case T_Material:
+ state = &(((Material *) node)->matstate->csstate);
+ break;
- case T_Sort:
- state = &(((Sort *) node)->sortstate->csstate);
- break;
+ case T_Sort:
+ state = &(((Sort *) node)->sortstate->csstate);
+ break;
- case T_Agg:
- state = &(((Agg *) node)->aggstate->csstate);
- break;
+ case T_Agg:
+ state = &(((Agg *) node)->aggstate->csstate);
+ break;
- default:
- elog(DEBUG, "ExecCloseR: not a scan, material, or sort node!");
- return;
+ default:
+ elog(DEBUG, "ExecCloseR: not a scan, material, or sort node!");
+ return;
}
relation = state->css_currentRelation;
@@ -249,12 +249,12 @@ ExecCloseR(Plan * node)
*/
if (nodeTag(node) == T_IndexScan)
{
- IndexScan *iscan = (IndexScan *) node;
+ IndexScan *iscan = (IndexScan *) node;
IndexScanState *indexstate;
- int numIndices;
- RelationPtr indexRelationDescs;
+ int numIndices;
+ RelationPtr indexRelationDescs;
IndexScanDescPtr indexScanDescs;
- int i;
+ int i;
indexstate = iscan->indxstate;
numIndices = indexstate->iss_NumIndices;
@@ -292,32 +292,32 @@ ExecReScan(Plan * node, ExprContext * exprCtxt, Plan * parent)
{
switch (nodeTag(node))
{
- case T_SeqScan:
- ExecSeqReScan((SeqScan *) node, exprCtxt, parent);
- return;
-
- case T_IndexScan:
- ExecIndexReScan((IndexScan *) node, exprCtxt, parent);
- return;
-
- case T_Material:
-
- /*
- * the first call to ExecReScan should have no effect because
- * everything is initialized properly already. the following
- * calls will be handled by ExecSeqReScan() because the nodes
- * below the Material node have already been materialized into a
- * temp relation.
- */
- return;
+ case T_SeqScan:
+ ExecSeqReScan((SeqScan *) node, exprCtxt, parent);
+ return;
+
+ case T_IndexScan:
+ ExecIndexReScan((IndexScan *) node, exprCtxt, parent);
+ return;
+
+ case T_Material:
+
+ /*
+ * the first call to ExecReScan should have no effect because
+ * everything is initialized properly already. the following
+ * calls will be handled by ExecSeqReScan() because the nodes
+ * below the Material node have already been materialized into
+ * a temp relation.
+ */
+ return;
- case T_Tee:
- ExecTeeReScan((Tee *) node, exprCtxt, parent);
- break;
+ case T_Tee:
+ ExecTeeReScan((Tee *) node, exprCtxt, parent);
+ break;
- default:
- elog(WARN, "ExecReScan: not a seqscan or indexscan node.");
- return;
+ default:
+ elog(WARN, "ExecReScan: not a seqscan or indexscan node.");
+ return;
}
}
@@ -355,21 +355,21 @@ ExecMarkPos(Plan * node)
{
switch (nodeTag(node))
{
- case T_SeqScan:
- ExecSeqMarkPos((SeqScan *) node);
- break;
+ case T_SeqScan:
+ ExecSeqMarkPos((SeqScan *) node);
+ break;
- case T_IndexScan:
- ExecIndexMarkPos((IndexScan *) node);
- break;
+ case T_IndexScan:
+ ExecIndexMarkPos((IndexScan *) node);
+ break;
- case T_Sort:
- ExecSortMarkPos((Sort *) node);
- break;
+ case T_Sort:
+ ExecSortMarkPos((Sort *) node);
+ break;
- default:
- /* elog(DEBUG, "ExecMarkPos: unsupported node type"); */
- break;
+ default:
+ /* elog(DEBUG, "ExecMarkPos: unsupported node type"); */
+ break;
}
return;
}
@@ -385,21 +385,21 @@ ExecRestrPos(Plan * node)
{
switch (nodeTag(node))
{
- case T_SeqScan:
- ExecSeqRestrPos((SeqScan *) node);
- return;
+ case T_SeqScan:
+ ExecSeqRestrPos((SeqScan *) node);
+ return;
- case T_IndexScan:
- ExecIndexRestrPos((IndexScan *) node);
- return;
+ case T_IndexScan:
+ ExecIndexRestrPos((IndexScan *) node);
+ return;
- case T_Sort:
- ExecSortRestrPos((Sort *) node);
- return;
+ case T_Sort:
+ ExecSortRestrPos((Sort *) node);
+ return;
- default:
- /* elog(DEBUG, "ExecRestrPos: node type not supported"); */
- return;
+ default:
+ /* elog(DEBUG, "ExecRestrPos: node type not supported"); */
+ return;
}
}
@@ -422,7 +422,7 @@ Relation
ExecCreatR(TupleDesc tupType,
Oid relationOid)
{
- Relation relDesc;
+ Relation relDesc;
EU3_printf("ExecCreatR: %s type=%d oid=%d\n",
"entering: ", tupType, relationOid);
diff --git a/src/backend/executor/execFlatten.c b/src/backend/executor/execFlatten.c
index 43d616712fa..cc98dd6e204 100644
--- a/src/backend/executor/execFlatten.c
+++ b/src/backend/executor/execFlatten.c
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/executor/Attic/execFlatten.c,v 1.3 1997/09/07 04:41:12 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/executor/Attic/execFlatten.c,v 1.4 1997/09/08 02:22:25 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -45,7 +45,7 @@ ExecEvalIter(Iter * iterNode,
bool * resultIsNull,
bool * iterIsDone)
{
- Node *expression;
+ Node *expression;
expression = iterNode->iterexpr;
@@ -66,13 +66,13 @@ ExecEvalFjoin(TargetEntry * tlist,
{
#ifdef SETS_FIXED
- bool isDone;
- int curNode;
- List *tlistP;
+ bool isDone;
+ int curNode;
+ List *tlistP;
- Fjoin *fjNode = tlist->fjoin;
- DatumPtr resVect = fjNode->fj_results;
- BoolPtr alwaysDone = fjNode->fj_alwaysDone;
+ Fjoin *fjNode = tlist->fjoin;
+ DatumPtr resVect = fjNode->fj_results;
+ BoolPtr alwaysDone = fjNode->fj_alwaysDone;
if (fj_isDone)
*fj_isDone = false;
@@ -90,7 +90,7 @@ ExecEvalFjoin(TargetEntry * tlist,
curNode = 1;
foreach(tlistP, lnext(tlist))
{
- TargetEntry *tle = lfirst(tlistP);
+ TargetEntry *tle = lfirst(tlistP);
resVect[curNode] = ExecEvalIter((Iter *) tle->expr,
econtext,
@@ -181,19 +181,19 @@ ExecEvalFjoin(TargetEntry * tlist,
}
#ifdef SETS_FIXED
-static bool
+static bool
FjoinBumpOuterNodes(TargetEntry * tlist,
ExprContext * econtext,
DatumPtr results,
char *nulls)
{
- bool funcIsDone = true;
- Fjoin *fjNode = tlist->fjoin;
- char *alwaysDone = fjNode->fj_alwaysDone;
- List *outerList = lnext(tlist);
- List *trailers = lnext(tlist);
- int trailNode = 1;
- int curNode = 1;
+ bool funcIsDone = true;
+ Fjoin *fjNode = tlist->fjoin;
+ char *alwaysDone = fjNode->fj_alwaysDone;
+ List *outerList = lnext(tlist);
+ List *trailers = lnext(tlist);
+ int trailNode = 1;
+ int curNode = 1;
/*
* Run through list of functions until we get to one that isn't yet
@@ -201,7 +201,7 @@ FjoinBumpOuterNodes(TargetEntry * tlist,
*/
while ((funcIsDone == true) && (outerList != NIL))
{
- TargetEntry *tle = lfirst(outerList);
+ TargetEntry *tle = lfirst(outerList);
if (alwaysDone[curNode] == true)
nulls[curNode] = 'n';
@@ -232,7 +232,7 @@ FjoinBumpOuterNodes(TargetEntry * tlist,
trailNode = 1;
while (trailNode != curNode - 1)
{
- TargetEntry *tle = lfirst(trailers);
+ TargetEntry *tle = lfirst(trailers);
if (alwaysDone[trailNode] != true)
results[trailNode] = ExecEvalIter((Iter) tle->expr,
diff --git a/src/backend/executor/execJunk.c b/src/backend/executor/execJunk.c
index 3ad41bd393f..1c9476fc35f 100644
--- a/src/backend/executor/execJunk.c
+++ b/src/backend/executor/execJunk.c
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/executor/execJunk.c,v 1.6 1997/09/07 04:41:14 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/executor/execJunk.c,v 1.7 1997/09/08 02:22:27 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -60,24 +60,24 @@
* Initialize the Junk filter.
*-------------------------------------------------------------------------
*/
-JunkFilter *
+JunkFilter *
ExecInitJunkFilter(List * targetList)
{
- JunkFilter *junkfilter;
- List *cleanTargetList;
- int len,
- cleanLength;
- TupleDesc tupType,
- cleanTupType;
- List *t;
- TargetEntry *tle;
- Resdom *resdom,
- *cleanResdom;
- int resjunk;
- AttrNumber cleanResno;
- AttrNumber *cleanMap;
- Size size;
- Node *expr;
+ JunkFilter *junkfilter;
+ List *cleanTargetList;
+ int len,
+ cleanLength;
+ TupleDesc tupType,
+ cleanTupType;
+ List *t;
+ TargetEntry *tle;
+ Resdom *resdom,
+ *cleanResdom;
+ int resjunk;
+ AttrNumber cleanResno;
+ AttrNumber *cleanMap;
+ Size size;
+ Node *expr;
/* ---------------------
* First find the "clean" target list, i.e. all the entries
@@ -91,7 +91,7 @@ ExecInitJunkFilter(List * targetList)
foreach(t, targetList)
{
- TargetEntry *rtarget = lfirst(t);
+ TargetEntry *rtarget = lfirst(t);
if (rtarget->resdom != NULL)
{
@@ -120,11 +120,11 @@ ExecInitJunkFilter(List * targetList)
else
{
#ifdef SETS_FIXED
- List *fjListP;
- Fjoin *cleanFjoin;
- List *cleanFjList;
- List *fjList = lfirst(t);
- Fjoin *fjNode = (Fjoin *) tl_node(fjList);
+ List *fjListP;
+ Fjoin *cleanFjoin;
+ List *cleanFjList;
+ List *fjList = lfirst(t);
+ Fjoin *fjNode = (Fjoin *) tl_node(fjList);
cleanFjoin = (Fjoin) copyObject((Node) fjNode);
cleanFjList = lcons(cleanFjoin, NIL);
@@ -139,7 +139,7 @@ ExecInitJunkFilter(List * targetList)
foreach(fjListP, lnext(fjList))
{
- TargetEntry *tle = lfirst(fjListP);
+ TargetEntry *tle = lfirst(fjListP);
resdom = tle->resdom;
expr = tle->expr;
@@ -189,7 +189,7 @@ ExecInitJunkFilter(List * targetList)
cleanResno = 1;
foreach(t, targetList)
{
- TargetEntry *tle = lfirst(t);
+ TargetEntry *tle = lfirst(t);
if (tle->resdom != NULL)
{
@@ -205,9 +205,9 @@ ExecInitJunkFilter(List * targetList)
else
{
#ifdef SETS_FIXED
- List fjListP;
- List fjList = lfirst(t);
- Fjoin fjNode = (Fjoin) lfirst(fjList);
+ List fjListP;
+ List fjList = lfirst(t);
+ Fjoin fjNode = (Fjoin) lfirst(fjList);
/* what the hell is this????? */
resdom = (Resdom) lfirst(get_fj_innerNode(fjNode));
@@ -219,7 +219,7 @@ ExecInitJunkFilter(List * targetList)
#ifdef SETS_FIXED
foreach(fjListP, lnext(fjList))
{
- TargetEntry *tle = lfirst(fjListP);
+ TargetEntry *tle = lfirst(fjListP);
resdom = tle->resdom;
cleanMap[cleanResno - 1] = resdom->resno;
@@ -270,14 +270,14 @@ ExecGetJunkAttribute(JunkFilter * junkfilter,
Datum * value,
bool * isNull)
{
- List *targetList;
- List *t;
- Resdom *resdom;
- AttrNumber resno;
- char *resname;
- int resjunk;
- TupleDesc tupType;
- HeapTuple tuple;
+ List *targetList;
+ List *t;
+ Resdom *resdom;
+ AttrNumber resno;
+ char *resname;
+ int resjunk;
+ TupleDesc tupType;
+ HeapTuple tuple;
/* ---------------------
* first look in the junkfilter's target list for
@@ -289,7 +289,7 @@ ExecGetJunkAttribute(JunkFilter * junkfilter,
foreach(t, targetList)
{
- TargetEntry *tle = lfirst(t);
+ TargetEntry *tle = lfirst(t);
resdom = tle->resdom;
resname = resdom->resname;
@@ -330,19 +330,19 @@ ExecGetJunkAttribute(JunkFilter * junkfilter,
HeapTuple
ExecRemoveJunk(JunkFilter * junkfilter, TupleTableSlot * slot)
{
- HeapTuple tuple;
- HeapTuple cleanTuple;
- AttrNumber *cleanMap;
- TupleDesc cleanTupType;
- TupleDesc tupType;
- int cleanLength;
- bool isNull;
- int i;
- Size size;
- Datum *values;
- char *nulls;
- Datum values_array[64];
- char nulls_array[64];
+ HeapTuple tuple;
+ HeapTuple cleanTuple;
+ AttrNumber *cleanMap;
+ TupleDesc cleanTupType;
+ TupleDesc tupType;
+ int cleanLength;
+ bool isNull;
+ int i;
+ Size size;
+ Datum *values;
+ char *nulls;
+ Datum values_array[64];
+ char nulls_array[64];
/* ----------------
* get info from the slot and the junk filter
@@ -391,7 +391,7 @@ ExecRemoveJunk(JunkFilter * junkfilter, TupleTableSlot * slot)
*/
for (i = 0; i < cleanLength; i++)
{
- Datum d = (Datum)
+ Datum d = (Datum)
heap_getattr(tuple, InvalidBuffer, cleanMap[i], tupType, &isNull);
values[i] = d;
diff --git a/src/backend/executor/execMain.c b/src/backend/executor/execMain.c
index 2bf0edaf35e..c7ff5aa9107 100644
--- a/src/backend/executor/execMain.c
+++ b/src/backend/executor/execMain.c
@@ -26,7 +26,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/executor/execMain.c,v 1.23 1997/09/07 04:41:18 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/executor/execMain.c,v 1.24 1997/09/08 02:22:28 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -62,14 +62,14 @@ ExecCheckPerms(CmdType operation, int resultRelation, List * rangeTable,
static TupleDesc
InitPlan(CmdType operation, Query * parseTree,
Plan * plan, EState * estate);
-static void EndPlan(Plan * plan, EState * estate);
+static void EndPlan(Plan * plan, EState * estate);
static TupleTableSlot *
ExecutePlan(EState * estate, Plan * plan,
Query * parseTree, CmdType operation,
int numberTuples, ScanDirection direction,
void (*printfunc) ());
-static void ExecRetrieve(TupleTableSlot * slot, void (*printfunc) (),
- EState * estate);
+static void ExecRetrieve(TupleTableSlot * slot, void (*printfunc) (),
+ EState * estate);
static void
ExecAppend(TupleTableSlot * slot, ItemPointer tupleid,
EState * estate);
@@ -83,7 +83,7 @@ ExecReplace(TupleTableSlot * slot, ItemPointer tupleid,
/* end of local decls */
#ifdef QUERY_LIMIT
-static int queryLimit = ALL_TUPLES;
+static int queryLimit = ALL_TUPLES;
#undef ALL_TUPLES
#define ALL_TUPLES queryLimit
@@ -112,7 +112,7 @@ ExecutorLimit(int limit)
TupleDesc
ExecutorStart(QueryDesc * queryDesc, EState * estate)
{
- TupleDesc result;
+ TupleDesc result;
/* sanity checks */
Assert(queryDesc != NULL);
@@ -157,12 +157,12 @@ ExecutorStart(QueryDesc * queryDesc, EState * estate)
TupleTableSlot *
ExecutorRun(QueryDesc * queryDesc, EState * estate, int feature, int count)
{
- CmdType operation;
- Query *parseTree;
- Plan *plan;
+ CmdType operation;
+ Query *parseTree;
+ Plan *plan;
TupleTableSlot *result;
- CommandDest dest;
- void (*destination) ();
+ CommandDest dest;
+ void (*destination) ();
/* ----------------
* sanity checks
@@ -200,7 +200,7 @@ ExecutorRun(QueryDesc * queryDesc, EState * estate, int feature, int count)
if ((nodeTag(plan) == T_IndexScan) &&
(((IndexScan *) plan)->indxstate->iss_RuntimeKeyInfo != NULL))
{
- ExprContext *econtext;
+ ExprContext *econtext;
econtext = ((IndexScan *) plan)->scan.scanstate->cstate.cs_ExprContext;
ExecIndexReScan((IndexScan *) plan, econtext, plan);
@@ -211,57 +211,57 @@ ExecutorRun(QueryDesc * queryDesc, EState * estate, int feature, int count)
switch (feature)
{
- case EXEC_RUN:
- result = ExecutePlan(estate,
- plan,
- parseTree,
- operation,
- ALL_TUPLES,
- ForwardScanDirection,
- destination);
- break;
- case EXEC_FOR:
- result = ExecutePlan(estate,
- plan,
- parseTree,
- operation,
- count,
- ForwardScanDirection,
- destination);
- break;
+ case EXEC_RUN:
+ result = ExecutePlan(estate,
+ plan,
+ parseTree,
+ operation,
+ ALL_TUPLES,
+ ForwardScanDirection,
+ destination);
+ break;
+ case EXEC_FOR:
+ result = ExecutePlan(estate,
+ plan,
+ parseTree,
+ operation,
+ count,
+ ForwardScanDirection,
+ destination);
+ break;
- /* ----------------
- * retrieve next n "backward" tuples
- * ----------------
- */
- case EXEC_BACK:
- result = ExecutePlan(estate,
- plan,
- parseTree,
- operation,
- count,
- BackwardScanDirection,
- destination);
- break;
+ /* ----------------
+ * retrieve next n "backward" tuples
+ * ----------------
+ */
+ case EXEC_BACK:
+ result = ExecutePlan(estate,
+ plan,
+ parseTree,
+ operation,
+ count,
+ BackwardScanDirection,
+ destination);
+ break;
- /* ----------------
- * return one tuple but don't "retrieve" it.
- * (this is used by the rule manager..) -cim 9/14/89
- * ----------------
- */
- case EXEC_RETONE:
- result = ExecutePlan(estate,
- plan,
- parseTree,
- operation,
- ONE_TUPLE,
- ForwardScanDirection,
- destination);
- break;
- default:
- result = NULL;
- elog(DEBUG, "ExecutorRun: Unknown feature %d", feature);
- break;
+ /* ----------------
+ * return one tuple but don't "retrieve" it.
+ * (this is used by the rule manager..) -cim 9/14/89
+ * ----------------
+ */
+ case EXEC_RETONE:
+ result = ExecutePlan(estate,
+ plan,
+ parseTree,
+ operation,
+ ONE_TUPLE,
+ ForwardScanDirection,
+ destination);
+ break;
+ default:
+ result = NULL;
+ elog(DEBUG, "ExecutorRun: Unknown feature %d", feature);
+ break;
}
return result;
@@ -303,17 +303,17 @@ ExecCheckPerms(CmdType operation,
List * rangeTable,
Query * parseTree)
{
- int i = 1;
- Oid relid;
- HeapTuple htp;
- List *lp;
- List *qvars,
- *tvars;
- int32 ok = 1,
- aclcheck_result = -1;
- char *opstr;
- NameData rname;
- char *userName;
+ int i = 1;
+ Oid relid;
+ HeapTuple htp;
+ List *lp;
+ List *qvars,
+ *tvars;
+ int32 ok = 1,
+ aclcheck_result = -1;
+ char *opstr;
+ NameData rname;
+ char *userName;
#define CHECK(MODE) pg_aclcheck(rname.data, userName, MODE)
@@ -321,7 +321,7 @@ ExecCheckPerms(CmdType operation,
foreach(lp, rangeTable)
{
- RangeTblEntry *rte = lfirst(lp);
+ RangeTblEntry *rte = lfirst(lp);
relid = rte->relid;
htp = SearchSysCacheTuple(RELOID,
@@ -348,20 +348,21 @@ ExecCheckPerms(CmdType operation,
}
switch (operation)
{
- case CMD_INSERT:
- ok = ((aclcheck_result = CHECK(ACL_AP)) == ACLCHECK_OK) ||
- ((aclcheck_result = CHECK(ACL_WR)) == ACLCHECK_OK);
- opstr = "append";
- break;
- case CMD_NOTIFY: /* what does this mean?? -- jw, 1/6/94 */
- case CMD_DELETE:
- case CMD_UPDATE:
- ok = ((aclcheck_result = CHECK(ACL_WR)) == ACLCHECK_OK);
- opstr = "write";
- break;
- default:
- elog(WARN, "ExecCheckPerms: bogus operation %d",
- operation);
+ case CMD_INSERT:
+ ok = ((aclcheck_result = CHECK(ACL_AP)) == ACLCHECK_OK) ||
+ ((aclcheck_result = CHECK(ACL_WR)) == ACLCHECK_OK);
+ opstr = "append";
+ break;
+ case CMD_NOTIFY: /* what does this mean?? -- jw,
+ * 1/6/94 */
+ case CMD_DELETE:
+ case CMD_UPDATE:
+ ok = ((aclcheck_result = CHECK(ACL_WR)) == ACLCHECK_OK);
+ opstr = "write";
+ break;
+ default:
+ elog(WARN, "ExecCheckPerms: bogus operation %d",
+ operation);
}
}
else
@@ -388,16 +389,16 @@ ExecCheckPerms(CmdType operation,
* and start up the rule manager
* ----------------------------------------------------------------
*/
-static TupleDesc
+static TupleDesc
InitPlan(CmdType operation, Query * parseTree, Plan * plan, EState * estate)
{
- List *rangeTable;
- int resultRelation;
- Relation intoRelationDesc;
+ List *rangeTable;
+ int resultRelation;
+ Relation intoRelationDesc;
- TupleDesc tupType;
- List *targetList;
- int len;
+ TupleDesc tupType;
+ List *targetList;
+ int len;
/* ----------------
* get information from query descriptor
@@ -434,11 +435,11 @@ InitPlan(CmdType operation, Query * parseTree, Plan * plan, EState * estate)
* initialize the result relation info stuff.
* ----------------
*/
- RelationInfo *resultRelationInfo;
- Index resultRelationIndex;
- RangeTblEntry *rtentry;
- Oid resultRelationOid;
- Relation resultRelationDesc;
+ RelationInfo *resultRelationInfo;
+ Index resultRelationIndex;
+ RangeTblEntry *rtentry;
+ Oid resultRelationOid;
+ Relation resultRelationDesc;
resultRelationIndex = resultRelation;
rtentry = rt_fetch(resultRelationIndex, rangeTable);
@@ -492,8 +493,8 @@ InitPlan(CmdType operation, Query * parseTree, Plan * plan, EState * estate)
* ----------------
*/
{
- int nSlots = ExecCountSlotsNode(plan);
- TupleTable tupleTable = ExecCreateTupleTable(nSlots + 10); /* why add ten? - jolly */
+ int nSlots = ExecCountSlotsNode(plan);
+ TupleTable tupleTable = ExecCreateTupleTable(nSlots + 10); /* why add ten? - jolly */
estate->es_tupleTable = tupleTable;
}
@@ -530,7 +531,7 @@ InitPlan(CmdType operation, Query * parseTree, Plan * plan, EState * estate)
operation == CMD_INSERT)
{
- JunkFilter *j = (JunkFilter *) ExecInitJunkFilter(targetList);
+ JunkFilter *j = (JunkFilter *) ExecInitJunkFilter(targetList);
estate->es_junkFilter = j;
}
@@ -545,10 +546,10 @@ InitPlan(CmdType operation, Query * parseTree, Plan * plan, EState * estate)
if (operation == CMD_SELECT)
{
- char *intoName;
- char archiveMode;
- Oid intoRelationId;
- TupleDesc tupdesc;
+ char *intoName;
+ char archiveMode;
+ Oid intoRelationId;
+ TupleDesc tupdesc;
if (!parseTree->isPortal)
{
@@ -626,8 +627,8 @@ InitPlan(CmdType operation, Query * parseTree, Plan * plan, EState * estate)
static void
EndPlan(Plan * plan, EState * estate)
{
- RelationInfo *resultRelationInfo;
- Relation intoRelationDesc;
+ RelationInfo *resultRelationInfo;
+ Relation intoRelationDesc;
/* ----------------
* get information from state
@@ -647,7 +648,7 @@ EndPlan(Plan * plan, EState * estate)
* ----------------
*/
{
- TupleTable tupleTable = (TupleTable) estate->es_tupleTable;
+ TupleTable tupleTable = (TupleTable) estate->es_tupleTable;
ExecDestroyTupleTable(tupleTable, true); /* was missing last arg */
estate->es_tupleTable = NULL;
@@ -659,7 +660,7 @@ EndPlan(Plan * plan, EState * estate)
*/
if (resultRelationInfo != NULL)
{
- Relation resultRelationDesc;
+ Relation resultRelationDesc;
resultRelationDesc = resultRelationInfo->ri_RelationDesc;
heap_close(resultRelationDesc);
@@ -706,12 +707,12 @@ ExecutePlan(EState * estate,
ScanDirection direction,
void (*printfunc) ())
{
- JunkFilter *junkfilter;
+ JunkFilter *junkfilter;
TupleTableSlot *slot;
- ItemPointer tupleid = NULL;
+ ItemPointer tupleid = NULL;
ItemPointerData tuple_ctid;
- int current_tuple_count;
+ int current_tuple_count;
TupleTableSlot *result;
/* ----------------
@@ -770,11 +771,11 @@ ExecutePlan(EState * estate,
*/
if ((junkfilter = estate->es_junkFilter) != (JunkFilter *) NULL)
{
- Datum datum;
+ Datum datum;
/* NameData attrName; */
- HeapTuple newTuple;
- bool isNull;
+ HeapTuple newTuple;
+ bool isNull;
/* ---------------
* extract the 'ctid' junk attribute.
@@ -822,50 +823,50 @@ ExecutePlan(EState * estate,
switch (operation)
{
- case CMD_SELECT:
- ExecRetrieve(slot, /* slot containing tuple */
- printfunc, /* print function */
- estate); /* */
- result = slot;
- break;
+ case CMD_SELECT:
+ ExecRetrieve(slot, /* slot containing tuple */
+ printfunc, /* print function */
+ estate); /* */
+ result = slot;
+ break;
- case CMD_INSERT:
- ExecAppend(slot, tupleid, estate);
- result = NULL;
- break;
+ case CMD_INSERT:
+ ExecAppend(slot, tupleid, estate);
+ result = NULL;
+ break;
- case CMD_DELETE:
- ExecDelete(slot, tupleid, estate);
- result = NULL;
- break;
+ case CMD_DELETE:
+ ExecDelete(slot, tupleid, estate);
+ result = NULL;
+ break;
- case CMD_UPDATE:
- ExecReplace(slot, tupleid, estate, parseTree);
- result = NULL;
- break;
+ case CMD_UPDATE:
+ ExecReplace(slot, tupleid, estate, parseTree);
+ result = NULL;
+ break;
- /*
- * Total hack. I'm ignoring any accessor functions for
- * Relation, RelationTupleForm, NameData. Assuming that
- * NameData.data has offset 0.
- */
- case CMD_NOTIFY:
- {
- RelationInfo *rInfo = estate->es_result_relation_info;
- Relation rDesc = rInfo->ri_RelationDesc;
+ /*
+ * Total hack. I'm ignoring any accessor functions for
+ * Relation, RelationTupleForm, NameData. Assuming that
+ * NameData.data has offset 0.
+ */
+ case CMD_NOTIFY:
+ {
+ RelationInfo *rInfo = estate->es_result_relation_info;
+ Relation rDesc = rInfo->ri_RelationDesc;
+
+ Async_Notify(rDesc->rd_rel->relname.data);
+ result = NULL;
+ current_tuple_count = 0;
+ numberTuples = 1;
+ elog(DEBUG, "ExecNotify %s", &rDesc->rd_rel->relname);
+ }
+ break;
- Async_Notify(rDesc->rd_rel->relname.data);
+ default:
+ elog(DEBUG, "ExecutePlan: unknown operation in queryDesc");
result = NULL;
- current_tuple_count = 0;
- numberTuples = 1;
- elog(DEBUG, "ExecNotify %s", &rDesc->rd_rel->relname);
- }
- break;
-
- default:
- elog(DEBUG, "ExecutePlan: unknown operation in queryDesc");
- result = NULL;
- break;
+ break;
}
/* ----------------
* check our tuple count.. if we've returned the
@@ -901,8 +902,8 @@ ExecRetrieve(TupleTableSlot * slot,
void (*printfunc) (),
EState * estate)
{
- HeapTuple tuple;
- TupleDesc attrtype;
+ HeapTuple tuple;
+ TupleDesc attrtype;
/* ----------------
* get the heap tuple out of the tuple table slot
@@ -944,11 +945,11 @@ ExecAppend(TupleTableSlot * slot,
ItemPointer tupleid,
EState * estate)
{
- HeapTuple tuple;
- RelationInfo *resultRelationInfo;
- Relation resultRelationDesc;
- int numIndices;
- Oid newId;
+ HeapTuple tuple;
+ RelationInfo *resultRelationInfo;
+ Relation resultRelationDesc;
+ int numIndices;
+ Oid newId;
/* ----------------
* get the heap tuple out of the tuple table slot
@@ -973,7 +974,7 @@ ExecAppend(TupleTableSlot * slot,
if (resultRelationDesc->trigdesc &&
resultRelationDesc->trigdesc->n_before_row[TRIGGER_EVENT_INSERT] > 0)
{
- HeapTuple newtuple;
+ HeapTuple newtuple;
newtuple = ExecBRInsertTriggers(resultRelationDesc, tuple);
@@ -995,7 +996,7 @@ ExecAppend(TupleTableSlot * slot,
if (resultRelationDesc->rd_att->constr)
{
- HeapTuple newtuple;
+ HeapTuple newtuple;
newtuple = ExecConstraints("ExecAppend", resultRelationDesc, tuple);
@@ -1049,8 +1050,8 @@ ExecDelete(TupleTableSlot * slot,
ItemPointer tupleid,
EState * estate)
{
- RelationInfo *resultRelationInfo;
- Relation resultRelationDesc;
+ RelationInfo *resultRelationInfo;
+ Relation resultRelationDesc;
/* ----------------
* get the result relation information
@@ -1063,7 +1064,7 @@ ExecDelete(TupleTableSlot * slot,
if (resultRelationDesc->trigdesc &&
resultRelationDesc->trigdesc->n_before_row[TRIGGER_EVENT_DELETE] > 0)
{
- bool dodelete;
+ bool dodelete;
dodelete = ExecBRDeleteTriggers(resultRelationDesc, tupleid);
@@ -1118,10 +1119,10 @@ ExecReplace(TupleTableSlot * slot,
EState * estate,
Query * parseTree)
{
- HeapTuple tuple;
- RelationInfo *resultRelationInfo;
- Relation resultRelationDesc;
- int numIndices;
+ HeapTuple tuple;
+ RelationInfo *resultRelationInfo;
+ Relation resultRelationDesc;
+ int numIndices;
/* ----------------
* abort the operation if not running transactions
@@ -1158,7 +1159,7 @@ ExecReplace(TupleTableSlot * slot,
if (resultRelationDesc->trigdesc &&
resultRelationDesc->trigdesc->n_before_row[TRIGGER_EVENT_UPDATE] > 0)
{
- HeapTuple newtuple;
+ HeapTuple newtuple;
newtuple = ExecBRUpdateTriggers(resultRelationDesc, tupleid, tuple);
@@ -1180,7 +1181,7 @@ ExecReplace(TupleTableSlot * slot,
if (resultRelationDesc->rd_att->constr)
{
- HeapTuple newtuple;
+ HeapTuple newtuple;
newtuple = ExecConstraints("ExecReplace", resultRelationDesc, tuple);
@@ -1244,21 +1245,21 @@ ExecReplace(TupleTableSlot * slot,
ExecARUpdateTriggers(resultRelationDesc, tupleid, tuple);
}
-static HeapTuple
+static HeapTuple
ExecAttrDefault(Relation rel, HeapTuple tuple)
{
- int ndef = rel->rd_att->constr->num_defval;
- AttrDefault *attrdef = rel->rd_att->constr->defval;
- ExprContext *econtext = makeNode(ExprContext);
- HeapTuple newtuple;
- Node *expr;
- bool isnull;
- bool isdone;
- Datum val;
- Datum *replValue = NULL;
- char *replNull = NULL;
- char *repl = NULL;
- int i;
+ int ndef = rel->rd_att->constr->num_defval;
+ AttrDefault *attrdef = rel->rd_att->constr->defval;
+ ExprContext *econtext = makeNode(ExprContext);
+ HeapTuple newtuple;
+ Node *expr;
+ bool isnull;
+ bool isdone;
+ Datum val;
+ Datum *replValue = NULL;
+ char *replNull = NULL;
+ char *repl = NULL;
+ int i;
econtext->ecxt_scantuple = NULL; /* scan tuple slot */
econtext->ecxt_innertuple = NULL; /* inner tuple slot */
@@ -1309,18 +1310,18 @@ ExecAttrDefault(Relation rel, HeapTuple tuple)
}
-static char *
+static char *
ExecRelCheck(Relation rel, HeapTuple tuple)
{
- int ncheck = rel->rd_att->constr->num_check;
- ConstrCheck *check = rel->rd_att->constr->check;
- ExprContext *econtext = makeNode(ExprContext);
+ int ncheck = rel->rd_att->constr->num_check;
+ ConstrCheck *check = rel->rd_att->constr->check;
+ ExprContext *econtext = makeNode(ExprContext);
TupleTableSlot *slot = makeNode(TupleTableSlot);
- RangeTblEntry *rte = makeNode(RangeTblEntry);
- List *rtlist;
- List *qual;
- bool res;
- int i;
+ RangeTblEntry *rte = makeNode(RangeTblEntry);
+ List *rtlist;
+ List *qual;
+ bool res;
+ int i;
slot->val = tuple;
slot->ttc_shouldFree = false;
@@ -1370,7 +1371,7 @@ ExecRelCheck(Relation rel, HeapTuple tuple)
HeapTuple
ExecConstraints(char *caller, Relation rel, HeapTuple tuple)
{
- HeapTuple newtuple = tuple;
+ HeapTuple newtuple = tuple;
Assert(rel->rd_att->constr);
@@ -1379,7 +1380,7 @@ ExecConstraints(char *caller, Relation rel, HeapTuple tuple)
if (rel->rd_att->constr->has_not_null)
{
- int attrChk;
+ int attrChk;
for (attrChk = 1; attrChk <= rel->rd_att->natts; attrChk++)
{
@@ -1391,7 +1392,7 @@ ExecConstraints(char *caller, Relation rel, HeapTuple tuple)
if (rel->rd_att->constr->num_check > 0)
{
- char *failed;
+ char *failed;
if ((failed = ExecRelCheck(rel, tuple)) != NULL)
elog(WARN, "%s: rejected due to CHECK constraint %s", caller, failed);
diff --git a/src/backend/executor/execProcnode.c b/src/backend/executor/execProcnode.c
index 89caefd162e..7e8cce52c70 100644
--- a/src/backend/executor/execProcnode.c
+++ b/src/backend/executor/execProcnode.c
@@ -11,7 +11,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/executor/execProcnode.c,v 1.3 1997/09/07 04:41:19 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/executor/execProcnode.c,v 1.4 1997/09/08 02:22:30 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -105,7 +105,7 @@
bool
ExecInitNode(Plan * node, EState * estate, Plan * parent)
{
- bool result;
+ bool result;
/* ----------------
* do nothing when we get to the end
@@ -117,82 +117,82 @@ ExecInitNode(Plan * node, EState * estate, Plan * parent)
switch (nodeTag(node))
{
- /* ----------------
- * control nodes
- * ----------------
- */
- case T_Result:
- result = ExecInitResult((Result *) node, estate, parent);
- break;
-
- case T_Append:
- result = ExecInitAppend((Append *) node, estate, parent);
- break;
-
- /* ----------------
- * scan nodes
- * ----------------
- */
- case T_SeqScan:
- result = ExecInitSeqScan((SeqScan *) node, estate, parent);
- break;
-
- case T_IndexScan:
- result = ExecInitIndexScan((IndexScan *) node, estate, parent);
- break;
-
- /* ----------------
- * join nodes
- * ----------------
- */
- case T_NestLoop:
- result = ExecInitNestLoop((NestLoop *) node, estate, parent);
- break;
-
- case T_MergeJoin:
- result = ExecInitMergeJoin((MergeJoin *) node, estate, parent);
- break;
-
- /* ----------------
- * materialization nodes
- * ----------------
- */
- case T_Material:
- result = ExecInitMaterial((Material *) node, estate, parent);
- break;
-
- case T_Sort:
- result = ExecInitSort((Sort *) node, estate, parent);
- break;
-
- case T_Unique:
- result = ExecInitUnique((Unique *) node, estate, parent);
- break;
-
- case T_Group:
- result = ExecInitGroup((Group *) node, estate, parent);
- break;
-
- case T_Agg:
- result = ExecInitAgg((Agg *) node, estate, parent);
- break;
-
- case T_Hash:
- result = ExecInitHash((Hash *) node, estate, parent);
- break;
-
- case T_HashJoin:
- result = ExecInitHashJoin((HashJoin *) node, estate, parent);
- break;
-
- case T_Tee:
- result = ExecInitTee((Tee *) node, estate, parent);
- break;
-
- default:
- elog(DEBUG, "ExecInitNode: node not yet supported: %d",
- nodeTag(node));
- result = FALSE;
+ /* ----------------
+ * control nodes
+ * ----------------
+ */
+ case T_Result:
+ result = ExecInitResult((Result *) node, estate, parent);
+ break;
+
+ case T_Append:
+ result = ExecInitAppend((Append *) node, estate, parent);
+ break;
+
+ /* ----------------
+ * scan nodes
+ * ----------------
+ */
+ case T_SeqScan:
+ result = ExecInitSeqScan((SeqScan *) node, estate, parent);
+ break;
+
+ case T_IndexScan:
+ result = ExecInitIndexScan((IndexScan *) node, estate, parent);
+ break;
+
+ /* ----------------
+ * join nodes
+ * ----------------
+ */
+ case T_NestLoop:
+ result = ExecInitNestLoop((NestLoop *) node, estate, parent);
+ break;
+
+ case T_MergeJoin:
+ result = ExecInitMergeJoin((MergeJoin *) node, estate, parent);
+ break;
+
+ /* ----------------
+ * materialization nodes
+ * ----------------
+ */
+ case T_Material:
+ result = ExecInitMaterial((Material *) node, estate, parent);
+ break;
+
+ case T_Sort:
+ result = ExecInitSort((Sort *) node, estate, parent);
+ break;
+
+ case T_Unique:
+ result = ExecInitUnique((Unique *) node, estate, parent);
+ break;
+
+ case T_Group:
+ result = ExecInitGroup((Group *) node, estate, parent);
+ break;
+
+ case T_Agg:
+ result = ExecInitAgg((Agg *) node, estate, parent);
+ break;
+
+ case T_Hash:
+ result = ExecInitHash((Hash *) node, estate, parent);
+ break;
+
+ case T_HashJoin:
+ result = ExecInitHashJoin((HashJoin *) node, estate, parent);
+ break;
+
+ case T_Tee:
+ result = ExecInitTee((Tee *) node, estate, parent);
+ break;
+
+ default:
+ elog(DEBUG, "ExecInitNode: node not yet supported: %d",
+ nodeTag(node));
+ result = FALSE;
}
return result;
@@ -220,82 +220,82 @@ ExecProcNode(Plan * node, Plan * parent)
switch (nodeTag(node))
{
- /* ----------------
- * control nodes
- * ----------------
- */
- case T_Result:
- result = ExecResult((Result *) node);
- break;
-
- case T_Append:
- result = ExecProcAppend((Append *) node);
- break;
-
- /* ----------------
- * scan nodes
- * ----------------
- */
- case T_SeqScan:
- result = ExecSeqScan((SeqScan *) node);
- break;
-
- case T_IndexScan:
- result = ExecIndexScan((IndexScan *) node);
- break;
-
- /* ----------------
- * join nodes
- * ----------------
- */
- case T_NestLoop:
- result = ExecNestLoop((NestLoop *) node, parent);
- break;
-
- case T_MergeJoin:
- result = ExecMergeJoin((MergeJoin *) node);
- break;
-
- /* ----------------
- * materialization nodes
- * ----------------
- */
- case T_Material:
- result = ExecMaterial((Material *) node);
- break;
-
- case T_Sort:
- result = ExecSort((Sort *) node);
- break;
-
- case T_Unique:
- result = ExecUnique((Unique *) node);
- break;
-
- case T_Group:
- result = ExecGroup((Group *) node);
- break;
-
- case T_Agg:
- result = ExecAgg((Agg *) node);
- break;
-
- case T_Hash:
- result = ExecHash((Hash *) node);
- break;
-
- case T_HashJoin:
- result = ExecHashJoin((HashJoin *) node);
- break;
-
- case T_Tee:
- result = ExecTee((Tee *) node, parent);
- break;
-
- default:
- elog(DEBUG, "ExecProcNode: node not yet supported: %d",
- nodeTag(node));
- result = FALSE;
+ /* ----------------
+ * control nodes
+ * ----------------
+ */
+ case T_Result:
+ result = ExecResult((Result *) node);
+ break;
+
+ case T_Append:
+ result = ExecProcAppend((Append *) node);
+ break;
+
+ /* ----------------
+ * scan nodes
+ * ----------------
+ */
+ case T_SeqScan:
+ result = ExecSeqScan((SeqScan *) node);
+ break;
+
+ case T_IndexScan:
+ result = ExecIndexScan((IndexScan *) node);
+ break;
+
+ /* ----------------
+ * join nodes
+ * ----------------
+ */
+ case T_NestLoop:
+ result = ExecNestLoop((NestLoop *) node, parent);
+ break;
+
+ case T_MergeJoin:
+ result = ExecMergeJoin((MergeJoin *) node);
+ break;
+
+ /* ----------------
+ * materialization nodes
+ * ----------------
+ */
+ case T_Material:
+ result = ExecMaterial((Material *) node);
+ break;
+
+ case T_Sort:
+ result = ExecSort((Sort *) node);
+ break;
+
+ case T_Unique:
+ result = ExecUnique((Unique *) node);
+ break;
+
+ case T_Group:
+ result = ExecGroup((Group *) node);
+ break;
+
+ case T_Agg:
+ result = ExecAgg((Agg *) node);
+ break;
+
+ case T_Hash:
+ result = ExecHash((Hash *) node);
+ break;
+
+ case T_HashJoin:
+ result = ExecHashJoin((HashJoin *) node);
+ break;
+
+ case T_Tee:
+ result = ExecTee((Tee *) node, parent);
+ break;
+
+ default:
+ elog(DEBUG, "ExecProcNode: node not yet supported: %d",
+ nodeTag(node));
+ result = FALSE;
}
return result;
@@ -309,68 +309,68 @@ ExecCountSlotsNode(Plan * node)
switch (nodeTag(node))
{
- /* ----------------
- * control nodes
- * ----------------
- */
- case T_Result:
- return ExecCountSlotsResult((Result *) node);
-
- case T_Append:
- return ExecCountSlotsAppend((Append *) node);
-
- /* ----------------
- * scan nodes
- * ----------------
- */
- case T_SeqScan:
- return ExecCountSlotsSeqScan((SeqScan *) node);
-
- case T_IndexScan:
- return ExecCountSlotsIndexScan((IndexScan *) node);
-
- /* ----------------
- * join nodes
- * ----------------
- */
- case T_NestLoop:
- return ExecCountSlotsNestLoop((NestLoop *) node);
-
- case T_MergeJoin:
- return ExecCountSlotsMergeJoin((MergeJoin *) node);
-
- /* ----------------
- * materialization nodes
- * ----------------
- */
- case T_Material:
- return ExecCountSlotsMaterial((Material *) node);
-
- case T_Sort:
- return ExecCountSlotsSort((Sort *) node);
-
- case T_Unique:
- return ExecCountSlotsUnique((Unique *) node);
-
- case T_Group:
- return ExecCountSlotsGroup((Group *) node);
-
- case T_Agg:
- return ExecCountSlotsAgg((Agg *) node);
-
- case T_Hash:
- return ExecCountSlotsHash((Hash *) node);
-
- case T_HashJoin:
- return ExecCountSlotsHashJoin((HashJoin *) node);
-
- case T_Tee:
- return ExecCountSlotsTee((Tee *) node);
-
- default:
- elog(WARN, "ExecCountSlotsNode: node not yet supported: %d",
- nodeTag(node));
- break;
+ /* ----------------
+ * control nodes
+ * ----------------
+ */
+ case T_Result:
+ return ExecCountSlotsResult((Result *) node);
+
+ case T_Append:
+ return ExecCountSlotsAppend((Append *) node);
+
+ /* ----------------
+ * scan nodes
+ * ----------------
+ */
+ case T_SeqScan:
+ return ExecCountSlotsSeqScan((SeqScan *) node);
+
+ case T_IndexScan:
+ return ExecCountSlotsIndexScan((IndexScan *) node);
+
+ /* ----------------
+ * join nodes
+ * ----------------
+ */
+ case T_NestLoop:
+ return ExecCountSlotsNestLoop((NestLoop *) node);
+
+ case T_MergeJoin:
+ return ExecCountSlotsMergeJoin((MergeJoin *) node);
+
+ /* ----------------
+ * materialization nodes
+ * ----------------
+ */
+ case T_Material:
+ return ExecCountSlotsMaterial((Material *) node);
+
+ case T_Sort:
+ return ExecCountSlotsSort((Sort *) node);
+
+ case T_Unique:
+ return ExecCountSlotsUnique((Unique *) node);
+
+ case T_Group:
+ return ExecCountSlotsGroup((Group *) node);
+
+ case T_Agg:
+ return ExecCountSlotsAgg((Agg *) node);
+
+ case T_Hash:
+ return ExecCountSlotsHash((Hash *) node);
+
+ case T_HashJoin:
+ return ExecCountSlotsHashJoin((HashJoin *) node);
+
+ case T_Tee:
+ return ExecCountSlotsTee((Tee *) node);
+
+ default:
+ elog(WARN, "ExecCountSlotsNode: node not yet supported: %d",
+ nodeTag(node));
+ break;
}
return 0;
}
@@ -399,85 +399,85 @@ ExecEndNode(Plan * node, Plan * parent)
switch (nodeTag(node))
{
- /* ----------------
- * control nodes
- * ----------------
- */
- case T_Result:
- ExecEndResult((Result *) node);
- break;
-
- case T_Append:
- ExecEndAppend((Append *) node);
- break;
-
- /* ----------------
- * scan nodes
- * ----------------
- */
- case T_SeqScan:
- ExecEndSeqScan((SeqScan *) node);
- break;
-
- case T_IndexScan:
- ExecEndIndexScan((IndexScan *) node);
- break;
-
- /* ----------------
- * join nodes
- * ----------------
- */
- case T_NestLoop:
- ExecEndNestLoop((NestLoop *) node);
- break;
-
- case T_MergeJoin:
- ExecEndMergeJoin((MergeJoin *) node);
- break;
-
- /* ----------------
- * materialization nodes
- * ----------------
- */
- case T_Material:
- ExecEndMaterial((Material *) node);
- break;
-
- case T_Sort:
- ExecEndSort((Sort *) node);
- break;
-
- case T_Unique:
- ExecEndUnique((Unique *) node);
- break;
-
- case T_Group:
- ExecEndGroup((Group *) node);
- break;
-
- case T_Agg:
- ExecEndAgg((Agg *) node);
- break;
-
- /* ----------------
- * XXX add hooks to these
- * ----------------
- */
- case T_Hash:
- ExecEndHash((Hash *) node);
- break;
-
- case T_HashJoin:
- ExecEndHashJoin((HashJoin *) node);
- break;
-
- case T_Tee:
- ExecEndTee((Tee *) node, parent);
- break;
-
- default:
- elog(DEBUG, "ExecEndNode: node not yet supported",
- nodeTag(node));
- break;
+ /* ----------------
+ * control nodes
+ * ----------------
+ */
+ case T_Result:
+ ExecEndResult((Result *) node);
+ break;
+
+ case T_Append:
+ ExecEndAppend((Append *) node);
+ break;
+
+ /* ----------------
+ * scan nodes
+ * ----------------
+ */
+ case T_SeqScan:
+ ExecEndSeqScan((SeqScan *) node);
+ break;
+
+ case T_IndexScan:
+ ExecEndIndexScan((IndexScan *) node);
+ break;
+
+ /* ----------------
+ * join nodes
+ * ----------------
+ */
+ case T_NestLoop:
+ ExecEndNestLoop((NestLoop *) node);
+ break;
+
+ case T_MergeJoin:
+ ExecEndMergeJoin((MergeJoin *) node);
+ break;
+
+ /* ----------------
+ * materialization nodes
+ * ----------------
+ */
+ case T_Material:
+ ExecEndMaterial((Material *) node);
+ break;
+
+ case T_Sort:
+ ExecEndSort((Sort *) node);
+ break;
+
+ case T_Unique:
+ ExecEndUnique((Unique *) node);
+ break;
+
+ case T_Group:
+ ExecEndGroup((Group *) node);
+ break;
+
+ case T_Agg:
+ ExecEndAgg((Agg *) node);
+ break;
+
+ /* ----------------
+ * XXX add hooks to these
+ * ----------------
+ */
+ case T_Hash:
+ ExecEndHash((Hash *) node);
+ break;
+
+ case T_HashJoin:
+ ExecEndHashJoin((HashJoin *) node);
+ break;
+
+ case T_Tee:
+ ExecEndTee((Tee *) node, parent);
+ break;
+
+ default:
+ elog(DEBUG, "ExecEndNode: node not yet supported",
+ nodeTag(node));
+ break;
}
}
diff --git a/src/backend/executor/execQual.c b/src/backend/executor/execQual.c
index 7b8cb18ef25..a1e01402656 100644
--- a/src/backend/executor/execQual.c
+++ b/src/backend/executor/execQual.c
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/executor/execQual.c,v 1.13 1997/09/07 04:41:20 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/executor/execQual.c,v 1.14 1997/09/08 02:22:33 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -65,31 +65,31 @@
* Currently only used by ExecHashGetBucket and set only by ExecMakeVarConst
* and by ExecEvalArrayRef.
*/
-bool execConstByVal;
-int execConstLen;
+bool execConstByVal;
+int execConstLen;
/* static functions decls */
-static Datum ExecEvalAggreg(Aggreg * agg, ExprContext * econtext, bool * isNull);
+static Datum ExecEvalAggreg(Aggreg * agg, ExprContext * econtext, bool * isNull);
static Datum
ExecEvalArrayRef(ArrayRef * arrayRef, ExprContext * econtext,
bool * isNull, bool * isDone);
-static Datum ExecEvalAnd(Expr * andExpr, ExprContext * econtext, bool * isNull);
+static Datum ExecEvalAnd(Expr * andExpr, ExprContext * econtext, bool * isNull);
static Datum
ExecEvalFunc(Expr * funcClause, ExprContext * econtext,
bool * isNull, bool * isDone);
static void
ExecEvalFuncArgs(FunctionCachePtr fcache, ExprContext * econtext,
List * argList, Datum argV[], bool * argIsDone);
-static Datum ExecEvalNot(Expr * notclause, ExprContext * econtext, bool * isNull);
+static Datum ExecEvalNot(Expr * notclause, ExprContext * econtext, bool * isNull);
static Datum
ExecEvalOper(Expr * opClause, ExprContext * econtext,
bool * isNull);
-static Datum ExecEvalOr(Expr * orExpr, ExprContext * econtext, bool * isNull);
-static Datum ExecEvalVar(Var * variable, ExprContext * econtext, bool * isNull);
+static Datum ExecEvalOr(Expr * orExpr, ExprContext * econtext, bool * isNull);
+static Datum ExecEvalVar(Var * variable, ExprContext * econtext, bool * isNull);
static Datum
ExecMakeFunctionResult(Node * node, List * arguments,
ExprContext * econtext, bool * isNull, bool * isDone);
-static bool ExecQualClause(Node * clause, ExprContext * econtext);
+static bool ExecQualClause(Node * clause, ExprContext * econtext);
/* --------------------------------
* ExecEvalArrayRef
@@ -100,24 +100,24 @@ static bool ExecQualClause(Node * clause, ExprContext * econtext);
*
* --------------------------------
*/
-static Datum
+static Datum
ExecEvalArrayRef(ArrayRef * arrayRef,
ExprContext * econtext,
bool * isNull,
bool * isDone)
{
- bool dummy;
- int i = 0,
- j = 0;
- ArrayType *array_scanner;
- List *upperIndexpr,
- *lowerIndexpr;
- Node *assgnexpr;
- List *elt;
- IntArray upper,
- lower;
- int *lIndex;
- char *dataPtr;
+ bool dummy;
+ int i = 0,
+ j = 0;
+ ArrayType *array_scanner;
+ List *upperIndexpr,
+ *lowerIndexpr;
+ Node *assgnexpr;
+ List *elt;
+ IntArray upper,
+ lower;
+ int *lIndex;
+ char *dataPtr;
*isNull = false;
array_scanner = (ArrayType *) ExecEvalExpr(arrayRef->refexpr,
@@ -199,7 +199,7 @@ ExecEvalArrayRef(ArrayRef * arrayRef,
* aggregate found in the given expression context.
* ----------------------------------------------------------------
*/
-static Datum
+static Datum
ExecEvalAggreg(Aggreg * agg, ExprContext * econtext, bool * isNull)
{
@@ -230,17 +230,17 @@ ExecEvalAggreg(Aggreg * agg, ExprContext * econtext, bool * isNull)
* We have an Assert to make sure this entry condition is met.
*
* ---------------------------------------------------------------- */
-static Datum
+static Datum
ExecEvalVar(Var * variable, ExprContext * econtext, bool * isNull)
{
- Datum result;
+ Datum result;
TupleTableSlot *slot;
- AttrNumber attnum;
- HeapTuple heapTuple;
- TupleDesc tuple_type;
- Buffer buffer;
- bool byval;
- int16 len;
+ AttrNumber attnum;
+ HeapTuple heapTuple;
+ TupleDesc tuple_type;
+ Buffer buffer;
+ bool byval;
+ int16 len;
/* ----------------
* get the slot we want
@@ -248,18 +248,18 @@ ExecEvalVar(Var * variable, ExprContext * econtext, bool * isNull)
*/
switch (variable->varno)
{
- case INNER: /* get the tuple from the inner node */
- slot = econtext->ecxt_innertuple;
- break;
+ case INNER: /* get the tuple from the inner node */
+ slot = econtext->ecxt_innertuple;
+ break;
- case OUTER: /* get the tuple from the outer node */
- slot = econtext->ecxt_outertuple;
- break;
+ case OUTER: /* get the tuple from the outer node */
+ slot = econtext->ecxt_outertuple;
+ break;
- default: /* get the tuple from the relation being
+ default: /* get the tuple from the relation being
* scanned */
- slot = econtext->ecxt_scantuple;
- break;
+ slot = econtext->ecxt_scantuple;
+ break;
}
/* ----------------
@@ -286,8 +286,8 @@ ExecEvalVar(Var * variable, ExprContext * econtext, bool * isNull)
if (attnum == InvalidAttrNumber)
{
TupleTableSlot *tempSlot;
- TupleDesc td;
- HeapTuple tup;
+ TupleDesc td;
+ HeapTuple tup;
tempSlot = makeNode(TupleTableSlot);
tempSlot->ttc_shouldFree = false;
@@ -380,11 +380,11 @@ Datum
ExecEvalParam(Param * expression, ExprContext * econtext, bool * isNull)
{
- char *thisParameterName;
- int thisParameterKind;
- AttrNumber thisParameterId;
- int matchFound;
- ParamListInfo paramList;
+ char *thisParameterName;
+ int thisParameterKind;
+ AttrNumber thisParameterId;
+ int matchFound;
+ ParamListInfo paramList;
thisParameterName = expression->paramname;
thisParameterKind = expression->paramkind;
@@ -409,44 +409,44 @@ ExecEvalParam(Param * expression, ExprContext * econtext, bool * isNull)
{
switch (thisParameterKind)
{
- case PARAM_NAMED:
- if (thisParameterKind == paramList->kind &&
- strcmp(paramList->name, thisParameterName) == 0)
- {
- matchFound = 1;
- }
- break;
- case PARAM_NUM:
- if (thisParameterKind == paramList->kind &&
- paramList->id == thisParameterId)
- {
- matchFound = 1;
- }
- break;
- case PARAM_OLD:
- case PARAM_NEW:
- if (thisParameterKind == paramList->kind &&
- paramList->id == thisParameterId)
- {
- matchFound = 1;
-
- /*
- * sanity check
- */
- if (strcmp(paramList->name, thisParameterName) != 0)
+ case PARAM_NAMED:
+ if (thisParameterKind == paramList->kind &&
+ strcmp(paramList->name, thisParameterName) == 0)
{
- elog(WARN,
- "ExecEvalParam: new/old params with same id & diff names");
+ matchFound = 1;
}
- }
- break;
- default:
+ break;
+ case PARAM_NUM:
+ if (thisParameterKind == paramList->kind &&
+ paramList->id == thisParameterId)
+ {
+ matchFound = 1;
+ }
+ break;
+ case PARAM_OLD:
+ case PARAM_NEW:
+ if (thisParameterKind == paramList->kind &&
+ paramList->id == thisParameterId)
+ {
+ matchFound = 1;
+
+ /*
+ * sanity check
+ */
+ if (strcmp(paramList->name, thisParameterName) != 0)
+ {
+ elog(WARN,
+ "ExecEvalParam: new/old params with same id & diff names");
+ }
+ }
+ break;
+ default:
- /*
- * oops! this is not supposed to happen!
- */
- elog(WARN, "ExecEvalParam: invalid paramkind %d",
- thisParameterKind);
+ /*
+ * oops! this is not supposed to happen!
+ */
+ elog(WARN, "ExecEvalParam: invalid paramkind %d",
+ thisParameterKind);
}
if (!matchFound)
{
@@ -477,10 +477,10 @@ ExecEvalParam(Param * expression, ExprContext * econtext, bool * isNull)
if (expression->param_tlist != NIL)
{
- HeapTuple tup;
- Datum value;
- List *tlist = expression->param_tlist;
- TargetEntry *tle = (TargetEntry *) lfirst(tlist);
+ HeapTuple tup;
+ Datum value;
+ List *tlist = expression->param_tlist;
+ TargetEntry *tle = (TargetEntry *) lfirst(tlist);
TupleTableSlot *slot = (TupleTableSlot *) paramList->value;
tup = slot->val;
@@ -508,12 +508,12 @@ ExecEvalParam(Param * expression, ExprContext * econtext, bool * isNull)
* ----------------
*/
#ifdef NOT_USED
-static char *
+static char *
GetAttributeByNum(TupleTableSlot * slot,
AttrNumber attrno,
bool * isNull)
{
- Datum retval;
+ Datum retval;
if (!AttributeNumberIsValid(attrno))
elog(WARN, "GetAttributeByNum: Invalid attribute number");
@@ -545,7 +545,7 @@ GetAttributeByNum(TupleTableSlot * slot,
/* XXX char16 name for catalogs */
#ifdef NOT_USED
-char *
+char *
att_by_num(TupleTableSlot * slot,
AttrNumber attrno,
bool * isNull)
@@ -555,15 +555,15 @@ att_by_num(TupleTableSlot * slot,
#endif
-char *
+char *
GetAttributeByName(TupleTableSlot * slot, char *attname, bool * isNull)
{
- AttrNumber attrno;
- TupleDesc tupdesc;
- HeapTuple tuple;
- Datum retval;
- int natts;
- int i;
+ AttrNumber attrno;
+ TupleDesc tupdesc;
+ HeapTuple tuple;
+ Datum retval;
+ int natts;
+ int i;
if (attname == NULL)
elog(WARN, "GetAttributeByName: Invalid attribute name");
@@ -608,7 +608,7 @@ GetAttributeByName(TupleTableSlot * slot, char *attname, bool * isNull)
/* XXX char16 name for catalogs */
#ifdef NOT_USED
-char *
+char *
att_by_name(TupleTableSlot * slot, char *attname, bool * isNull)
{
return (GetAttributeByName(slot, attname, isNull));
@@ -623,10 +623,10 @@ ExecEvalFuncArgs(FunctionCachePtr fcache,
Datum argV[],
bool * argIsDone)
{
- int i;
- bool argIsNull,
- *nullVect;
- List *arg;
+ int i;
+ bool argIsNull,
+ *nullVect;
+ List *arg;
nullVect = fcache->nullVect;
@@ -663,18 +663,18 @@ ExecEvalFuncArgs(FunctionCachePtr fcache,
* ExecMakeFunctionResult
* ----------------
*/
-static Datum
+static Datum
ExecMakeFunctionResult(Node * node,
List * arguments,
ExprContext * econtext,
bool * isNull,
bool * isDone)
{
- Datum argv[MAXFMGRARGS];
+ Datum argv[MAXFMGRARGS];
FunctionCachePtr fcache;
- Func *funcNode = NULL;
- Oper *operNode = NULL;
- bool funcisset = false;
+ Func *funcNode = NULL;
+ Oper *operNode = NULL;
+ bool funcisset = false;
/*
* This is kind of ugly, Func nodes now have targetlists so that we
@@ -703,7 +703,7 @@ ExecMakeFunctionResult(Node * node,
*/
if (fcache->nargs != 0)
{
- bool argDone;
+ bool argDone;
if (fcache->nargs > MAXFMGRARGS)
elog(WARN, "ExecMakeFunctionResult: too many arguments");
@@ -774,7 +774,7 @@ ExecMakeFunctionResult(Node * node,
*/
if (fcache->language == SQLlanguageId)
{
- Datum result;
+ Datum result;
Assert(funcNode);
result = postquel_function(funcNode, (char **) argv, isNull, isDone);
@@ -788,7 +788,7 @@ ExecMakeFunctionResult(Node * node,
*/
if ((*isDone) && (fcache->hasSetArg))
{
- bool argDone;
+ bool argDone;
ExecEvalFuncArgs(fcache, econtext, arguments, argv, &argDone);
@@ -828,7 +828,7 @@ ExecMakeFunctionResult(Node * node,
}
else
{
- int i;
+ int i;
if (isDone)
*isDone = true;
@@ -863,13 +863,13 @@ ExecMakeFunctionResult(Node * node,
* ExecEvalOper
* ----------------------------------------------------------------
*/
-static Datum
+static Datum
ExecEvalOper(Expr * opClause, ExprContext * econtext, bool * isNull)
{
- Oper *op;
- List *argList;
+ Oper *op;
+ List *argList;
FunctionCachePtr fcache;
- bool isDone;
+ bool isDone;
/* ----------------
* an opclause is a list (op args). (I think)
@@ -908,14 +908,14 @@ ExecEvalOper(Expr * opClause, ExprContext * econtext, bool * isNull)
* ----------------------------------------------------------------
*/
-static Datum
+static Datum
ExecEvalFunc(Expr * funcClause,
ExprContext * econtext,
bool * isNull,
bool * isDone)
{
- Func *func;
- List *argList;
+ Func *func;
+ List *argList;
FunctionCachePtr fcache;
/* ----------------
@@ -963,12 +963,12 @@ ExecEvalFunc(Expr * funcClause,
* need to know this, mind you...
* ----------------------------------------------------------------
*/
-static Datum
+static Datum
ExecEvalNot(Expr * notclause, ExprContext * econtext, bool * isNull)
{
- Datum expr_value;
- Node *clause;
- bool isDone;
+ Datum expr_value;
+ Node *clause;
+ bool isDone;
clause = lfirst(notclause->args);
@@ -1002,14 +1002,14 @@ ExecEvalNot(Expr * notclause, ExprContext * econtext, bool * isNull)
* ExecEvalOr
* ----------------------------------------------------------------
*/
-static Datum
+static Datum
ExecEvalOr(Expr * orExpr, ExprContext * econtext, bool * isNull)
{
- List *clauses;
- List *clause;
- bool isDone;
- bool IsNull;
- Datum const_value = 0;
+ List *clauses;
+ List *clause;
+ bool isDone;
+ bool IsNull;
+ Datum const_value = 0;
IsNull = false;
clauses = orExpr->args;
@@ -1066,14 +1066,14 @@ ExecEvalOr(Expr * orExpr, ExprContext * econtext, bool * isNull)
* ExecEvalAnd
* ----------------------------------------------------------------
*/
-static Datum
+static Datum
ExecEvalAnd(Expr * andExpr, ExprContext * econtext, bool * isNull)
{
- List *clauses;
- List *clause;
- Datum const_value = 0;
- bool isDone;
- bool IsNull;
+ List *clauses;
+ List *clause;
+ Datum const_value = 0;
+ bool isDone;
+ bool IsNull;
IsNull = false;
@@ -1149,7 +1149,7 @@ ExecEvalExpr(Node * expression,
bool * isNull,
bool * isDone)
{
- Datum retDatum = 0;
+ Datum retDatum = 0;
*isNull = false;
@@ -1173,68 +1173,68 @@ ExecEvalExpr(Node * expression,
switch (nodeTag(expression))
{
- case T_Var:
- retDatum = (Datum) ExecEvalVar((Var *) expression, econtext, isNull);
- break;
- case T_Const:
- {
- Const *con = (Const *) expression;
+ case T_Var:
+ retDatum = (Datum) ExecEvalVar((Var *) expression, econtext, isNull);
+ break;
+ case T_Const:
+ {
+ Const *con = (Const *) expression;
- if (con->constisnull)
- *isNull = true;
- retDatum = con->constvalue;
+ if (con->constisnull)
+ *isNull = true;
+ retDatum = con->constvalue;
+ break;
+ }
+ case T_Param:
+ retDatum = (Datum) ExecEvalParam((Param *) expression, econtext, isNull);
break;
- }
- case T_Param:
- retDatum = (Datum) ExecEvalParam((Param *) expression, econtext, isNull);
- break;
- case T_Iter:
- retDatum = (Datum) ExecEvalIter((Iter *) expression,
- econtext,
- isNull,
- isDone);
- break;
- case T_Aggreg:
- retDatum = (Datum) ExecEvalAggreg((Aggreg *) expression,
- econtext,
- isNull);
- break;
- case T_ArrayRef:
- retDatum = (Datum) ExecEvalArrayRef((ArrayRef *) expression,
+ case T_Iter:
+ retDatum = (Datum) ExecEvalIter((Iter *) expression,
econtext,
isNull,
isDone);
- break;
- case T_Expr:
- {
- Expr *expr = (Expr *) expression;
-
- switch (expr->opType)
+ break;
+ case T_Aggreg:
+ retDatum = (Datum) ExecEvalAggreg((Aggreg *) expression,
+ econtext,
+ isNull);
+ break;
+ case T_ArrayRef:
+ retDatum = (Datum) ExecEvalArrayRef((ArrayRef *) expression,
+ econtext,
+ isNull,
+ isDone);
+ break;
+ case T_Expr:
{
- case OP_EXPR:
- retDatum = (Datum) ExecEvalOper(expr, econtext, isNull);
- break;
- case FUNC_EXPR:
- retDatum = (Datum) ExecEvalFunc(expr, econtext, isNull, isDone);
- break;
- case OR_EXPR:
- retDatum = (Datum) ExecEvalOr(expr, econtext, isNull);
- break;
- case AND_EXPR:
- retDatum = (Datum) ExecEvalAnd(expr, econtext, isNull);
- break;
- case NOT_EXPR:
- retDatum = (Datum) ExecEvalNot(expr, econtext, isNull);
- break;
- default:
- elog(WARN, "ExecEvalExpr: unknown expression type");
+ Expr *expr = (Expr *) expression;
+
+ switch (expr->opType)
+ {
+ case OP_EXPR:
+ retDatum = (Datum) ExecEvalOper(expr, econtext, isNull);
+ break;
+ case FUNC_EXPR:
+ retDatum = (Datum) ExecEvalFunc(expr, econtext, isNull, isDone);
+ break;
+ case OR_EXPR:
+ retDatum = (Datum) ExecEvalOr(expr, econtext, isNull);
+ break;
+ case AND_EXPR:
+ retDatum = (Datum) ExecEvalAnd(expr, econtext, isNull);
+ break;
+ case NOT_EXPR:
+ retDatum = (Datum) ExecEvalNot(expr, econtext, isNull);
+ break;
+ default:
+ elog(WARN, "ExecEvalExpr: unknown expression type");
+ break;
+ }
break;
}
+ default:
+ elog(WARN, "ExecEvalExpr: unknown expression type");
break;
- }
- default:
- elog(WARN, "ExecEvalExpr: unknown expression type");
- break;
}
return retDatum;
@@ -1256,12 +1256,12 @@ ExecEvalExpr(Node * expression,
* rest of the qualification)
* ----------------------------------------------------------------
*/
-static bool
+static bool
ExecQualClause(Node * clause, ExprContext * econtext)
{
- Datum expr_value;
- bool isNull;
- bool isDone;
+ Datum expr_value;
+ bool isNull;
+ bool isDone;
/* when there is a null clause, consider the qualification to be true */
if (clause == NULL)
@@ -1304,8 +1304,8 @@ ExecQualClause(Node * clause, ExprContext * econtext)
bool
ExecQual(List * qual, ExprContext * econtext)
{
- List *clause;
- bool result;
+ List *clause;
+ bool result;
/* ----------------
* debugging stuff
@@ -1356,9 +1356,9 @@ ExecQual(List * qual, ExprContext * econtext)
int
ExecTargetListLength(List * targetlist)
{
- int len;
- List *tl;
- TargetEntry *curTle;
+ int len;
+ List *tl;
+ TargetEntry *curTle;
len = 0;
foreach(tl, targetlist)
@@ -1380,7 +1380,7 @@ ExecTargetListLength(List * targetlist)
* expression context and return a tuple.
* ----------------------------------------------------------------
*/
-static HeapTuple
+static HeapTuple
ExecTargetList(List * targetlist,
int nodomains,
TupleDesc targettype,
@@ -1388,18 +1388,18 @@ ExecTargetList(List * targetlist,
ExprContext * econtext,
bool * isDone)
{
- char nulls_array[64];
- bool fjNullArray[64];
- bool *fjIsNull;
- char *null_head;
- List *tl;
- TargetEntry *tle;
- Node *expr;
- Resdom *resdom;
- AttrNumber resind;
- Datum constvalue;
- HeapTuple newTuple;
- bool isNull;
+ char nulls_array[64];
+ bool fjNullArray[64];
+ bool *fjIsNull;
+ char *null_head;
+ List *tl;
+ TargetEntry *tle;
+ Node *expr;
+ Resdom *resdom;
+ AttrNumber resind;
+ Datum constvalue;
+ HeapTuple newTuple;
+ bool isNull;
/* ----------------
* debugging stuff
@@ -1497,12 +1497,12 @@ ExecTargetList(List * targetlist,
}
else
{
- int curNode;
- Resdom *fjRes;
- List *fjTlist = (List *) tle->expr;
- Fjoin *fjNode = tle->fjoin;
- int nNodes = fjNode->fj_nNodes;
- DatumPtr results = fjNode->fj_results;
+ int curNode;
+ Resdom *fjRes;
+ List *fjTlist = (List *) tle->expr;
+ Fjoin *fjNode = tle->fjoin;
+ int nNodes = fjNode->fj_nNodes;
+ DatumPtr results = fjNode->fj_results;
ExecEvalFjoin(tle, econtext, fjIsNull, isDone);
if (*isDone)
@@ -1529,7 +1529,7 @@ ExecTargetList(List * targetlist,
curNode++, fjTlist = lnext(fjTlist))
{
#if 0 /* what is this?? */
- Node *outernode = lfirst(fjTlist);
+ Node *outernode = lfirst(fjTlist);
fjRes = (Resdom *) outernode->iterexpr;
#endif
@@ -1582,12 +1582,12 @@ TupleTableSlot *
ExecProject(ProjectionInfo * projInfo, bool * isDone)
{
TupleTableSlot *slot;
- List *targetlist;
- int len;
- TupleDesc tupType;
- Datum *tupValue;
- ExprContext *econtext;
- HeapTuple newTuple;
+ List *targetlist;
+ int len;
+ TupleDesc tupType;
+ Datum *tupValue;
+ ExprContext *econtext;
+ HeapTuple newTuple;
/* ----------------
* sanity checks
diff --git a/src/backend/executor/execScan.c b/src/backend/executor/execScan.c
index 6ea50bb2a93..84dac56a237 100644
--- a/src/backend/executor/execScan.c
+++ b/src/backend/executor/execScan.c
@@ -11,7 +11,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/executor/execScan.c,v 1.4 1997/09/07 04:41:23 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/executor/execScan.c,v 1.5 1997/09/08 02:22:34 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -48,15 +48,15 @@ ExecScan(Scan * node,
* tuple */
{
CommonScanState *scanstate;
- EState *estate;
- List *qual;
- bool isDone;
+ EState *estate;
+ List *qual;
+ bool isDone;
TupleTableSlot *slot;
TupleTableSlot *resultSlot;
- HeapTuple newTuple;
+ HeapTuple newTuple;
- ExprContext *econtext;
+ ExprContext *econtext;
ProjectionInfo *projInfo;
diff --git a/src/backend/executor/execTuples.c b/src/backend/executor/execTuples.c
index 287f75699af..373e94ae1a7 100644
--- a/src/backend/executor/execTuples.c
+++ b/src/backend/executor/execTuples.c
@@ -14,7 +14,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/executor/execTuples.c,v 1.7 1997/09/07 04:41:24 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/executor/execTuples.c,v 1.8 1997/09/08 02:22:35 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -153,7 +153,7 @@ TupleTable /* return: address of table */
ExecCreateTupleTable(int initialSize) /* initial number of slots
* in table */
{
- TupleTable newtable; /* newly allocated table */
+ TupleTable newtable; /* newly allocated table */
TupleTableSlot *array; /* newly allocated slot array */
/* ----------------
@@ -200,9 +200,9 @@ ExecDestroyTupleTable(TupleTable table, /* tuple table */
bool shouldFree) /* true if we should free slot
* contents */
{
- int next; /* next avaliable slot */
+ int next; /* next avaliable slot */
TupleTableSlot *array; /* start of table array */
- int i; /* counter */
+ int i; /* counter */
/* ----------------
* sanity checks
@@ -229,8 +229,8 @@ ExecDestroyTupleTable(TupleTable table, /* tuple table */
if (shouldFree)
for (i = 0; i < next; i++)
{
- TupleTableSlot slot;
- HeapTuple tuple;
+ TupleTableSlot slot;
+ HeapTuple tuple;
slot = array[i];
tuple = slot.val;
@@ -280,7 +280,7 @@ TupleTableSlot * /* return: the slot allocated in the tuple
* table */
ExecAllocTableSlot(TupleTable table)
{
- int slotnum; /* new slot number */
+ int slotnum; /* new slot number */
/* ----------------
* sanity checks
@@ -383,7 +383,7 @@ ExecStoreTuple(HeapTuple tuple, /* tuple to store */
TupleTableSlot * /* return: slot passed */
ExecClearTuple(TupleTableSlot * slot) /* slot in which to store tuple */
{
- HeapTuple oldtuple; /* prior contents of slot */
+ HeapTuple oldtuple; /* prior contents of slot */
/* ----------------
* sanity checks
@@ -462,7 +462,7 @@ ExecSetSlotPolicy(TupleTableSlot * slot, /* slot to change */
bool shouldFree) /* true if we call pfree() when we
* gc. */
{
- bool old_shouldFree = slot->ttc_shouldFree;
+ bool old_shouldFree = slot->ttc_shouldFree;
slot->ttc_shouldFree = shouldFree;
@@ -490,7 +490,7 @@ TupleDesc /* return: old slot tuple descriptor */
ExecSetSlotDescriptor(TupleTableSlot * slot, /* slot to change */
TupleDesc tupdesc) /* tuple descriptor */
{
- TupleDesc old_tupdesc = slot->ttc_tupleDescriptor;
+ TupleDesc old_tupdesc = slot->ttc_tupleDescriptor;
slot->ttc_tupleDescriptor = tupdesc;
return old_tupdesc;
@@ -521,7 +521,7 @@ TupleDesc /* return: old slot tuple descriptor */
ExecSetNewSlotDescriptor(TupleTableSlot * slot, /* slot to change */
TupleDesc tupdesc) /* tuple descriptor */
{
- TupleDesc old_tupdesc = slot->ttc_tupleDescriptor;
+ TupleDesc old_tupdesc = slot->ttc_tupleDescriptor;
slot->ttc_tupleDescriptor = tupdesc;
slot->ttc_descIsNew = true;
@@ -557,7 +557,7 @@ Buffer /* return: old slot buffer */
ExecSetSlotBuffer(TupleTableSlot * slot, /* slot to change */
Buffer b) /* tuple descriptor */
{
- Buffer oldb = slot->ttc_buffer;
+ Buffer oldb = slot->ttc_buffer;
slot->ttc_buffer = b;
@@ -578,7 +578,7 @@ void
ExecIncrSlotBufferRefcnt(TupleTableSlot * slot) /* slot to bump refcnt */
{
/* Buffer b = SlotBuffer((TupleTableSlot*) slot); */
- Buffer b = slot->ttc_buffer;
+ Buffer b = slot->ttc_buffer;
if (BufferIsValid(b))
IncrBufferRefCount(b);
@@ -599,7 +599,7 @@ ExecIncrSlotBufferRefcnt(TupleTableSlot * slot) /* slot to bump refcnt */
bool /* return: true if tuple in slot is NULL */
TupIsNull(TupleTableSlot * slot) /* slot to check */
{
- HeapTuple tuple; /* contents of slot (returned) */
+ HeapTuple tuple; /* contents of slot (returned) */
/* ----------------
* if the slot itself is null then we return true
@@ -733,136 +733,136 @@ NodeGetResultTupleSlot(Plan * node)
switch (nodeTag(node))
{
- case T_Result:
- {
- ResultState *resstate = ((Result *) node)->resstate;
-
- slot = resstate->cstate.cs_ResultTupleSlot;
- }
- break;
+ case T_Result:
+ {
+ ResultState *resstate = ((Result *) node)->resstate;
- case T_SeqScan:
- {
- CommonScanState *scanstate = ((SeqScan *) node)->scanstate;
+ slot = resstate->cstate.cs_ResultTupleSlot;
+ }
+ break;
- slot = scanstate->cstate.cs_ResultTupleSlot;
- }
- break;
+ case T_SeqScan:
+ {
+ CommonScanState *scanstate = ((SeqScan *) node)->scanstate;
- case T_NestLoop:
- {
- NestLoopState *nlstate = ((NestLoop *) node)->nlstate;
+ slot = scanstate->cstate.cs_ResultTupleSlot;
+ }
+ break;
- slot = nlstate->jstate.cs_ResultTupleSlot;
- }
- break;
+ case T_NestLoop:
+ {
+ NestLoopState *nlstate = ((NestLoop *) node)->nlstate;
- case T_Append:
- {
- Append *n = (Append *) node;
- AppendState *unionstate;
- List *unionplans;
- int whichplan;
- Plan *subplan;
-
- unionstate = n->unionstate;
- unionplans = n->unionplans;
- whichplan = unionstate->as_whichplan;
-
- subplan = (Plan *) nth(whichplan, unionplans);
- slot = NodeGetResultTupleSlot(subplan);
+ slot = nlstate->jstate.cs_ResultTupleSlot;
+ }
break;
- }
- case T_IndexScan:
- {
- CommonScanState *scanstate = ((IndexScan *) node)->scan.scanstate;
+ case T_Append:
+ {
+ Append *n = (Append *) node;
+ AppendState *unionstate;
+ List *unionplans;
+ int whichplan;
+ Plan *subplan;
+
+ unionstate = n->unionstate;
+ unionplans = n->unionplans;
+ whichplan = unionstate->as_whichplan;
+
+ subplan = (Plan *) nth(whichplan, unionplans);
+ slot = NodeGetResultTupleSlot(subplan);
+ break;
+ }
- slot = scanstate->cstate.cs_ResultTupleSlot;
- }
- break;
+ case T_IndexScan:
+ {
+ CommonScanState *scanstate = ((IndexScan *) node)->scan.scanstate;
- case T_Material:
- {
- MaterialState *matstate = ((Material *) node)->matstate;
+ slot = scanstate->cstate.cs_ResultTupleSlot;
+ }
+ break;
- slot = matstate->csstate.css_ScanTupleSlot;
- }
- break;
+ case T_Material:
+ {
+ MaterialState *matstate = ((Material *) node)->matstate;
- case T_Sort:
- {
- SortState *sortstate = ((Sort *) node)->sortstate;
+ slot = matstate->csstate.css_ScanTupleSlot;
+ }
+ break;
- slot = sortstate->csstate.css_ScanTupleSlot;
- }
- break;
+ case T_Sort:
+ {
+ SortState *sortstate = ((Sort *) node)->sortstate;
- case T_Agg:
- {
- AggState *aggstate = ((Agg *) node)->aggstate;
+ slot = sortstate->csstate.css_ScanTupleSlot;
+ }
+ break;
- slot = aggstate->csstate.cstate.cs_ResultTupleSlot;
- }
- break;
+ case T_Agg:
+ {
+ AggState *aggstate = ((Agg *) node)->aggstate;
- case T_Group:
- {
- GroupState *grpstate = ((Group *) node)->grpstate;
+ slot = aggstate->csstate.cstate.cs_ResultTupleSlot;
+ }
+ break;
- slot = grpstate->csstate.cstate.cs_ResultTupleSlot;
- }
- break;
+ case T_Group:
+ {
+ GroupState *grpstate = ((Group *) node)->grpstate;
- case T_Hash:
- {
- HashState *hashstate = ((Hash *) node)->hashstate;
+ slot = grpstate->csstate.cstate.cs_ResultTupleSlot;
+ }
+ break;
- slot = hashstate->cstate.cs_ResultTupleSlot;
- }
- break;
+ case T_Hash:
+ {
+ HashState *hashstate = ((Hash *) node)->hashstate;
- case T_Unique:
- {
- UniqueState *uniquestate = ((Unique *) node)->uniquestate;
+ slot = hashstate->cstate.cs_ResultTupleSlot;
+ }
+ break;
- slot = uniquestate->cs_ResultTupleSlot;
- }
- break;
+ case T_Unique:
+ {
+ UniqueState *uniquestate = ((Unique *) node)->uniquestate;
- case T_MergeJoin:
- {
- MergeJoinState *mergestate = ((MergeJoin *) node)->mergestate;
+ slot = uniquestate->cs_ResultTupleSlot;
+ }
+ break;
- slot = mergestate->jstate.cs_ResultTupleSlot;
- }
- break;
+ case T_MergeJoin:
+ {
+ MergeJoinState *mergestate = ((MergeJoin *) node)->mergestate;
- case T_HashJoin:
- {
- HashJoinState *hashjoinstate = ((HashJoin *) node)->hashjoinstate;
+ slot = mergestate->jstate.cs_ResultTupleSlot;
+ }
+ break;
- slot = hashjoinstate->jstate.cs_ResultTupleSlot;
- }
- break;
+ case T_HashJoin:
+ {
+ HashJoinState *hashjoinstate = ((HashJoin *) node)->hashjoinstate;
- case T_Tee:
- {
- TeeState *teestate = ((Tee *) node)->teestate;
+ slot = hashjoinstate->jstate.cs_ResultTupleSlot;
+ }
+ break;
- slot = teestate->cstate.cs_ResultTupleSlot;
- }
- break;
+ case T_Tee:
+ {
+ TeeState *teestate = ((Tee *) node)->teestate;
- default:
- /* ----------------
- * should never get here
- * ----------------
- */
- elog(WARN, "NodeGetResultTupleSlot: node not yet supported: %d ",
- nodeTag(node));
+ slot = teestate->cstate.cs_ResultTupleSlot;
+ }
+ break;
- return NULL;
+ default:
+ /* ----------------
+ * should never get here
+ * ----------------
+ */
+ elog(WARN, "NodeGetResultTupleSlot: node not yet supported: %d ",
+ nodeTag(node));
+
+ return NULL;
}
return slot;
}
@@ -897,7 +897,7 @@ TupleDesc
ExecGetTupType(Plan * node)
{
TupleTableSlot *slot;
- TupleDesc tupType;
+ TupleDesc tupType;
if (node == NULL)
return NULL;
@@ -948,11 +948,11 @@ ExecCopyTupType(TupleDesc td, int natts)
TupleDesc
ExecTypeFromTL(List * targetList)
{
- List *tlcdr;
- TupleDesc typeInfo;
- Resdom *resdom;
- Oid restype;
- int len;
+ List *tlcdr;
+ TupleDesc typeInfo;
+ Resdom *resdom;
+ Oid restype;
+ int len;
/* ----------------
* examine targetlist - if empty then return NULL
@@ -977,7 +977,7 @@ ExecTypeFromTL(List * targetList)
tlcdr = targetList;
while (tlcdr != NIL)
{
- TargetEntry *tle = lfirst(tlcdr);
+ TargetEntry *tle = lfirst(tlcdr);
if (tle->resdom != NULL)
{
@@ -1005,13 +1005,13 @@ ExecTypeFromTL(List * targetList)
}
else
{
- Resdom *fjRes;
- List *fjTlistP;
- List *fjList = lfirst(tlcdr);
+ Resdom *fjRes;
+ List *fjTlistP;
+ List *fjList = lfirst(tlcdr);
#ifdef SETS_FIXED
- TargetEntry *tle;
- Fjoin *fjNode = ((TargetEntry *) lfirst(fjList))->fjoin;
+ TargetEntry *tle;
+ Fjoin *fjNode = ((TargetEntry *) lfirst(fjList))->fjoin;
tle = fjNode->fj_innerNode; /* ??? */
#endif
@@ -1037,7 +1037,7 @@ ExecTypeFromTL(List * targetList)
foreach(fjTlistP, lnext(fjList))
{
- TargetEntry *fjTle = lfirst(fjTlistP);
+ TargetEntry *fjTle = lfirst(fjTlistP);
fjRes = fjTle->resdom;
diff --git a/src/backend/executor/execUtils.c b/src/backend/executor/execUtils.c
index 3795c2d1018..0f3338d3cb9 100644
--- a/src/backend/executor/execUtils.c
+++ b/src/backend/executor/execUtils.c
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/executor/execUtils.c,v 1.15 1997/09/07 04:41:26 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/executor/execUtils.c,v 1.16 1997/09/08 02:22:36 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -67,13 +67,13 @@ ExecGetIndexKeyInfo(IndexTupleForm indexTuple, int *numAttsOutP,
* appended, replaced, deleted.
* ----------------------------------------------------------------
*/
-int NTupleProcessed;
-int NTupleRetrieved;
-int NTupleReplaced;
-int NTupleAppended;
-int NTupleDeleted;
-int NIndexTupleInserted;
-extern int NIndexTupleProcessed; /* have to be defined in the
+int NTupleProcessed;
+int NTupleRetrieved;
+int NTupleReplaced;
+int NTupleAppended;
+int NTupleDeleted;
+int NIndexTupleInserted;
+extern int NIndexTupleProcessed; /* have to be defined in the
* access method level so that the
* cinterface.a will link ok. */
@@ -159,7 +159,7 @@ DisplayTupleCount(FILE * statfp)
void
ExecAssignNodeBaseInfo(EState * estate, CommonState * cstate, Plan * parent)
{
- int baseId;
+ int baseId;
baseId = estate->es_BaseId;
cstate->cs_base_id = baseId;
@@ -178,9 +178,9 @@ ExecAssignNodeBaseInfo(EState * estate, CommonState * cstate, Plan * parent)
void
ExecAssignExprContext(EState * estate, CommonState * commonstate)
{
- ExprContext *econtext;
- ParamListInfo paraminfo;
- List *rangeTable;
+ ExprContext *econtext;
+ ParamListInfo paraminfo;
+ List *rangeTable;
paraminfo = estate->es_param_list_info;
rangeTable = estate->es_range_table;
@@ -223,8 +223,8 @@ ExecAssignResultType(CommonState * commonstate,
void
ExecAssignResultTypeFromOuterPlan(Plan * node, CommonState * commonstate)
{
- Plan *outerPlan;
- TupleDesc tupDesc;
+ Plan *outerPlan;
+ TupleDesc tupDesc;
outerPlan = outerPlan(node);
tupDesc = ExecGetTupType(outerPlan);
@@ -239,13 +239,13 @@ ExecAssignResultTypeFromOuterPlan(Plan * node, CommonState * commonstate)
void
ExecAssignResultTypeFromTL(Plan * node, CommonState * commonstate)
{
- List *targetList;
- int i;
- int len;
- List *tl;
- TargetEntry *tle;
- List *fjtl;
- TupleDesc origTupDesc;
+ List *targetList;
+ int i;
+ int len;
+ List *tl;
+ TargetEntry *tle;
+ List *fjtl;
+ TupleDesc origTupDesc;
targetList = node->targetlist;
origTupDesc = ExecTypeFromTL(targetList);
@@ -269,7 +269,7 @@ ExecAssignResultTypeFromTL(Plan * node, CommonState * commonstate)
#ifdef SETS_FIXED
if (!tl_is_resdom(tle))
{
- Fjoin *fj = (Fjoin *) lfirst(tle);
+ Fjoin *fj = (Fjoin *) lfirst(tle);
/* it is a FJoin */
fjtl = lnext(tle);
@@ -309,7 +309,7 @@ void
ExecFreeResultType(CommonState * commonstate)
{
TupleTableSlot *slot;
- TupleDesc tupType;
+ TupleDesc tupType;
slot = commonstate->cs_ResultTupleSlot;
tupType = slot->ttc_tupleDescriptor;
@@ -329,8 +329,8 @@ void
ExecAssignProjectionInfo(Plan * node, CommonState * commonstate)
{
ProjectionInfo *projInfo;
- List *targetList;
- int len;
+ List *targetList;
+ int len;
targetList = node->targetlist;
len = ExecTargetListLength(targetList);
@@ -407,7 +407,7 @@ void
ExecFreeScanType(CommonScanState * csstate)
{
TupleTableSlot *slot;
- TupleDesc tupType;
+ TupleDesc tupType;
slot = csstate->css_ScanTupleSlot;
tupType = slot->ttc_tupleDescriptor;
@@ -439,8 +439,8 @@ ExecAssignScanType(CommonScanState * csstate,
void
ExecAssignScanTypeFromOuterPlan(Plan * node, CommonScanState * csstate)
{
- Plan *outerPlan;
- TupleDesc tupDesc;
+ Plan *outerPlan;
+ TupleDesc tupDesc;
outerPlan = outerPlan(node);
tupDesc = ExecGetTupType(outerPlan);
@@ -571,10 +571,10 @@ ExecFreeTypeInfo(TupleDesc typeInfo)
TupleDesc
QueryDescGetTypeInfo(QueryDesc * queryDesc)
{
- Plan *plan;
- TupleDesc tupleType;
- List *targetList;
- AttrInfo *attinfo = (AttrInfo *) palloc(sizeof(AttrInfo));
+ Plan *plan;
+ TupleDesc tupleType;
+ List *targetList;
+ AttrInfo *attinfo = (AttrInfo *) palloc(sizeof(AttrInfo));
plan = queryDesc->plantree;
tupleType = (TupleDesc) ExecGetTupType(plan);
@@ -611,9 +611,9 @@ ExecGetIndexKeyInfo(IndexTupleForm indexTuple,
AttrNumber ** attsOutP,
FuncIndexInfoPtr fInfoP)
{
- int i;
- int numKeys;
- AttrNumber *attKeys;
+ int i;
+ int numKeys;
+ AttrNumber *attKeys;
/* ----------------
* check parameters
@@ -708,32 +708,32 @@ void
ExecOpenIndices(Oid resultRelationOid,
RelationInfo * resultRelationInfo)
{
- Relation indexRd;
- HeapScanDesc indexSd;
- ScanKeyData key;
- HeapTuple tuple;
- IndexTupleForm indexStruct;
- Oid indexOid;
- List *oidList;
- List *nkeyList;
- List *keyList;
- List *fiList;
- char *predString;
- List *predList;
- List *indexoid;
- List *numkeys;
- List *indexkeys;
- List *indexfuncs;
- List *indexpreds;
- int len;
-
- RelationPtr relationDescs;
- IndexInfo **indexInfoArray;
+ Relation indexRd;
+ HeapScanDesc indexSd;
+ ScanKeyData key;
+ HeapTuple tuple;
+ IndexTupleForm indexStruct;
+ Oid indexOid;
+ List *oidList;
+ List *nkeyList;
+ List *keyList;
+ List *fiList;
+ char *predString;
+ List *predList;
+ List *indexoid;
+ List *numkeys;
+ List *indexkeys;
+ List *indexfuncs;
+ List *indexpreds;
+ int len;
+
+ RelationPtr relationDescs;
+ IndexInfo **indexInfoArray;
FuncIndexInfoPtr fInfoP;
- int numKeyAtts;
- AttrNumber *indexKeyAtts;
- PredInfo *predicate;
- int i;
+ int numKeyAtts;
+ AttrNumber *indexKeyAtts;
+ PredInfo *predicate;
+ int i;
/* ----------------
* open pg_index
@@ -857,7 +857,7 @@ ExecOpenIndices(Oid resultRelationOid,
for (i = 0; i < len; i++)
{
- IndexInfo *ii = makeNode(IndexInfo);
+ IndexInfo *ii = makeNode(IndexInfo);
ii->ii_NumKeyAttributes = 0;
ii->ii_KeyAttributeNumbers = (AttrNumber *) NULL;
@@ -875,7 +875,7 @@ ExecOpenIndices(Oid resultRelationOid,
i = 0;
foreach(indexoid, oidList)
{
- Relation indexDesc;
+ Relation indexDesc;
indexOid = lfirsti(indexoid);
indexDesc = index_open(indexOid);
@@ -954,9 +954,9 @@ ExecOpenIndices(Oid resultRelationOid,
void
ExecCloseIndices(RelationInfo * resultRelationInfo)
{
- int i;
- int numIndices;
- RelationPtr relationDescs;
+ int i;
+ int numIndices;
+ RelationPtr relationDescs;
numIndices = resultRelationInfo->ri_NumIndices;
relationDescs = resultRelationInfo->ri_IndexRelationDescs;
@@ -986,14 +986,14 @@ ExecFormIndexTuple(HeapTuple heapTuple,
Relation indexRelation,
IndexInfo * indexInfo)
{
- IndexTuple indexTuple;
- TupleDesc heapDescriptor;
- TupleDesc indexDescriptor;
- Datum *datum;
- char *nulls;
-
- int numberOfAttributes;
- AttrNumber *keyAttributeNumbers;
+ IndexTuple indexTuple;
+ TupleDesc heapDescriptor;
+ TupleDesc indexDescriptor;
+ Datum *datum;
+ char *nulls;
+
+ int numberOfAttributes;
+ AttrNumber *keyAttributeNumbers;
FuncIndexInfoPtr fInfoP;
/* ----------------
@@ -1075,24 +1075,24 @@ ExecInsertIndexTuples(TupleTableSlot * slot,
EState * estate,
bool is_update)
{
- HeapTuple heapTuple;
- RelationInfo *resultRelationInfo;
- int i;
- int numIndices;
- RelationPtr relationDescs;
- Relation heapRelation;
- IndexInfo **indexInfoArray;
- IndexInfo *indexInfo;
- Node *predicate;
- bool satisfied;
- ExprContext *econtext;
+ HeapTuple heapTuple;
+ RelationInfo *resultRelationInfo;
+ int i;
+ int numIndices;
+ RelationPtr relationDescs;
+ Relation heapRelation;
+ IndexInfo **indexInfoArray;
+ IndexInfo *indexInfo;
+ Node *predicate;
+ bool satisfied;
+ ExprContext *econtext;
InsertIndexResult result;
- int numberOfAttributes;
- AttrNumber *keyAttributeNumbers;
+ int numberOfAttributes;
+ AttrNumber *keyAttributeNumbers;
FuncIndexInfoPtr fInfoP;
- TupleDesc heapDescriptor;
- Datum *datum;
- char *nulls;
+ TupleDesc heapDescriptor;
+ Datum *datum;
+ char *nulls;
heapTuple = slot->val;
@@ -1189,10 +1189,10 @@ void
setVarAttrLenForCreateTable(TupleDesc tupType, List * targetList,
List * rangeTable)
{
- List *tl;
- TargetEntry *tle;
- Node *expr;
- int varno;
+ List *tl;
+ TargetEntry *tle;
+ Node *expr;
+ int varno;
tl = targetList;
@@ -1206,9 +1206,9 @@ setVarAttrLenForCreateTable(TupleDesc tupType, List * targetList,
expr = tle->expr;
if (expr && IsA(expr, Var))
{
- Var *var;
- RangeTblEntry *rtentry;
- Relation rd;
+ Var *var;
+ RangeTblEntry *rtentry;
+ Relation rd;
var = (Var *) expr;
rtentry = rt_fetch(var->varnoold, rangeTable);
@@ -1238,7 +1238,7 @@ setVarAttrLenForCreateTable(TupleDesc tupType, List * targetList,
void
resetVarAttrLenForCreateTable(TupleDesc tupType)
{
- int varno;
+ int varno;
for (varno = 0; varno < tupType->natts; varno++)
{
diff --git a/src/backend/executor/functions.c b/src/backend/executor/functions.c
index 96b9b19dcb6..6b10ead6516 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.8 1997/09/07 04:41:27 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/executor/functions.c,v 1.9 1997/09/08 02:22:37 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -44,15 +44,15 @@
typedef enum
{
F_EXEC_START, F_EXEC_RUN, F_EXEC_DONE
-} ExecStatus;
+} ExecStatus;
typedef struct local_es
{
- QueryDesc *qd;
- EState *estate;
+ QueryDesc *qd;
+ EState *estate;
struct local_es *next;
- ExecStatus status;
-} execution_state;
+ ExecStatus status;
+} execution_state;
#define LAST_POSTQUEL_COMMAND(es) ((es)->next == (execution_state *)NULL)
@@ -62,7 +62,7 @@ static execution_state *
init_execution_state(FunctionCachePtr fcache,
char *args[]);
static TupleTableSlot *postquel_getnext(execution_state * es);
-static void postquel_end(execution_state * es);
+static void postquel_end(execution_state * es);
static void
postquel_sub_params(execution_state * es, int nargs,
char *args[], bool * nullV);
@@ -77,10 +77,10 @@ ProjectAttribute(TupleDesc TD,
HeapTuple tup,
bool * isnullP)
{
- Datum val,
- valueP;
- Var *attrVar = (Var *) tlist->expr;
- AttrNumber attrno = attrVar->varattno;
+ Datum val,
+ valueP;
+ Var *attrVar = (Var *) tlist->expr;
+ AttrNumber attrno = attrVar->varattno;
val = PointerGetDatum(heap_getattr(tup,
@@ -105,10 +105,10 @@ init_execution_state(FunctionCachePtr fcache,
execution_state *newes;
execution_state *nextes;
execution_state *preves;
- QueryTreeList *queryTree_list;
- int i;
- List *planTree_list;
- int nargs;
+ QueryTreeList *queryTree_list;
+ int i;
+ List *planTree_list;
+ int nargs;
nargs = fcache->nargs;
@@ -122,9 +122,9 @@ init_execution_state(FunctionCachePtr fcache,
for (i = 0; i < queryTree_list->len; i++)
{
- EState *estate;
- Query *queryTree = (Query *) (queryTree_list->qtrees[i]);
- Plan *planTree = lfirst(planTree_list);
+ EState *estate;
+ Query *queryTree = (Query *) (queryTree_list->qtrees[i]);
+ Plan *planTree = lfirst(planTree_list);
if (!nextes)
nextes = (execution_state *) palloc(sizeof(execution_state));
@@ -140,8 +140,8 @@ init_execution_state(FunctionCachePtr fcache,
if (nargs > 0)
{
- int i;
- ParamListInfo paramLI;
+ int i;
+ ParamListInfo paramLI;
paramLI =
(ParamListInfo) palloc((nargs + 1) * sizeof(ParamListInfoData));
@@ -171,7 +171,7 @@ init_execution_state(FunctionCachePtr fcache,
return newes;
}
-static TupleDesc
+static TupleDesc
postquel_start(execution_state * es)
{
#ifdef FUNC_UTIL_PATCH
@@ -191,7 +191,7 @@ postquel_start(execution_state * es)
static TupleTableSlot *
postquel_getnext(execution_state * es)
{
- int feature;
+ int feature;
#ifdef FUNC_UTIL_PATCH
if (es->qd->operation == CMD_UTILITY)
@@ -236,8 +236,8 @@ postquel_sub_params(execution_state * es,
char *args[],
bool * nullV)
{
- ParamListInfo paramLI;
- EState *estate;
+ ParamListInfo paramLI;
+ EState *estate;
estate = es->estate;
paramLI = estate->es_param_list_info;
@@ -259,9 +259,9 @@ copy_function_result(FunctionCachePtr fcache,
TupleTableSlot * resultSlot)
{
TupleTableSlot *funcSlot;
- TupleDesc resultTd;
- HeapTuple newTuple;
- HeapTuple oldTuple;
+ TupleDesc resultTd;
+ HeapTuple newTuple;
+ HeapTuple oldTuple;
Assert(!TupIsNull(resultSlot));
oldTuple = resultSlot->val;
@@ -279,8 +279,8 @@ copy_function_result(FunctionCachePtr fcache,
*/
if (TupIsNull(funcSlot))
{
- int i = 0;
- TupleDesc funcTd = funcSlot->ttc_tupleDescriptor;
+ int i = 0;
+ TupleDesc funcTd = funcSlot->ttc_tupleDescriptor;
while (i < oldTuple->t_natts)
{
@@ -298,7 +298,7 @@ copy_function_result(FunctionCachePtr fcache,
return ExecStoreTuple(newTuple, funcSlot, InvalidBuffer, true);
}
-static Datum
+static Datum
postquel_execute(execution_state * es,
FunctionCachePtr fcache,
List * fTlist,
@@ -306,7 +306,7 @@ postquel_execute(execution_state * es,
bool * isNull)
{
TupleTableSlot *slot;
- Datum value;
+ Datum value;
#ifdef INDEXSCAN_PATCH
@@ -360,8 +360,8 @@ postquel_execute(execution_state * es,
resSlot = copy_function_result(fcache, slot);
if (fTlist != NIL)
{
- HeapTuple tup;
- TargetEntry *tle = lfirst(fTlist);
+ HeapTuple tup;
+ TargetEntry *tle = lfirst(fTlist);
tup = resSlot->val;
value = ProjectAttribute(resSlot->ttc_tupleDescriptor,
@@ -401,9 +401,9 @@ Datum
postquel_function(Func * funcNode, char **args, bool * isNull, bool * isDone)
{
execution_state *es;
- Datum result = 0;
+ Datum result = 0;
FunctionCachePtr fcache = funcNode->func_fcache;
- CommandId savedId;
+ CommandId savedId;
/*
* Before we start do anything we must save CurrentScanCommandId to
diff --git a/src/backend/executor/nodeAgg.c b/src/backend/executor/nodeAgg.c
index ee03f6854d9..92fa9bbe1ef 100644
--- a/src/backend/executor/nodeAgg.c
+++ b/src/backend/executor/nodeAgg.c
@@ -36,18 +36,18 @@
*/
typedef struct AggFuncInfo
{
- Oid xfn1_oid;
- Oid xfn2_oid;
- Oid finalfn_oid;
- func_ptr xfn1;
- func_ptr xfn2;
- func_ptr finalfn;
- int xfn1_nargs;
- int xfn2_nargs;
- int finalfn_nargs;
-} AggFuncInfo;
+ Oid xfn1_oid;
+ Oid xfn2_oid;
+ Oid finalfn_oid;
+ func_ptr xfn1;
+ func_ptr xfn2;
+ func_ptr finalfn;
+ int xfn1_nargs;
+ int xfn2_nargs;
+ int finalfn_nargs;
+} AggFuncInfo;
-static Datum aggGetAttr(TupleTableSlot * tuple, Aggreg * agg, bool * isNull);
+static Datum aggGetAttr(TupleTableSlot * tuple, Aggreg * agg, bool * isNull);
/* ---------------------------------------
@@ -90,26 +90,26 @@ static Datum aggGetAttr(TupleTableSlot * tuple, Aggreg * agg, bool * isNull);
TupleTableSlot *
ExecAgg(Agg * node)
{
- AggState *aggstate;
- EState *estate;
- Aggreg **aggregates;
- Plan *outerPlan;
- int i,
- nagg;
- Datum *value1,
- *value2;
- int *noInitValue;
- AggFuncInfo *aggFuncInfo;
- long nTuplesAgged = 0;
- ExprContext *econtext;
+ AggState *aggstate;
+ EState *estate;
+ Aggreg **aggregates;
+ Plan *outerPlan;
+ int i,
+ nagg;
+ Datum *value1,
+ *value2;
+ int *noInitValue;
+ AggFuncInfo *aggFuncInfo;
+ long nTuplesAgged = 0;
+ ExprContext *econtext;
ProjectionInfo *projInfo;
TupleTableSlot *resultSlot;
- HeapTuple oneTuple;
- char *nulls;
- bool isDone;
- bool isNull = FALSE,
- isNull1 = FALSE,
- isNull2 = FALSE;
+ HeapTuple oneTuple;
+ char *nulls;
+ bool isDone;
+ bool isNull = FALSE,
+ isNull1 = FALSE,
+ isNull2 = FALSE;
/* ---------------------
* get state info from node
@@ -143,19 +143,19 @@ ExecAgg(Agg * node)
for (i = 0; i < nagg; i++)
{
- Aggreg *agg;
- char *aggname;
- HeapTuple aggTuple;
+ Aggreg *agg;
+ char *aggname;
+ HeapTuple aggTuple;
Form_pg_aggregate aggp;
- Oid xfn1_oid,
- xfn2_oid,
- finalfn_oid;
- func_ptr xfn1_ptr,
- xfn2_ptr,
- finalfn_ptr;
- int xfn1_nargs,
- xfn2_nargs,
- finalfn_nargs;
+ Oid xfn1_oid,
+ xfn2_oid,
+ finalfn_oid;
+ func_ptr xfn1_ptr,
+ xfn2_ptr,
+ finalfn_ptr;
+ int xfn1_nargs,
+ xfn2_nargs,
+ finalfn_nargs;
agg = aggregates[i];
@@ -240,7 +240,7 @@ ExecAgg(Agg * node)
*/
for (;;)
{
- HeapTuple outerTuple = NULL;
+ HeapTuple outerTuple = NULL;
TupleTableSlot *outerslot;
isNull = isNull1 = isNull2 = 0;
@@ -258,9 +258,9 @@ ExecAgg(Agg * node)
*/
if (nTuplesAgged == 0)
{
- TupleDesc tupType;
- Datum *tupValue;
- char *null_array;
+ TupleDesc tupType;
+ Datum *tupValue;
+ char *null_array;
tupType = aggstate->csstate.css_ScanTupleSlot->ttc_tupleDescriptor;
tupValue = projInfo->pi_tupValue;
@@ -277,29 +277,29 @@ ExecAgg(Agg * node)
for (i = 0; i < nagg; i++)
{
- AttrNumber attnum;
- int2 attlen;
- Datum newVal = (Datum) NULL;
- AggFuncInfo *aggfns = &aggFuncInfo[i];
- Datum args[2];
- Node *tagnode = NULL;
+ AttrNumber attnum;
+ int2 attlen;
+ Datum newVal = (Datum) NULL;
+ AggFuncInfo *aggfns = &aggFuncInfo[i];
+ Datum args[2];
+ Node *tagnode = NULL;
switch (nodeTag(aggregates[i]->target))
{
- case T_Var:
- tagnode = NULL;
- newVal = aggGetAttr(outerslot,
- aggregates[i],
- &isNull);
- break;
- case T_Expr:
- tagnode = ((Expr *) aggregates[i]->target)->oper;
- econtext->ecxt_scantuple = outerslot;
- newVal = ExecEvalExpr(aggregates[i]->target, econtext,
- &isNull, NULL);
- break;
- default:
- elog(WARN, "ExecAgg: Bad Agg->Target for Agg %d", i);
+ case T_Var:
+ tagnode = NULL;
+ newVal = aggGetAttr(outerslot,
+ aggregates[i],
+ &isNull);
+ break;
+ case T_Expr:
+ tagnode = ((Expr *) aggregates[i]->target)->oper;
+ econtext->ecxt_scantuple = outerslot;
+ newVal = ExecEvalExpr(aggregates[i]->target, econtext,
+ &isNull, NULL);
+ break;
+ default:
+ elog(WARN, "ExecAgg: Bad Agg->Target for Agg %d", i);
}
if (isNull)
@@ -309,7 +309,7 @@ ExecAgg(Agg * node)
{
if (noInitValue[i])
{
- int byVal;
+ int byVal;
/*
* value1 and value2 has not been initialized. This is
@@ -371,7 +371,7 @@ ExecAgg(Agg * node)
if (aggfns->xfn2)
{
- Datum xfn2_val = value2[i];
+ Datum xfn2_val = value2[i];
value2[i] =
(Datum) fmgr_c(aggfns->xfn2, aggfns->xfn2_oid,
@@ -399,8 +399,8 @@ ExecAgg(Agg * node)
*/
for (i = 0; i < nagg; i++)
{
- char *args[2];
- AggFuncInfo *aggfns = &aggFuncInfo[i];
+ char *args[2];
+ AggFuncInfo *aggfns = &aggFuncInfo[i];
if (noInitValue[i])
{
@@ -490,9 +490,9 @@ ExecAgg(Agg * node)
bool
ExecInitAgg(Agg * node, EState * estate, Plan * parent)
{
- AggState *aggstate;
- Plan *outerPlan;
- ExprContext *econtext;
+ AggState *aggstate;
+ Plan *outerPlan;
+ ExprContext *econtext;
/*
* assign the node's execution state
@@ -566,8 +566,8 @@ ExecCountSlotsAgg(Agg * node)
void
ExecEndAgg(Agg * node)
{
- AggState *aggstate;
- Plan *outerPlan;
+ AggState *aggstate;
+ Plan *outerPlan;
aggstate = node->aggstate;
@@ -590,16 +590,16 @@ ExecEndAgg(Agg * node)
* get the attribute (specified in the Var node in agg) to aggregate
* over from the tuple
*/
-static Datum
+static Datum
aggGetAttr(TupleTableSlot * slot,
Aggreg * agg,
bool * isNull)
{
- Datum result;
- AttrNumber attnum;
- HeapTuple heapTuple;
- TupleDesc tuple_type;
- Buffer buffer;
+ Datum result;
+ AttrNumber attnum;
+ HeapTuple heapTuple;
+ TupleDesc tuple_type;
+ Buffer buffer;
/* ----------------
* extract tuple information from the slot
@@ -619,8 +619,8 @@ aggGetAttr(TupleTableSlot * slot,
if (attnum == InvalidAttrNumber)
{
TupleTableSlot *tempSlot;
- TupleDesc td;
- HeapTuple tup;
+ TupleDesc td;
+ HeapTuple tup;
tempSlot = makeNode(TupleTableSlot);
tempSlot->ttc_shouldFree = false;
diff --git a/src/backend/executor/nodeAppend.c b/src/backend/executor/nodeAppend.c
index 043ad5d9743..da43dc8ee3d 100644
--- a/src/backend/executor/nodeAppend.c
+++ b/src/backend/executor/nodeAppend.c
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/executor/nodeAppend.c,v 1.6 1997/09/07 04:41:30 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/executor/nodeAppend.c,v 1.7 1997/09/08 02:22:40 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -64,7 +64,7 @@
#include "utils/mcxt.h"
#include "parser/parsetree.h" /* for rt_store() macro */
-static bool exec_append_initialize_next(Append * node);
+static bool exec_append_initialize_next(Append * node);
/* ----------------------------------------------------------------
* exec-append-initialize-next
@@ -75,20 +75,20 @@ static bool exec_append_initialize_next(Append * node);
* Returns t iff there is a "next" scan to process.
* ----------------------------------------------------------------
*/
-static bool
+static bool
exec_append_initialize_next(Append * node)
{
- EState *estate;
- AppendState *unionstate;
+ EState *estate;
+ AppendState *unionstate;
TupleTableSlot *result_slot;
- List *rangeTable;
+ List *rangeTable;
- int whichplan;
- int nplans;
- List *rtentries;
- ResTarget *rtentry;
+ int whichplan;
+ int nplans;
+ List *rtentries;
+ ResTarget *rtentry;
- Index unionrelid;
+ Index unionrelid;
/* ----------------
* get information from the append node
@@ -184,16 +184,16 @@ exec_append_initialize_next(Append * node)
bool
ExecInitAppend(Append * node, EState * estate, Plan * parent)
{
- AppendState *unionstate;
- int nplans;
- List *resultList = NULL;
- List *rtentries;
- List *unionplans;
- bool *initialized;
- int i;
- Plan *initNode;
- List *junkList;
- RelationInfo *es_rri = estate->es_result_relation_info;
+ AppendState *unionstate;
+ int nplans;
+ List *resultList = NULL;
+ List *rtentries;
+ List *unionplans;
+ bool *initialized;
+ int i;
+ Plan *initNode;
+ List *junkList;
+ RelationInfo *es_rri = estate->es_result_relation_info;
/* ----------------
* assign execution state to node and get information
@@ -251,13 +251,13 @@ ExecInitAppend(Append * node, EState * estate, Plan * parent)
if ((es_rri != (RelationInfo *) NULL) &&
(node->unionrelid == es_rri->ri_RangeTableIndex))
{
- RelationInfo *rri;
- List *rtentryP;
+ RelationInfo *rri;
+ List *rtentryP;
foreach(rtentryP, rtentries)
{
- Oid reloid;
- RangeTblEntry *rtentry = lfirst(rtentryP);
+ Oid reloid;
+ RangeTblEntry *rtentry = lfirst(rtentryP);
reloid = rtentry->relid;
rri = makeNode(RelationInfo);
@@ -281,8 +281,8 @@ ExecInitAppend(Append * node, EState * estate, Plan * parent)
for (i = 0; i < nplans; i++)
{
- JunkFilter *j;
- List *targetList;
+ JunkFilter *j;
+ List *targetList;
/* ----------------
* NOTE: we first modify range table in
@@ -343,9 +343,9 @@ ExecInitAppend(Append * node, EState * estate, Plan * parent)
int
ExecCountSlotsAppend(Append * node)
{
- List *plan;
- List *unionplans = node->unionplans;
- int nSlots = 0;
+ List *plan;
+ List *unionplans = node->unionplans;
+ int nSlots = 0;
foreach(plan, unionplans)
{
@@ -365,15 +365,15 @@ ExecCountSlotsAppend(Append * node)
TupleTableSlot *
ExecProcAppend(Append * node)
{
- EState *estate;
- AppendState *unionstate;
+ EState *estate;
+ AppendState *unionstate;
- int whichplan;
- List *unionplans;
- Plan *subnode;
+ int whichplan;
+ List *unionplans;
+ Plan *subnode;
TupleTableSlot *result;
TupleTableSlot *result_slot;
- ScanDirection direction;
+ ScanDirection direction;
/* ----------------
* get information from the node
@@ -458,13 +458,13 @@ ExecProcAppend(Append * node)
void
ExecEndAppend(Append * node)
{
- AppendState *unionstate;
- int nplans;
- List *unionplans;
- bool *initialized;
- int i;
- List *resultRelationInfoList;
- RelationInfo *resultRelationInfo;
+ AppendState *unionstate;
+ int nplans;
+ List *unionplans;
+ bool *initialized;
+ int i;
+ List *resultRelationInfoList;
+ RelationInfo *resultRelationInfo;
/* ----------------
* get information from the node
@@ -494,7 +494,7 @@ ExecEndAppend(Append * node)
resultRelationInfoList = unionstate->as_result_relation_info_list;
while (resultRelationInfoList != NIL)
{
- Relation resultRelationDesc;
+ Relation resultRelationDesc;
resultRelationInfo = (RelationInfo *) lfirst(resultRelationInfoList);
resultRelationDesc = resultRelationInfo->ri_RelationDesc;
diff --git a/src/backend/executor/nodeGroup.c b/src/backend/executor/nodeGroup.c
index 1a96a1ee911..c7e63696c0b 100644
--- a/src/backend/executor/nodeGroup.c
+++ b/src/backend/executor/nodeGroup.c
@@ -13,7 +13,7 @@
* columns. (ie. tuples from the same group are consecutive)
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/executor/nodeGroup.c,v 1.6 1997/09/07 04:41:31 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/executor/nodeGroup.c,v 1.7 1997/09/08 02:22:41 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -66,17 +66,17 @@ ExecGroup(Group * node)
static TupleTableSlot *
ExecGroupEveryTuple(Group * node)
{
- GroupState *grpstate;
- EState *estate;
- ExprContext *econtext;
+ GroupState *grpstate;
+ EState *estate;
+ ExprContext *econtext;
- HeapTuple outerTuple = NULL;
+ HeapTuple outerTuple = NULL;
TupleTableSlot *outerslot,
- *lastslot;
+ *lastslot;
ProjectionInfo *projInfo;
TupleTableSlot *resultSlot;
- bool isDone;
+ bool isDone;
/* ---------------------
* get state info from node
@@ -167,17 +167,17 @@ ExecGroupEveryTuple(Group * node)
static TupleTableSlot *
ExecGroupOneTuple(Group * node)
{
- GroupState *grpstate;
- EState *estate;
- ExprContext *econtext;
+ GroupState *grpstate;
+ EState *estate;
+ ExprContext *econtext;
- HeapTuple outerTuple = NULL;
+ HeapTuple outerTuple = NULL;
TupleTableSlot *outerslot,
- *lastslot;
+ *lastslot;
ProjectionInfo *projInfo;
TupleTableSlot *resultSlot;
- bool isDone;
+ bool isDone;
/* ---------------------
* get state info from node
@@ -291,8 +291,8 @@ ExecGroupOneTuple(Group * node)
bool
ExecInitGroup(Group * node, EState * estate, Plan * parent)
{
- GroupState *grpstate;
- Plan *outerPlan;
+ GroupState *grpstate;
+ Plan *outerPlan;
/*
* assign the node's execution state
@@ -358,8 +358,8 @@ ExecCountSlotsGroup(Group * node)
void
ExecEndGroup(Group * node)
{
- GroupState *grpstate;
- Plan *outerPlan;
+ GroupState *grpstate;
+ Plan *outerPlan;
grpstate = node->grpstate;
@@ -379,22 +379,22 @@ ExecEndGroup(Group * node)
/*
* code swiped from nodeUnique.c
*/
-static bool
+static bool
sameGroup(TupleTableSlot * oldslot,
TupleTableSlot * newslot,
int numCols,
AttrNumber * grpColIdx,
TupleDesc tupdesc)
{
- bool isNull1,
- isNull2;
- char *attr1,
- *attr2;
- char *val1,
- *val2;
- int i;
- AttrNumber att;
- Oid typoutput;
+ bool isNull1,
+ isNull2;
+ char *attr1,
+ *attr2;
+ char *val1,
+ *val2;
+ int i;
+ AttrNumber att;
+ Oid typoutput;
for (i = 0; i < numCols; i++)
{
diff --git a/src/backend/executor/nodeHash.c b/src/backend/executor/nodeHash.c
index b25939fa832..b0e7ca4dd53 100644
--- a/src/backend/executor/nodeHash.c
+++ b/src/backend/executor/nodeHash.c
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/executor/nodeHash.c,v 1.11 1997/09/07 04:41:32 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/executor/nodeHash.c,v 1.12 1997/09/08 02:22:42 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -42,12 +42,12 @@
#include "utils/palloc.h"
#include "utils/hsearch.h"
-extern int NBuffers;
-static int HashTBSize;
+extern int NBuffers;
+static int HashTBSize;
-static void mk_hj_temp(char *tempname);
-static int hashFunc(char *key, int len);
-static int ExecHashPartition(Hash * node);
+static void mk_hj_temp(char *tempname);
+static int hashFunc(char *key, int len);
+static int ExecHashPartition(Hash * node);
static RelativeAddr hashTableAlloc(int size, HashJoinTable hashtable);
static void
ExecHashOverflowInsert(HashJoinTable hashtable,
@@ -64,20 +64,20 @@ ExecHashOverflowInsert(HashJoinTable hashtable,
TupleTableSlot *
ExecHash(Hash * node)
{
- EState *estate;
- HashState *hashstate;
- Plan *outerNode;
- Var *hashkey;
- HashJoinTable hashtable;
+ EState *estate;
+ HashState *hashstate;
+ Plan *outerNode;
+ Var *hashkey;
+ HashJoinTable hashtable;
TupleTableSlot *slot;
- ExprContext *econtext;
+ ExprContext *econtext;
- int nbatch;
- File *batches = NULL;
- RelativeAddr *batchPos;
- int *batchSizes;
- int i;
- RelativeAddr *innerbatchNames;
+ int nbatch;
+ File *batches = NULL;
+ RelativeAddr *batchPos;
+ int *batchSizes;
+ int i;
+ RelativeAddr *innerbatchNames;
/* ----------------
* get state info from node
@@ -167,8 +167,8 @@ ExecHash(Hash * node)
bool
ExecInitHash(Hash * node, EState * estate, Plan * parent)
{
- HashState *hashstate;
- Plan *outerPlan;
+ HashState *hashstate;
+ Plan *outerPlan;
SO1_printf("ExecInitHash: %s\n",
"initializing hash node");
@@ -240,9 +240,9 @@ ExecCountSlotsHash(Hash * node)
void
ExecEndHash(Hash * node)
{
- HashState *hashstate;
- Plan *outerPlan;
- File *batches;
+ HashState *hashstate;
+ Plan *outerPlan;
+ File *batches;
/* ----------------
* get info from the hash state
@@ -268,10 +268,10 @@ ExecEndHash(Hash * node)
ExecEndNode(outerPlan, (Plan *) node);
}
-static RelativeAddr
+static RelativeAddr
hashTableAlloc(int size, HashJoinTable hashtable)
{
- RelativeAddr p;
+ RelativeAddr p;
p = hashtable->top;
hashtable->top += size;
@@ -290,23 +290,23 @@ hashTableAlloc(int size, HashJoinTable hashtable)
HashJoinTable
ExecHashTableCreate(Hash * node)
{
- Plan *outerNode;
- int nbatch;
- int ntuples;
- int tupsize;
- IpcMemoryId shmid;
- HashJoinTable hashtable;
- HashBucket bucket;
- int nbuckets;
- int totalbuckets;
- int bucketsize;
- int i;
- RelativeAddr *outerbatchNames;
- RelativeAddr *outerbatchPos;
- RelativeAddr *innerbatchNames;
- RelativeAddr *innerbatchPos;
- int *innerbatchSizes;
- RelativeAddr tempname;
+ Plan *outerNode;
+ int nbatch;
+ int ntuples;
+ int tupsize;
+ IpcMemoryId shmid;
+ HashJoinTable hashtable;
+ HashBucket bucket;
+ int nbuckets;
+ int totalbuckets;
+ int bucketsize;
+ int i;
+ RelativeAddr *outerbatchNames;
+ RelativeAddr *outerbatchPos;
+ RelativeAddr *innerbatchNames;
+ RelativeAddr *innerbatchPos;
+ int *innerbatchSizes;
+ RelativeAddr tempname;
nbatch = -1;
HashTBSize = NBuffers / 2;
@@ -461,15 +461,15 @@ ExecHashTableInsert(HashJoinTable hashtable,
File * batches)
{
TupleTableSlot *slot;
- HeapTuple heapTuple;
- HashBucket bucket;
- int bucketno;
- int nbatch;
- int batchno;
- char *buffer;
- RelativeAddr *batchPos;
- int *batchSizes;
- char *pos;
+ HeapTuple heapTuple;
+ HashBucket bucket;
+ int bucketno;
+ int nbatch;
+ int batchno;
+ char *buffer;
+ RelativeAddr *batchPos;
+ int *batchSizes;
+ char *pos;
nbatch = hashtable->nbatch;
batchPos = (RelativeAddr *) ABSADDR(hashtable->innerbatchPos);
@@ -551,9 +551,9 @@ ExecHashGetBucket(HashJoinTable hashtable,
ExprContext * econtext,
Var * hashkey)
{
- int bucketno;
- Datum keyval;
- bool isNull;
+ int bucketno;
+ Datum keyval;
+ bool isNull;
/* ----------------
@@ -606,10 +606,10 @@ ExecHashOverflowInsert(HashJoinTable hashtable,
HashBucket bucket,
HeapTuple heapTuple)
{
- OverflowTuple otuple;
- RelativeAddr newend;
- OverflowTuple firstotuple;
- OverflowTuple lastotuple;
+ OverflowTuple otuple;
+ RelativeAddr newend;
+ OverflowTuple firstotuple;
+ OverflowTuple lastotuple;
firstotuple = (OverflowTuple) ABSADDR(bucket->firstotuple);
lastotuple = (OverflowTuple) ABSADDR(bucket->lastotuple);
@@ -687,14 +687,14 @@ ExecScanHashBucket(HashJoinState * hjstate,
List * hjclauses,
ExprContext * econtext)
{
- HeapTuple heapTuple;
- bool qualResult;
- OverflowTuple otuple = NULL;
- OverflowTuple curotuple;
+ HeapTuple heapTuple;
+ bool qualResult;
+ OverflowTuple otuple = NULL;
+ OverflowTuple curotuple;
TupleTableSlot *inntuple;
- OverflowTuple firstotuple;
- OverflowTuple lastotuple;
- HashJoinTable hashtable;
+ OverflowTuple firstotuple;
+ OverflowTuple lastotuple;
+ HashJoinTable hashtable;
hashtable = hjstate->hj_HashTable;
firstotuple = (OverflowTuple) ABSADDR(bucket->firstotuple);
@@ -785,7 +785,7 @@ static int
hashFunc(char *key, int len)
{
register unsigned int h;
- register int l;
+ register int l;
register unsigned char *k;
/*
@@ -828,11 +828,11 @@ hashFunc(char *key, int len)
static int
ExecHashPartition(Hash * node)
{
- Plan *outerNode;
- int b;
- int pages;
- int ntuples;
- int tupsize;
+ Plan *outerNode;
+ int b;
+ int pages;
+ int ntuples;
+ int tupsize;
/*
* get size information for plan node
@@ -866,8 +866,8 @@ ExecHashPartition(Hash * node)
void
ExecHashTableReset(HashJoinTable hashtable, int ntuples)
{
- int i;
- HashBucket bucket;
+ int i;
+ HashBucket bucket;
hashtable->nbuckets = hashtable->totalbuckets
= ceil((double) ntuples / NTUP_PER_BUCKET);
@@ -886,7 +886,7 @@ ExecHashTableReset(HashJoinTable hashtable, int ntuples)
hashtable->pcount = hashtable->nprocess;
}
-static int hjtmpcnt = 0;
+static int hjtmpcnt = 0;
static void
mk_hj_temp(char *tempname)
diff --git a/src/backend/executor/nodeHashjoin.c b/src/backend/executor/nodeHashjoin.c
index 3548e38cc86..b0c6eec3c02 100644
--- a/src/backend/executor/nodeHashjoin.c
+++ b/src/backend/executor/nodeHashjoin.c
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/executor/nodeHashjoin.c,v 1.6 1997/09/07 04:41:33 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/executor/nodeHashjoin.c,v 1.7 1997/09/08 02:22:43 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -33,7 +33,7 @@
#include "utils/palloc.h"
static TupleTableSlot *
- ExecHashJoinOuterGetTuple(Plan * node, Plan * parent, HashJoinState * hjstate);
+ ExecHashJoinOuterGetTuple(Plan * node, Plan * parent, HashJoinState * hjstate);
static TupleTableSlot *
ExecHashJoinGetSavedTuple(HashJoinState * hjstate, char *buffer,
@@ -43,7 +43,7 @@ static int
ExecHashJoinGetBatch(int bucketno, HashJoinTable hashtable,
int nbatch);
-static int ExecHashJoinNewBatch(HashJoinState * hjstate);
+static int ExecHashJoinNewBatch(HashJoinState * hjstate);
@@ -59,39 +59,39 @@ static int ExecHashJoinNewBatch(HashJoinState * hjstate);
TupleTableSlot * /* return: a tuple or NULL */
ExecHashJoin(HashJoin * node)
{
- HashJoinState *hjstate;
- EState *estate;
- Plan *outerNode;
- Hash *hashNode;
- List *hjclauses;
- Expr *clause;
- List *qual;
- ScanDirection dir;
+ HashJoinState *hjstate;
+ EState *estate;
+ Plan *outerNode;
+ Hash *hashNode;
+ List *hjclauses;
+ Expr *clause;
+ List *qual;
+ ScanDirection dir;
TupleTableSlot *inntuple;
- Var *outerVar;
- ExprContext *econtext;
+ Var *outerVar;
+ ExprContext *econtext;
- HashJoinTable hashtable;
- int bucketno;
- HashBucket bucket;
- HeapTuple curtuple;
+ HashJoinTable hashtable;
+ int bucketno;
+ HashBucket bucket;
+ HeapTuple curtuple;
- bool qualResult;
+ bool qualResult;
TupleTableSlot *outerTupleSlot;
TupleTableSlot *innerTupleSlot;
- int nbatch;
- int curbatch;
- File *outerbatches;
- RelativeAddr *outerbatchNames;
- RelativeAddr *outerbatchPos;
- Var *innerhashkey;
- int batch;
- int batchno;
- char *buffer;
- int i;
- bool hashPhaseDone;
- char *pos;
+ int nbatch;
+ int curbatch;
+ File *outerbatches;
+ RelativeAddr *outerbatchNames;
+ RelativeAddr *outerbatchPos;
+ Var *innerhashkey;
+ int batch;
+ int batchno;
+ char *buffer;
+ int i;
+ bool hashPhaseDone;
+ char *pos;
/* ----------------
* get information from HashJoin node
@@ -125,7 +125,7 @@ ExecHashJoin(HashJoin * node)
if (hjstate->jstate.cs_TupFromTlist)
{
TupleTableSlot *result;
- bool isDone;
+ bool isDone;
result = ExecProject(hjstate->jstate.cs_ProjInfo, &isDone);
if (!isDone)
@@ -322,7 +322,7 @@ ExecHashJoin(HashJoin * node)
{
ProjectionInfo *projInfo;
TupleTableSlot *result;
- bool isDone;
+ bool isDone;
hjstate->hj_CurBucket = bucket;
hjstate->hj_CurTuple = curtuple;
@@ -394,9 +394,9 @@ ExecHashJoin(HashJoin * node)
bool /* return: initialization status */
ExecInitHashJoin(HashJoin * node, EState * estate, Plan * parent)
{
- HashJoinState *hjstate;
- Plan *outerNode;
- Hash *hashNode;
+ HashJoinState *hjstate;
+ Plan *outerNode;
+ Hash *hashNode;
/* ----------------
* assign the node's execution state
@@ -451,7 +451,7 @@ ExecInitHashJoin(HashJoin * node, EState * estate, Plan * parent)
* ----------------
*/
{
- HashState *hashstate = hashNode->hashstate;
+ HashState *hashstate = hashNode->hashstate;
TupleTableSlot *slot =
hashstate->cstate.cs_ResultTupleSlot;
@@ -513,7 +513,7 @@ ExecCountSlotsHashJoin(HashJoin * node)
void
ExecEndHashJoin(HashJoin * node)
{
- HashJoinState *hjstate;
+ HashJoinState *hjstate;
/* ----------------
* get info from the HashJoin state
@@ -572,13 +572,13 @@ static TupleTableSlot *
ExecHashJoinOuterGetTuple(Plan * node, Plan * parent, HashJoinState * hjstate)
{
TupleTableSlot *slot;
- HashJoinTable hashtable;
- int curbatch;
- File *outerbatches;
- char *outerreadPos;
- int batchno;
- char *outerreadBuf;
- int outerreadBlk;
+ HashJoinTable hashtable;
+ int curbatch;
+ File *outerbatches;
+ char *outerreadPos;
+ int batchno;
+ char *outerreadBuf;
+ int outerreadBlk;
hashtable = hjstate->hj_HashTable;
curbatch = hashtable->curbatch;
@@ -626,11 +626,11 @@ ExecHashJoinGetSavedTuple(HashJoinState * hjstate,
int *block, /* return parameter */
char **position) /* return parameter */
{
- char *bufstart;
- char *bufend;
- int cc;
- HeapTuple heapTuple;
- HashJoinTable hashtable;
+ char *bufstart;
+ char *bufend;
+ int cc;
+ HeapTuple heapTuple;
+ HashJoinTable hashtable;
hashtable = hjstate->hj_HashTable;
bufend = buffer + *(long *) buffer;
@@ -666,20 +666,20 @@ ExecHashJoinGetSavedTuple(HashJoinState * hjstate,
static int
ExecHashJoinNewBatch(HashJoinState * hjstate)
{
- File *innerBatches;
- File *outerBatches;
- int *innerBatchSizes;
- Var *innerhashkey;
- HashJoinTable hashtable;
- int nbatch;
- char *readPos;
- int readBlk;
- char *readBuf;
+ File *innerBatches;
+ File *outerBatches;
+ int *innerBatchSizes;
+ Var *innerhashkey;
+ HashJoinTable hashtable;
+ int nbatch;
+ char *readPos;
+ int readBlk;
+ char *readBuf;
TupleTableSlot *slot;
- ExprContext *econtext;
- int i;
- int cc;
- int newbatch;
+ ExprContext *econtext;
+ int i;
+ int cc;
+ int newbatch;
hashtable = hjstate->hj_HashTable;
outerBatches = hjstate->hj_OuterBatches;
@@ -793,7 +793,7 @@ ExecHashJoinNewBatch(HashJoinState * hjstate)
static int
ExecHashJoinGetBatch(int bucketno, HashJoinTable hashtable, int nbatch)
{
- int b;
+ int b;
if (bucketno < hashtable->nbuckets || nbatch == 0)
return 0;
@@ -813,16 +813,16 @@ ExecHashJoinGetBatch(int bucketno, HashJoinTable hashtable, int nbatch)
* ----------------------------------------------------------------
*/
-char *
+char *
ExecHashJoinSaveTuple(HeapTuple heapTuple,
char *buffer,
File file,
char *position)
{
- long *pageend;
- char *pagestart;
- char *pagebound;
- int cc;
+ long *pageend;
+ char *pagestart;
+ char *pagebound;
+ int cc;
pageend = (long *) buffer;
pagestart = (char *) (buffer + sizeof(long));
diff --git a/src/backend/executor/nodeIndexscan.c b/src/backend/executor/nodeIndexscan.c
index c89a4fcb081..61fca80a0cf 100644
--- a/src/backend/executor/nodeIndexscan.c
+++ b/src/backend/executor/nodeIndexscan.c
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/executor/nodeIndexscan.c,v 1.8 1997/09/07 04:41:35 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/executor/nodeIndexscan.c,v 1.9 1997/09/08 02:22:44 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -82,19 +82,19 @@ static TupleTableSlot *IndexNext(IndexScan * node);
static TupleTableSlot *
IndexNext(IndexScan * node)
{
- EState *estate;
+ EState *estate;
CommonScanState *scanstate;
IndexScanState *indexstate;
- ScanDirection direction;
- int indexPtr;
+ ScanDirection direction;
+ int indexPtr;
IndexScanDescPtr scanDescs;
- IndexScanDesc scandesc;
- Relation heapRelation;
+ IndexScanDesc scandesc;
+ Relation heapRelation;
RetrieveIndexResult result;
- ItemPointer iptr;
- HeapTuple tuple;
+ ItemPointer iptr;
+ HeapTuple tuple;
TupleTableSlot *slot;
- Buffer buffer = InvalidBuffer;
+ Buffer buffer = InvalidBuffer;
/* ----------------
* extract necessary information from index scan node
@@ -219,30 +219,30 @@ ExecIndexScan(IndexScan * node)
void
ExecIndexReScan(IndexScan * node, ExprContext * exprCtxt, Plan * parent)
{
- EState *estate;
+ EState *estate;
IndexScanState *indexstate;
- ScanDirection direction;
+ ScanDirection direction;
IndexScanDescPtr scanDescs;
- ScanKey *scanKeys;
- IndexScanDesc sdesc;
- ScanKey skey;
- int numIndices;
- int i;
-
- Pointer *runtimeKeyInfo;
- int indexPtr;
- int *numScanKeys;
- List *indxqual;
- List *qual;
- int n_keys;
- ScanKey scan_keys;
- int *run_keys;
- int j;
- Expr *clause;
- Node *scanexpr;
- Datum scanvalue;
- bool isNull;
- bool isDone;
+ ScanKey *scanKeys;
+ IndexScanDesc sdesc;
+ ScanKey skey;
+ int numIndices;
+ int i;
+
+ Pointer *runtimeKeyInfo;
+ int indexPtr;
+ int *numScanKeys;
+ List *indxqual;
+ List *qual;
+ int n_keys;
+ ScanKey scan_keys;
+ int *run_keys;
+ int j;
+ Expr *clause;
+ Node *scanexpr;
+ Datum scanvalue;
+ bool isNull;
+ bool isDone;
indexstate = node->indxstate;
estate = node->scan.plan.state;
@@ -335,9 +335,9 @@ ExecEndIndexScan(IndexScan * node)
{
CommonScanState *scanstate;
IndexScanState *indexstate;
- ScanKey *scanKeys;
- int numIndices;
- int i;
+ ScanKey *scanKeys;
+ int numIndices;
+ int i;
scanstate = node->scan.scanstate;
indexstate = node->indxstate;
@@ -399,8 +399,8 @@ ExecIndexMarkPos(IndexScan * node)
{
IndexScanState *indexstate;
IndexScanDescPtr indexScanDescs;
- IndexScanDesc scanDesc;
- int indexPtr;
+ IndexScanDesc scanDesc;
+ int indexPtr;
indexstate = node->indxstate;
indexPtr = indexstate->iss_IndexPtr;
@@ -430,8 +430,8 @@ ExecIndexRestrPos(IndexScan * node)
{
IndexScanState *indexstate;
IndexScanDescPtr indexScanDescs;
- IndexScanDesc scanDesc;
- int indexPtr;
+ IndexScanDesc scanDesc;
+ int indexPtr;
indexstate = node->indxstate;
indexPtr = indexstate->iss_IndexPtr;
@@ -465,27 +465,27 @@ ExecInitIndexScan(IndexScan * node, EState * estate, Plan * parent)
{
IndexScanState *indexstate;
CommonScanState *scanstate;
- List *indxqual;
- List *indxid;
- int i;
- int numIndices;
- int indexPtr;
- ScanKey *scanKeys;
- int *numScanKeys;
- RelationPtr relationDescs;
+ List *indxqual;
+ List *indxid;
+ int i;
+ int numIndices;
+ int indexPtr;
+ ScanKey *scanKeys;
+ int *numScanKeys;
+ RelationPtr relationDescs;
IndexScanDescPtr scanDescs;
- Pointer *runtimeKeyInfo;
- bool have_runtime_keys;
- List *rangeTable;
- RangeTblEntry *rtentry;
- Index relid;
- Oid reloid;
- TimeQual timeQual;
-
- Relation currentRelation;
- HeapScanDesc currentScanDesc;
- ScanDirection direction;
- int baseid;
+ Pointer *runtimeKeyInfo;
+ bool have_runtime_keys;
+ List *rangeTable;
+ RangeTblEntry *rtentry;
+ Index relid;
+ Oid reloid;
+ TimeQual timeQual;
+
+ Relation currentRelation;
+ HeapScanDesc currentScanDesc;
+ ScanDirection direction;
+ int baseid;
/* ----------------
* assign execution state to node
@@ -600,11 +600,11 @@ ExecInitIndexScan(IndexScan * node, EState * estate, Plan * parent)
*/
for (i = 0; i < numIndices; i++)
{
- int j;
- List *qual;
- int n_keys;
- ScanKey scan_keys;
- int *run_keys;
+ int j;
+ List *qual;
+ int n_keys;
+ ScanKey scan_keys;
+ int *run_keys;
qual = nth(i, indxqual);
n_keys = length(qual);
@@ -623,17 +623,16 @@ ExecInitIndexScan(IndexScan * node, EState * estate, Plan * parent)
*/
for (j = 0; j < n_keys; j++)
{
- Expr *clause; /* one part of index qual */
- Oper *op; /* operator used in scan.. */
- Node *leftop; /* expr on lhs of operator */
- Node *rightop; /* expr on rhs ... */
- bits16 flags = 0;
-
- int scanvar; /* which var identifies varattno */
- AttrNumber varattno = 0; /* att number used in scan */
- Oid opid; /* operator id used in scan */
- Datum scanvalue = 0; /* value used in scan (if
- * const) */
+ Expr *clause; /* one part of index qual */
+ Oper *op; /* operator used in scan.. */
+ Node *leftop; /* expr on lhs of operator */
+ Node *rightop;/* expr on rhs ... */
+ bits16 flags = 0;
+
+ int scanvar;/* which var identifies varattno */
+ AttrNumber varattno = 0; /* att number used in scan */
+ Oid opid; /* operator id used in scan */
+ Datum scanvalue = 0; /* value used in scan (if const) */
/* ----------------
* extract clause information from the qualification
@@ -702,7 +701,7 @@ ExecInitIndexScan(IndexScan * node, EState * estate, Plan * parent)
}
else if (IsA(leftop, Param))
{
- bool isnull;
+ bool isnull;
/* ----------------
* if the leftop is a Param node then it means
@@ -785,7 +784,7 @@ ExecInitIndexScan(IndexScan * node, EState * estate, Plan * parent)
}
else if (IsA(rightop, Param))
{
- bool isnull;
+ bool isnull;
/* ----------------
* if the rightop is a Param node then it means
@@ -885,8 +884,8 @@ ExecInitIndexScan(IndexScan * node, EState * estate, Plan * parent)
indexstate->iss_RuntimeKeyInfo = NULL;
for (i = 0; i < numIndices; i++)
{
- List *qual;
- int n_keys;
+ List *qual;
+ int n_keys;
qual = nth(i, indxqual);
n_keys = length(qual);
@@ -947,7 +946,7 @@ ExecInitIndexScan(IndexScan * node, EState * estate, Plan * parent)
*/
for (i = 0; i < numIndices; i++)
{
- Oid indexOid;
+ Oid indexOid;
indexOid = (Oid) nthi(i, indxid);
diff --git a/src/backend/executor/nodeMaterial.c b/src/backend/executor/nodeMaterial.c
index 49ba73d3bf0..6ff8598901e 100644
--- a/src/backend/executor/nodeMaterial.c
+++ b/src/backend/executor/nodeMaterial.c
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/executor/nodeMaterial.c,v 1.7 1997/09/07 04:41:36 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/executor/nodeMaterial.c,v 1.8 1997/09/08 02:22:45 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -50,16 +50,16 @@
TupleTableSlot * /* result tuple from subplan */
ExecMaterial(Material * node)
{
- EState *estate;
- MaterialState *matstate;
- Plan *outerNode;
- ScanDirection dir;
- Relation tempRelation;
- Relation currentRelation;
- HeapScanDesc currentScanDesc;
- HeapTuple heapTuple;
+ EState *estate;
+ MaterialState *matstate;
+ Plan *outerNode;
+ ScanDirection dir;
+ Relation tempRelation;
+ Relation currentRelation;
+ HeapScanDesc currentScanDesc;
+ HeapTuple heapTuple;
TupleTableSlot *slot;
- Buffer buffer;
+ Buffer buffer;
/* ----------------
* get state info from node
@@ -190,10 +190,10 @@ ExecMaterial(Material * node)
bool /* initialization status */
ExecInitMaterial(Material * node, EState * estate, Plan * parent)
{
- MaterialState *matstate;
- Plan *outerPlan;
- TupleDesc tupType;
- Relation tempDesc;
+ MaterialState *matstate;
+ Plan *outerPlan;
+ TupleDesc tupType;
+ Relation tempDesc;
/* int len; */
@@ -308,9 +308,9 @@ ExecCountSlotsMaterial(Material * node)
void
ExecEndMaterial(Material * node)
{
- MaterialState *matstate;
- Relation tempRelation;
- Plan *outerPlan;
+ MaterialState *matstate;
+ Relation tempRelation;
+ Plan *outerPlan;
/* ----------------
* get info from the material state
@@ -349,8 +349,8 @@ ExecEndMaterial(Material * node)
List /* nothing of interest */
ExecMaterialMarkPos(Material node)
{
- MaterialState matstate;
- HeapScanDesc sdesc;
+ MaterialState matstate;
+ HeapScanDesc sdesc;
/* ----------------
* if we haven't materialized yet, just return NIL.
@@ -379,8 +379,8 @@ ExecMaterialMarkPos(Material node)
void
ExecMaterialRestrPos(Material node)
{
- MaterialState matstate;
- HeapScanDesc sdesc;
+ MaterialState matstate;
+ HeapScanDesc sdesc;
/* ----------------
* if we haven't materialized yet, just return.
diff --git a/src/backend/executor/nodeMergejoin.c b/src/backend/executor/nodeMergejoin.c
index 348d3fa1e00..621cfcea901 100644
--- a/src/backend/executor/nodeMergejoin.c
+++ b/src/backend/executor/nodeMergejoin.c
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/executor/nodeMergejoin.c,v 1.9 1997/09/07 04:41:37 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/executor/nodeMergejoin.c,v 1.10 1997/09/08 02:22:46 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -84,7 +84,7 @@
#include "utils/lsyscache.h"
#include "utils/psort.h"
-static bool MergeCompare(List * eqQual, List * compareQual, ExprContext * econtext);
+static bool MergeCompare(List * eqQual, List * compareQual, ExprContext * econtext);
/* ----------------------------------------------------------------
* MarkInnerTuple and RestoreInnerTuple macros
@@ -142,13 +142,13 @@ static bool MergeCompare(List * eqQual, List * compareQual, ExprContext * econt
* by "sortOp".
* ----------------------------------------------------------------
*/
-static List *
+static List *
MJFormOSortopI(List * qualList, Oid sortOp)
{
- List *qualCopy;
- List *qualcdr;
- Expr *qual;
- Oper *op;
+ List *qualCopy;
+ List *qualcdr;
+ Expr *qual;
+ Oper *op;
/* ----------------
* qualList is a list: ((op .. ..) ...)
@@ -206,11 +206,11 @@ MJFormOSortopI(List * qualList, Oid sortOp)
* by "sortOp" and reversing the positions of the keys.
* ----------------------------------------------------------------
*/
-static List *
+static List *
MJFormISortopO(List * qualList, Oid sortOp)
{
- List *ISortopO;
- List *qualcdr;
+ List *ISortopO;
+ List *qualcdr;
/* ----------------
* first generate OSortopI, a list of the form
@@ -226,9 +226,9 @@ MJFormISortopO(List * qualList, Oid sortOp)
*/
foreach(qualcdr, ISortopO)
{
- Expr *qual;
- List *inner;
- List *outer;
+ Expr *qual;
+ List *inner;
+ List *outer;
qual = lfirst(qualcdr);
@@ -257,14 +257,14 @@ MJFormISortopO(List * qualList, Oid sortOp)
* if (key1i > key2i) is true and (key1j = key2j) for 0 < j < i.
* ----------------------------------------------------------------
*/
-static bool
+static bool
MergeCompare(List * eqQual, List * compareQual, ExprContext * econtext)
{
- List *clause;
- List *eqclause;
- Datum const_value;
- bool isNull;
- bool isDone;
+ List *clause;
+ List *eqclause;
+ Datum const_value;
+ bool isNull;
+ bool isDone;
/* ----------------
* if we have no compare qualification, return nil
@@ -394,7 +394,7 @@ CleanUpSort(Plan * plan)
if (plan->type == T_Sort)
{
- Sort *sort = (Sort *) plan;
+ Sort *sort = (Sort *) plan;
psort_end(sort);
}
@@ -451,25 +451,25 @@ CleanUpSort(Plan * plan)
TupleTableSlot *
ExecMergeJoin(MergeJoin * node)
{
- EState *estate;
+ EState *estate;
MergeJoinState *mergestate;
- ScanDirection direction;
- List *innerSkipQual;
- List *outerSkipQual;
- List *mergeclauses;
- List *qual;
- bool qualResult;
- bool compareResult;
-
- Plan *innerPlan;
+ ScanDirection direction;
+ List *innerSkipQual;
+ List *outerSkipQual;
+ List *mergeclauses;
+ List *qual;
+ bool qualResult;
+ bool compareResult;
+
+ Plan *innerPlan;
TupleTableSlot *innerTupleSlot;
- Plan *outerPlan;
+ Plan *outerPlan;
TupleTableSlot *outerTupleSlot;
TupleTableSlot *markedTupleSlot;
- ExprContext *econtext;
+ ExprContext *econtext;
/* ----------------
* get information from node
@@ -503,7 +503,7 @@ ExecMergeJoin(MergeJoin * node)
{
TupleTableSlot *result;
ProjectionInfo *projInfo;
- bool isDone;
+ bool isDone;
projInfo = mergestate->jstate.cs_ProjInfo;
result = ExecProject(projInfo, &isDone);
@@ -523,349 +523,185 @@ ExecMergeJoin(MergeJoin * node)
switch (mergestate->mj_JoinState)
{
- /*
- * ******************************** EXEC_MJ_INITIALIZE means
- * that this is the first time ExecMergeJoin() has been called
- * and so we have to initialize the inner, outer and marked
- * tuples as well as various stuff in the expression context. ********************************
- *
- */
- case EXEC_MJ_INITIALIZE:
- MJ_printf("ExecMergeJoin: EXEC_MJ_INITIALIZE\n");
- /* ----------------
- * Note: at this point, if either of our inner or outer
- * tuples are nil, then the join ends immediately because
- * we know one of the subplans is empty.
- * ----------------
- */
- innerTupleSlot = ExecProcNode(innerPlan, (Plan *) node);
- if (TupIsNull(innerTupleSlot))
- {
- MJ_printf("ExecMergeJoin: **** inner tuple is nil ****\n");
- return NULL;
- }
+ /*
+ * ******************************** EXEC_MJ_INITIALIZE
+ * means that this is the first time ExecMergeJoin() has
+ * been called and so we have to initialize the inner,
+ * outer and marked tuples as well as various stuff in the
+ * expression context. ********************************
+ *
+ */
+ case EXEC_MJ_INITIALIZE:
+ MJ_printf("ExecMergeJoin: EXEC_MJ_INITIALIZE\n");
+ /* ----------------
+ * Note: at this point, if either of our inner or outer
+ * tuples are nil, then the join ends immediately because
+ * we know one of the subplans is empty.
+ * ----------------
+ */
+ innerTupleSlot = ExecProcNode(innerPlan, (Plan *) node);
+ if (TupIsNull(innerTupleSlot))
+ {
+ MJ_printf("ExecMergeJoin: **** inner tuple is nil ****\n");
+ return NULL;
+ }
- outerTupleSlot = ExecProcNode(outerPlan, (Plan *) node);
- if (TupIsNull(outerTupleSlot))
- {
- MJ_printf("ExecMergeJoin: **** outer tuple is nil ****\n");
- return NULL;
- }
-
- /* ----------------
- * store the inner and outer tuple in the merge state
- * ----------------
- */
- econtext->ecxt_innertuple = innerTupleSlot;
- econtext->ecxt_outertuple = outerTupleSlot;
-
- /* ----------------
- * set the marked tuple to nil
- * and initialize its tuple descriptor atttributes.
- * -jeff 10 july 1991
- * ----------------
- */
- ExecClearTuple(mergestate->mj_MarkedTupleSlot);
- mergestate->mj_MarkedTupleSlot->ttc_tupleDescriptor =
- innerTupleSlot->ttc_tupleDescriptor;
+ outerTupleSlot = ExecProcNode(outerPlan, (Plan *) node);
+ if (TupIsNull(outerTupleSlot))
+ {
+ MJ_printf("ExecMergeJoin: **** outer tuple is nil ****\n");
+ return NULL;
+ }
+
+ /* ----------------
+ * store the inner and outer tuple in the merge state
+ * ----------------
+ */
+ econtext->ecxt_innertuple = innerTupleSlot;
+ econtext->ecxt_outertuple = outerTupleSlot;
+
+ /* ----------------
+ * set the marked tuple to nil
+ * and initialize its tuple descriptor atttributes.
+ * -jeff 10 july 1991
+ * ----------------
+ */
+ ExecClearTuple(mergestate->mj_MarkedTupleSlot);
+ mergestate->mj_MarkedTupleSlot->ttc_tupleDescriptor =
+ innerTupleSlot->ttc_tupleDescriptor;
/*
mergestate->mj_MarkedTupleSlot->ttc_execTupDescriptor =
innerTupleSlot->ttc_execTupDescriptor;
*/
- /* ----------------
- * initialize merge join state to skip inner tuples.
- * ----------------
- */
- mergestate->mj_JoinState = EXEC_MJ_SKIPINNER;
- break;
-
- /*
- * ******************************** EXEC_MJ_JOINMARK means we
- * have just found a new outer tuple and a possible matching
- * inner tuple. This is the case after the INITIALIZE,
- * SKIPOUTER or SKIPINNER states. ********************************
- *
- */
- case EXEC_MJ_JOINMARK:
- MJ_printf("ExecMergeJoin: EXEC_MJ_JOINMARK\n");
- ExecMarkPos(innerPlan);
-
- innerTupleSlot = econtext->ecxt_innertuple;
- MarkInnerTuple(innerTupleSlot, mergestate);
-
- mergestate->mj_JoinState = EXEC_MJ_JOINTEST;
- break;
-
- /*
- * ******************************** EXEC_MJ_JOINTEST means we
- * have two tuples which might satisify the merge clause, so
- * we test them.
- *
- * If they do satisify, then we join them and move on to the next
- * inner tuple (EXEC_MJ_JOINTUPLES).
- *
- * If they do not satisify then advance to next outer tuple. ********************************
- *
- */
- case EXEC_MJ_JOINTEST:
- MJ_printf("ExecMergeJoin: EXEC_MJ_JOINTEST\n");
-
- qualResult = ExecQual((List *) mergeclauses, econtext);
- MJ_DEBUG_QUAL(mergeclauses, qualResult);
-
- if (qualResult)
- {
- mergestate->mj_JoinState = EXEC_MJ_JOINTUPLES;
- }
- else
- {
- mergestate->mj_JoinState = EXEC_MJ_NEXTOUTER;
- }
- break;
-
- /*
- * ******************************** EXEC_MJ_JOINTUPLES means
- * we have two tuples which satisified the merge clause so we
- * join them and then proceed to get the next inner tuple
- * (EXEC_NEXT_INNER). ********************************
- *
- */
- case EXEC_MJ_JOINTUPLES:
- MJ_printf("ExecMergeJoin: EXEC_MJ_JOINTUPLES\n");
- mergestate->mj_JoinState = EXEC_MJ_NEXTINNER;
-
- qualResult = ExecQual((List *) qual, econtext);
- MJ_DEBUG_QUAL(qual, qualResult);
-
- if (qualResult)
- {
/* ----------------
- * qualification succeeded. now form the desired
- * projection tuple and return the slot containing it.
+ * initialize merge join state to skip inner tuples.
* ----------------
*/
- ProjectionInfo *projInfo;
- TupleTableSlot *result;
- bool isDone;
-
- MJ_printf("ExecMergeJoin: **** returning tuple ****\n");
-
- projInfo = mergestate->jstate.cs_ProjInfo;
-
- result = ExecProject(projInfo, &isDone);
- mergestate->jstate.cs_TupFromTlist = !isDone;
- return result;
- }
- break;
-
- /*
- * ******************************** EXEC_MJ_NEXTINNER means
- * advance the inner scan to the next tuple. If the tuple is
- * not nil, we then proceed to test it against the join
- * qualification. ********************************
- *
- */
- case EXEC_MJ_NEXTINNER:
- MJ_printf("ExecMergeJoin: EXEC_MJ_NEXTINNER\n");
-
- /* ----------------
- * now we get the next inner tuple, if any
- * ----------------
- */
- innerTupleSlot = ExecProcNode(innerPlan, (Plan *) node);
- MJ_DEBUG_PROC_NODE(innerTupleSlot);
- econtext->ecxt_innertuple = innerTupleSlot;
-
- if (TupIsNull(innerTupleSlot))
- {
- mergestate->mj_JoinState = EXEC_MJ_NEXTOUTER;
- }
- else
- {
- mergestate->mj_JoinState = EXEC_MJ_JOINTEST;
- }
- break;
-
- /*
- * ******************************** EXEC_MJ_NEXTOUTER means
- *
- * outer inner outer tuple - 5 5 - marked tuple 5 5 6
- * 6 - inner tuple 7 7
- *
- * we know we just bumped into the first inner tuple > current
- * outer tuple so get a new outer tuple and then proceed to
- * test it against the marked tuple (EXEC_MJ_TESTOUTER) ********************************
- *
- */
- case EXEC_MJ_NEXTOUTER:
- MJ_printf("ExecMergeJoin: EXEC_MJ_NEXTOUTER\n");
-
- outerTupleSlot = ExecProcNode(outerPlan, (Plan *) node);
- MJ_DEBUG_PROC_NODE(outerTupleSlot);
- econtext->ecxt_outertuple = outerTupleSlot;
-
- /* ----------------
- * if the outer tuple is null then we know
- * we are done with the join
- * ----------------
- */
- if (TupIsNull(outerTupleSlot))
- {
- MJ_printf("ExecMergeJoin: **** outer tuple is nil ****\n");
- CleanUpSort(node->join.lefttree->lefttree);
- CleanUpSort(node->join.righttree->lefttree);
- return NULL;
- }
-
- mergestate->mj_JoinState = EXEC_MJ_TESTOUTER;
- break;
-
- /*
- * ******************************** EXEC_MJ_TESTOUTER If the
- * new outer tuple and the marked tuple satisify the merge
- * clause then we know we have duplicates in the outer scan so
- * we have to restore the inner scan to the marked tuple and
- * proceed to join the new outer tuples with the inner tuples
- * (EXEC_MJ_JOINTEST)
- *
- * This is the case when
- *
- * outer inner 4 5 - marked tuple outer tuple - 5 5 new
- * outer tuple - 5 5 6 8 - inner tuple 7 12
- *
- * new outer tuple = marked tuple
- *
- * If the outer tuple fails the test, then we know we have to
- * proceed to skip outer tuples until outer >= inner
- * (EXEC_MJ_SKIPOUTER).
- *
- * This is the case when
- *
- * outer inner 5 5 - marked tuple outer tuple - 5 5 new
- * outer tuple - 6 8 - inner tuple 7 12
- *
- * new outer tuple > marked tuple
- *
- ********************************
- *
- */
- case EXEC_MJ_TESTOUTER:
- MJ_printf("ExecMergeJoin: EXEC_MJ_TESTOUTER\n");
-
- /* ----------------
- * here we compare the outer tuple with the marked inner tuple
- * by using the marked tuple in place of the inner tuple.
- * ----------------
- */
- innerTupleSlot = econtext->ecxt_innertuple;
- markedTupleSlot = mergestate->mj_MarkedTupleSlot;
- econtext->ecxt_innertuple = markedTupleSlot;
-
- qualResult = ExecQual((List *) mergeclauses, econtext);
- MJ_DEBUG_QUAL(mergeclauses, qualResult);
-
- if (qualResult)
- {
- /* ----------------
- * the merge clause matched so now we juggle the slots
- * back the way they were and proceed to JOINTEST.
- * ----------------
+ mergestate->mj_JoinState = EXEC_MJ_SKIPINNER;
+ break;
+
+ /*
+ * ******************************** EXEC_MJ_JOINMARK means
+ * we have just found a new outer tuple and a possible
+ * matching inner tuple. This is the case after the
+ * INITIALIZE, SKIPOUTER or SKIPINNER states. ********************************
+ *
*/
- econtext->ecxt_innertuple = innerTupleSlot;
+ case EXEC_MJ_JOINMARK:
+ MJ_printf("ExecMergeJoin: EXEC_MJ_JOINMARK\n");
+ ExecMarkPos(innerPlan);
- RestoreInnerTuple(innerTupleSlot, markedTupleSlot);
+ innerTupleSlot = econtext->ecxt_innertuple;
+ MarkInnerTuple(innerTupleSlot, mergestate);
- ExecRestrPos(innerPlan);
mergestate->mj_JoinState = EXEC_MJ_JOINTEST;
+ break;
- }
- else
- {
- /* ----------------
- * if the inner tuple was nil and the new outer
- * tuple didn't match the marked outer tuple then
- * we may have the case:
+ /*
+ * ******************************** EXEC_MJ_JOINTEST means
+ * we have two tuples which might satisify the merge
+ * clause, so we test them.
*
- * outer inner
- * 4 4 - marked tuple
- * new outer - 5 4
- * 6 nil - inner tuple
- * 7
+ * If they do satisify, then we join them and move on to the
+ * next inner tuple (EXEC_MJ_JOINTUPLES).
+ *
+ * If they do not satisify then advance to next outer tuple. ********************************
*
- * which means that all subsequent outer tuples will be
- * larger than our inner tuples.
- * ----------------
*/
- if (TupIsNull(innerTupleSlot))
+ case EXEC_MJ_JOINTEST:
+ MJ_printf("ExecMergeJoin: EXEC_MJ_JOINTEST\n");
+
+ qualResult = ExecQual((List *) mergeclauses, econtext);
+ MJ_DEBUG_QUAL(mergeclauses, qualResult);
+
+ if (qualResult)
{
- MJ_printf("ExecMergeJoin: **** wierd case 1 ****\n");
- return NULL;
+ mergestate->mj_JoinState = EXEC_MJ_JOINTUPLES;
+ }
+ else
+ {
+ mergestate->mj_JoinState = EXEC_MJ_NEXTOUTER;
+ }
+ break;
+
+ /*
+ * ******************************** EXEC_MJ_JOINTUPLES
+ * means we have two tuples which satisified the merge
+ * clause so we join them and then proceed to get the next
+ * inner tuple (EXEC_NEXT_INNER). ********************************
+ *
+ */
+ case EXEC_MJ_JOINTUPLES:
+ MJ_printf("ExecMergeJoin: EXEC_MJ_JOINTUPLES\n");
+ mergestate->mj_JoinState = EXEC_MJ_NEXTINNER;
+
+ qualResult = ExecQual((List *) qual, econtext);
+ MJ_DEBUG_QUAL(qual, qualResult);
+
+ if (qualResult)
+ {
+ /* ----------------
+ * qualification succeeded. now form the desired
+ * projection tuple and return the slot containing it.
+ * ----------------
+ */
+ ProjectionInfo *projInfo;
+ TupleTableSlot *result;
+ bool isDone;
+
+ MJ_printf("ExecMergeJoin: **** returning tuple ****\n");
+
+ projInfo = mergestate->jstate.cs_ProjInfo;
+
+ result = ExecProject(projInfo, &isDone);
+ mergestate->jstate.cs_TupFromTlist = !isDone;
+ return result;
}
+ break;
+
+ /*
+ * ******************************** EXEC_MJ_NEXTINNER
+ * means advance the inner scan to the next tuple. If the
+ * tuple is not nil, we then proceed to test it against
+ * the join qualification. ********************************
+ *
+ */
+ case EXEC_MJ_NEXTINNER:
+ MJ_printf("ExecMergeJoin: EXEC_MJ_NEXTINNER\n");
/* ----------------
- * restore the inner tuple and continue on to
- * skip outer tuples.
+ * now we get the next inner tuple, if any
* ----------------
*/
+ innerTupleSlot = ExecProcNode(innerPlan, (Plan *) node);
+ MJ_DEBUG_PROC_NODE(innerTupleSlot);
econtext->ecxt_innertuple = innerTupleSlot;
- mergestate->mj_JoinState = EXEC_MJ_SKIPOUTER;
- }
- break;
-
- /*
- * ******************************** EXEC_MJ_SKIPOUTER means
- * skip over tuples in the outer plan until we find an outer
- * tuple > current inner tuple.
- *
- * For example:
- *
- * outer inner 5 5 5 5 outer tuple - 6 8 - inner
- * tuple 7 12 8 14
- *
- * we have to advance the outer scan until we find the outer 8.
- *
- ********************************
- *
- */
- case EXEC_MJ_SKIPOUTER:
- MJ_printf("ExecMergeJoin: EXEC_MJ_SKIPOUTER\n");
- /* ----------------
- * before we advance, make sure the current tuples
- * do not satisify the mergeclauses. If they do, then
- * we update the marked tuple and go join them.
- * ----------------
- */
- qualResult = ExecQual((List *) mergeclauses, econtext);
- MJ_DEBUG_QUAL(mergeclauses, qualResult);
-
- if (qualResult)
- {
- ExecMarkPos(innerPlan);
- innerTupleSlot = econtext->ecxt_innertuple;
- MarkInnerTuple(innerTupleSlot, mergestate);
-
- mergestate->mj_JoinState = EXEC_MJ_JOINTUPLES;
+ if (TupIsNull(innerTupleSlot))
+ {
+ mergestate->mj_JoinState = EXEC_MJ_NEXTOUTER;
+ }
+ else
+ {
+ mergestate->mj_JoinState = EXEC_MJ_JOINTEST;
+ }
break;
- }
-
- /* ----------------
- * ok, now test the skip qualification
- * ----------------
- */
- compareResult = MergeCompare(mergeclauses,
- outerSkipQual,
- econtext);
-
- MJ_DEBUG_MERGE_COMPARE(outerSkipQual, compareResult);
-
- /* ----------------
- * compareResult is true as long as we should
- * continue skipping tuples.
- * ----------------
- */
- if (compareResult)
- {
+
+ /*
+ * ******************************** EXEC_MJ_NEXTOUTER
+ * means
+ *
+ * outer inner outer tuple - 5 5 - marked tuple 5 5
+ * 6 6 - inner tuple 7 7
+ *
+ * we know we just bumped into the first inner tuple >
+ * current outer tuple so get a new outer tuple and then
+ * proceed to test it against the marked tuple
+ * (EXEC_MJ_TESTOUTER) ********************************
+ *
+ */
+ case EXEC_MJ_NEXTOUTER:
+ MJ_printf("ExecMergeJoin: EXEC_MJ_NEXTOUTER\n");
outerTupleSlot = ExecProcNode(outerPlan, (Plan *) node);
MJ_DEBUG_PROC_NODE(outerTupleSlot);
@@ -878,169 +714,342 @@ ExecMergeJoin(MergeJoin * node)
*/
if (TupIsNull(outerTupleSlot))
{
- MJ_printf("ExecMergeJoin: **** outerTuple is nil ****\n");
+ MJ_printf("ExecMergeJoin: **** outer tuple is nil ****\n");
+ CleanUpSort(node->join.lefttree->lefttree);
+ CleanUpSort(node->join.righttree->lefttree);
return NULL;
}
+
+ mergestate->mj_JoinState = EXEC_MJ_TESTOUTER;
+ break;
+
+ /*
+ * ******************************** EXEC_MJ_TESTOUTER If
+ * the new outer tuple and the marked tuple satisify the
+ * merge clause then we know we have duplicates in the
+ * outer scan so we have to restore the inner scan to the
+ * marked tuple and proceed to join the new outer tuples
+ * with the inner tuples (EXEC_MJ_JOINTEST)
+ *
+ * This is the case when
+ *
+ * outer inner 4 5 - marked tuple outer tuple - 5 5
+ * new outer tuple - 5 5 6 8 - inner tuple 7
+ * 12
+ *
+ * new outer tuple = marked tuple
+ *
+ * If the outer tuple fails the test, then we know we have to
+ * proceed to skip outer tuples until outer >= inner
+ * (EXEC_MJ_SKIPOUTER).
+ *
+ * This is the case when
+ *
+ * outer inner 5 5 - marked tuple outer tuple - 5 5
+ * new outer tuple - 6 8 - inner tuple 7 12
+ *
+ * new outer tuple > marked tuple
+ *
+ *******************************
+ *
+ *
+ */
+ case EXEC_MJ_TESTOUTER:
+ MJ_printf("ExecMergeJoin: EXEC_MJ_TESTOUTER\n");
+
/* ----------------
- * otherwise test the new tuple against the skip qual.
- * (we remain in the EXEC_MJ_SKIPOUTER state)
+ * here we compare the outer tuple with the marked inner tuple
+ * by using the marked tuple in place of the inner tuple.
* ----------------
*/
- break;
- }
-
- /* ----------------
- * now check the inner skip qual to see if we
- * should now skip inner tuples... if we fail the
- * inner skip qual, then we know we have a new pair
- * of matching tuples.
- * ----------------
- */
- compareResult = MergeCompare(mergeclauses,
- innerSkipQual,
- econtext);
-
- MJ_DEBUG_MERGE_COMPARE(innerSkipQual, compareResult);
-
- if (compareResult)
- {
- mergestate->mj_JoinState = EXEC_MJ_SKIPINNER;
- }
- else
- {
- mergestate->mj_JoinState = EXEC_MJ_JOINMARK;
- }
- break;
-
- /*
- * ******************************** EXEC_MJ_SKIPINNER means
- * skip over tuples in the inner plan until we find an inner
- * tuple > current outer tuple.
- *
- * For example:
- *
- * outer inner 5 5 5 5 outer tuple - 12 8 - inner
- * tuple 14 10 17 12
- *
- * we have to advance the inner scan until we find the inner 12.
- *
- ********************************
- *
- */
- case EXEC_MJ_SKIPINNER:
- MJ_printf("ExecMergeJoin: EXEC_MJ_SKIPINNER\n");
- /* ----------------
- * before we advance, make sure the current tuples
- * do not satisify the mergeclauses. If they do, then
- * we update the marked tuple and go join them.
- * ----------------
- */
- qualResult = ExecQual((List *) mergeclauses, econtext);
- MJ_DEBUG_QUAL(mergeclauses, qualResult);
-
- if (qualResult)
- {
- ExecMarkPos(innerPlan);
innerTupleSlot = econtext->ecxt_innertuple;
+ markedTupleSlot = mergestate->mj_MarkedTupleSlot;
+ econtext->ecxt_innertuple = markedTupleSlot;
- MarkInnerTuple(innerTupleSlot, mergestate);
+ qualResult = ExecQual((List *) mergeclauses, econtext);
+ MJ_DEBUG_QUAL(mergeclauses, qualResult);
+
+ if (qualResult)
+ {
+ /* ----------------
+ * the merge clause matched so now we juggle the slots
+ * back the way they were and proceed to JOINTEST.
+ * ----------------
+ */
+ econtext->ecxt_innertuple = innerTupleSlot;
+
+ RestoreInnerTuple(innerTupleSlot, markedTupleSlot);
- mergestate->mj_JoinState = EXEC_MJ_JOINTUPLES;
+ ExecRestrPos(innerPlan);
+ mergestate->mj_JoinState = EXEC_MJ_JOINTEST;
+
+ }
+ else
+ {
+ /* ----------------
+ * if the inner tuple was nil and the new outer
+ * tuple didn't match the marked outer tuple then
+ * we may have the case:
+ *
+ * outer inner
+ * 4 4 - marked tuple
+ * new outer - 5 4
+ * 6 nil - inner tuple
+ * 7
+ *
+ * which means that all subsequent outer tuples will be
+ * larger than our inner tuples.
+ * ----------------
+ */
+ if (TupIsNull(innerTupleSlot))
+ {
+ MJ_printf("ExecMergeJoin: **** wierd case 1 ****\n");
+ return NULL;
+ }
+
+ /* ----------------
+ * restore the inner tuple and continue on to
+ * skip outer tuples.
+ * ----------------
+ */
+ econtext->ecxt_innertuple = innerTupleSlot;
+ mergestate->mj_JoinState = EXEC_MJ_SKIPOUTER;
+ }
break;
- }
-
- /* ----------------
- * ok, now test the skip qualification
- * ----------------
- */
- compareResult = MergeCompare(mergeclauses,
- innerSkipQual,
- econtext);
-
- MJ_DEBUG_MERGE_COMPARE(innerSkipQual, compareResult);
-
- /* ----------------
- * compareResult is true as long as we should
- * continue skipping tuples.
- * ----------------
- */
- if (compareResult)
- {
+
+ /*
+ * ******************************** EXEC_MJ_SKIPOUTER
+ * means skip over tuples in the outer plan until we find
+ * an outer tuple > current inner tuple.
+ *
+ * For example:
+ *
+ * outer inner 5 5 5 5 outer tuple - 6 8 -
+ * inner tuple 7 12 8 14
+ *
+ * we have to advance the outer scan until we find the outer
+ * 8.
+ *
+ *******************************
+ *
+ *
+ */
+ case EXEC_MJ_SKIPOUTER:
+ MJ_printf("ExecMergeJoin: EXEC_MJ_SKIPOUTER\n");
/* ----------------
- * now try and get a new inner tuple
+ * before we advance, make sure the current tuples
+ * do not satisify the mergeclauses. If they do, then
+ * we update the marked tuple and go join them.
* ----------------
*/
- innerTupleSlot = ExecProcNode(innerPlan, (Plan *) node);
- MJ_DEBUG_PROC_NODE(innerTupleSlot);
- econtext->ecxt_innertuple = innerTupleSlot;
+ qualResult = ExecQual((List *) mergeclauses, econtext);
+ MJ_DEBUG_QUAL(mergeclauses, qualResult);
+
+ if (qualResult)
+ {
+ ExecMarkPos(innerPlan);
+ innerTupleSlot = econtext->ecxt_innertuple;
+
+ MarkInnerTuple(innerTupleSlot, mergestate);
+
+ mergestate->mj_JoinState = EXEC_MJ_JOINTUPLES;
+ break;
+ }
/* ----------------
- * if the inner tuple is null then we know
- * we have to restore the inner scan
- * and advance to the next outer tuple
+ * ok, now test the skip qualification
* ----------------
*/
- if (TupIsNull(innerTupleSlot))
+ compareResult = MergeCompare(mergeclauses,
+ outerSkipQual,
+ econtext);
+
+ MJ_DEBUG_MERGE_COMPARE(outerSkipQual, compareResult);
+
+ /* ----------------
+ * compareResult is true as long as we should
+ * continue skipping tuples.
+ * ----------------
+ */
+ if (compareResult)
{
+
+ outerTupleSlot = ExecProcNode(outerPlan, (Plan *) node);
+ MJ_DEBUG_PROC_NODE(outerTupleSlot);
+ econtext->ecxt_outertuple = outerTupleSlot;
+
/* ----------------
- * this is an interesting case.. all our
- * inner tuples are smaller then our outer
- * tuples so we never found an inner tuple
- * to mark.
- *
- * outer inner
- * outer tuple - 5 4
- * 5 4
- * 6 nil - inner tuple
- * 7
- *
- * This means the join should end.
+ * if the outer tuple is null then we know
+ * we are done with the join
* ----------------
*/
- MJ_printf("ExecMergeJoin: **** wierd case 2 ****\n");
- return NULL;
+ if (TupIsNull(outerTupleSlot))
+ {
+ MJ_printf("ExecMergeJoin: **** outerTuple is nil ****\n");
+ return NULL;
+ }
+ /* ----------------
+ * otherwise test the new tuple against the skip qual.
+ * (we remain in the EXEC_MJ_SKIPOUTER state)
+ * ----------------
+ */
+ break;
}
/* ----------------
- * otherwise test the new tuple against the skip qual.
- * (we remain in the EXEC_MJ_SKIPINNER state)
+ * now check the inner skip qual to see if we
+ * should now skip inner tuples... if we fail the
+ * inner skip qual, then we know we have a new pair
+ * of matching tuples.
* ----------------
*/
+ compareResult = MergeCompare(mergeclauses,
+ innerSkipQual,
+ econtext);
+
+ MJ_DEBUG_MERGE_COMPARE(innerSkipQual, compareResult);
+
+ if (compareResult)
+ {
+ mergestate->mj_JoinState = EXEC_MJ_SKIPINNER;
+ }
+ else
+ {
+ mergestate->mj_JoinState = EXEC_MJ_JOINMARK;
+ }
break;
- }
-
- /* ----------------
- * compare finally failed and we have stopped skipping
- * inner tuples so now check the outer skip qual
- * to see if we should now skip outer tuples...
- * ----------------
- */
- compareResult = MergeCompare(mergeclauses,
- outerSkipQual,
- econtext);
-
- MJ_DEBUG_MERGE_COMPARE(outerSkipQual, compareResult);
-
- if (compareResult)
- {
- mergestate->mj_JoinState = EXEC_MJ_SKIPOUTER;
- }
- else
- {
- mergestate->mj_JoinState = EXEC_MJ_JOINMARK;
- }
-
- break;
-
- /*
- * ******************************** if we get here it means
- * our code is fucked up and so we just end the join
- * prematurely. ********************************
- *
- */
- default:
- elog(NOTICE, "ExecMergeJoin: invalid join state. aborting");
- return NULL;
+
+ /*
+ * ******************************** EXEC_MJ_SKIPINNER
+ * means skip over tuples in the inner plan until we find
+ * an inner tuple > current outer tuple.
+ *
+ * For example:
+ *
+ * outer inner 5 5 5 5 outer tuple - 12 8 - inner
+ * tuple 14 10 17 12
+ *
+ * we have to advance the inner scan until we find the inner
+ * 12.
+ *
+ *******************************
+ *
+ *
+ */
+ case EXEC_MJ_SKIPINNER:
+ MJ_printf("ExecMergeJoin: EXEC_MJ_SKIPINNER\n");
+ /* ----------------
+ * before we advance, make sure the current tuples
+ * do not satisify the mergeclauses. If they do, then
+ * we update the marked tuple and go join them.
+ * ----------------
+ */
+ qualResult = ExecQual((List *) mergeclauses, econtext);
+ MJ_DEBUG_QUAL(mergeclauses, qualResult);
+
+ if (qualResult)
+ {
+ ExecMarkPos(innerPlan);
+ innerTupleSlot = econtext->ecxt_innertuple;
+
+ MarkInnerTuple(innerTupleSlot, mergestate);
+
+ mergestate->mj_JoinState = EXEC_MJ_JOINTUPLES;
+ break;
+ }
+
+ /* ----------------
+ * ok, now test the skip qualification
+ * ----------------
+ */
+ compareResult = MergeCompare(mergeclauses,
+ innerSkipQual,
+ econtext);
+
+ MJ_DEBUG_MERGE_COMPARE(innerSkipQual, compareResult);
+
+ /* ----------------
+ * compareResult is true as long as we should
+ * continue skipping tuples.
+ * ----------------
+ */
+ if (compareResult)
+ {
+ /* ----------------
+ * now try and get a new inner tuple
+ * ----------------
+ */
+ innerTupleSlot = ExecProcNode(innerPlan, (Plan *) node);
+ MJ_DEBUG_PROC_NODE(innerTupleSlot);
+ econtext->ecxt_innertuple = innerTupleSlot;
+
+ /* ----------------
+ * if the inner tuple is null then we know
+ * we have to restore the inner scan
+ * and advance to the next outer tuple
+ * ----------------
+ */
+ if (TupIsNull(innerTupleSlot))
+ {
+ /* ----------------
+ * this is an interesting case.. all our
+ * inner tuples are smaller then our outer
+ * tuples so we never found an inner tuple
+ * to mark.
+ *
+ * outer inner
+ * outer tuple - 5 4
+ * 5 4
+ * 6 nil - inner tuple
+ * 7
+ *
+ * This means the join should end.
+ * ----------------
+ */
+ MJ_printf("ExecMergeJoin: **** wierd case 2 ****\n");
+ return NULL;
+ }
+
+ /* ----------------
+ * otherwise test the new tuple against the skip qual.
+ * (we remain in the EXEC_MJ_SKIPINNER state)
+ * ----------------
+ */
+ break;
+ }
+
+ /* ----------------
+ * compare finally failed and we have stopped skipping
+ * inner tuples so now check the outer skip qual
+ * to see if we should now skip outer tuples...
+ * ----------------
+ */
+ compareResult = MergeCompare(mergeclauses,
+ outerSkipQual,
+ econtext);
+
+ MJ_DEBUG_MERGE_COMPARE(outerSkipQual, compareResult);
+
+ if (compareResult)
+ {
+ mergestate->mj_JoinState = EXEC_MJ_SKIPOUTER;
+ }
+ else
+ {
+ mergestate->mj_JoinState = EXEC_MJ_JOINMARK;
+ }
+
+ break;
+
+ /*
+ * ******************************** if we get here it
+ * means our code is fucked up and so we just end the join
+ * prematurely. ********************************
+ *
+ */
+ default:
+ elog(NOTICE, "ExecMergeJoin: invalid join state. aborting");
+ return NULL;
}
}
}
@@ -1057,13 +1066,13 @@ bool
ExecInitMergeJoin(MergeJoin * node, EState * estate, Plan * parent)
{
MergeJoinState *mergestate;
- List *joinclauses;
- RegProcedure rightsortop;
- RegProcedure leftsortop;
- RegProcedure sortop;
+ List *joinclauses;
+ RegProcedure rightsortop;
+ RegProcedure leftsortop;
+ RegProcedure sortop;
- List *OSortopI;
- List *ISortopO;
+ List *OSortopI;
+ List *ISortopO;
MJ1_printf("ExecInitMergeJoin: %s\n",
"initializing node");
diff --git a/src/backend/executor/nodeNestloop.c b/src/backend/executor/nodeNestloop.c
index e7cba2e756e..d8d5f38d6db 100644
--- a/src/backend/executor/nodeNestloop.c
+++ b/src/backend/executor/nodeNestloop.c
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/executor/nodeNestloop.c,v 1.4 1997/09/07 04:41:41 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/executor/nodeNestloop.c,v 1.5 1997/09/08 02:22:48 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -57,17 +57,17 @@
TupleTableSlot *
ExecNestLoop(NestLoop * node, Plan * parent)
{
- NestLoopState *nlstate;
- Plan *innerPlan;
- Plan *outerPlan;
- bool needNewOuterTuple;
+ NestLoopState *nlstate;
+ Plan *innerPlan;
+ Plan *outerPlan;
+ bool needNewOuterTuple;
TupleTableSlot *outerTupleSlot;
TupleTableSlot *innerTupleSlot;
- List *qual;
- bool qualResult;
- ExprContext *econtext;
+ List *qual;
+ bool qualResult;
+ ExprContext *econtext;
/* ----------------
* get information from the node
@@ -86,7 +86,7 @@ ExecNestLoop(NestLoop * node, Plan * parent)
*/
econtext = nlstate->jstate.cs_ExprContext;
- /* ---------------- * get the current outer tuple
+ /* ---------------- * get the current outer tuple
* ----------------
*/
outerTupleSlot = nlstate->jstate.cs_OuterTupleSlot;
@@ -101,7 +101,7 @@ ExecNestLoop(NestLoop * node, Plan * parent)
if (nlstate->jstate.cs_TupFromTlist)
{
TupleTableSlot *result;
- bool isDone;
+ bool isDone;
result = ExecProject(nlstate->jstate.cs_ProjInfo, &isDone);
if (!isDone)
@@ -238,7 +238,7 @@ ExecNestLoop(NestLoop * node, Plan * parent)
*/
ProjectionInfo *projInfo;
TupleTableSlot *result;
- bool isDone;
+ bool isDone;
ENL1_printf("qualification succeeded, projecting tuple");
@@ -267,7 +267,7 @@ ExecNestLoop(NestLoop * node, Plan * parent)
bool
ExecInitNestLoop(NestLoop * node, EState * estate, Plan * parent)
{
- NestLoopState *nlstate;
+ NestLoopState *nlstate;
NL1_printf("ExecInitNestLoop: %s\n",
"initializing node");
@@ -347,7 +347,7 @@ ExecCountSlotsNestLoop(NestLoop * node)
void
ExecEndNestLoop(NestLoop * node)
{
- NestLoopState *nlstate;
+ NestLoopState *nlstate;
NL1_printf("ExecEndNestLoop: %s\n",
"ending node processing");
diff --git a/src/backend/executor/nodeResult.c b/src/backend/executor/nodeResult.c
index 743bd73f2b3..4e0e62ddfe2 100644
--- a/src/backend/executor/nodeResult.c
+++ b/src/backend/executor/nodeResult.c
@@ -27,7 +27,7 @@
* SeqScan (emp.all)
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/executor/nodeResult.c,v 1.3 1997/09/07 04:41:42 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/executor/nodeResult.c,v 1.4 1997/09/08 02:22:49 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -53,14 +53,14 @@
TupleTableSlot *
ExecResult(Result * node)
{
- ResultState *resstate;
+ ResultState *resstate;
TupleTableSlot *outerTupleSlot;
TupleTableSlot *resultSlot;
- Plan *outerPlan;
- ExprContext *econtext;
- Node *qual;
- bool qualResult;
- bool isDone;
+ Plan *outerPlan;
+ ExprContext *econtext;
+ Node *qual;
+ bool qualResult;
+ bool isDone;
ProjectionInfo *projInfo;
/* ----------------
@@ -191,7 +191,7 @@ ExecResult(Result * node)
bool
ExecInitResult(Result * node, EState * estate, Plan * parent)
{
- ResultState *resstate;
+ ResultState *resstate;
/* ----------------
* assign execution state to node
@@ -267,7 +267,7 @@ ExecCountSlotsResult(Result * node)
void
ExecEndResult(Result * node)
{
- ResultState *resstate;
+ ResultState *resstate;
resstate = node->resstate;
diff --git a/src/backend/executor/nodeSeqscan.c b/src/backend/executor/nodeSeqscan.c
index d3451f8026f..1d04360c9d2 100644
--- a/src/backend/executor/nodeSeqscan.c
+++ b/src/backend/executor/nodeSeqscan.c
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/executor/nodeSeqscan.c,v 1.5 1997/09/07 04:41:44 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/executor/nodeSeqscan.c,v 1.6 1997/09/08 02:22:50 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -49,13 +49,13 @@ static TupleTableSlot *SeqNext(SeqScan * node);
static TupleTableSlot *
SeqNext(SeqScan * node)
{
- HeapTuple tuple;
- HeapScanDesc scandesc;
+ HeapTuple tuple;
+ HeapScanDesc scandesc;
CommonScanState *scanstate;
- EState *estate;
- ScanDirection direction;
+ EState *estate;
+ ScanDirection direction;
TupleTableSlot *slot;
- Buffer buffer;
+ Buffer buffer;
/* ----------------
* get information from the estate and scan state
@@ -118,7 +118,7 @@ TupleTableSlot *
ExecSeqScan(SeqScan * node)
{
TupleTableSlot *slot;
- Plan *outerPlan;
+ Plan *outerPlan;
S_printf("ExecSeqScan: scanning node: ");
S_nodeDisplay(node);
@@ -150,19 +150,19 @@ ExecSeqScan(SeqScan * node)
* subplans of scans.
* ----------------------------------------------------------------
*/
-static Oid
+static Oid
InitScanRelation(SeqScan * node, EState * estate,
CommonScanState * scanstate, Plan * outerPlan)
{
- Index relid;
- List *rangeTable;
- RangeTblEntry *rtentry;
- Oid reloid;
- TimeQual timeQual;
- ScanDirection direction;
- Relation currentRelation;
- HeapScanDesc currentScanDesc;
- RelationInfo *resultRelationInfo;
+ Index relid;
+ List *rangeTable;
+ RangeTblEntry *rtentry;
+ Oid reloid;
+ TimeQual timeQual;
+ ScanDirection direction;
+ Relation currentRelation;
+ HeapScanDesc currentScanDesc;
+ RelationInfo *resultRelationInfo;
if (outerPlan == NULL)
{
@@ -239,9 +239,9 @@ bool
ExecInitSeqScan(SeqScan * node, EState * estate, Plan * parent)
{
CommonScanState *scanstate;
- Plan *outerPlan;
- Oid reloid;
- HeapScanDesc scandesc;
+ Plan *outerPlan;
+ Oid reloid;
+ HeapScanDesc scandesc;
/* ----------------
* assign the node's execution state
@@ -315,7 +315,7 @@ void
ExecEndSeqScan(SeqScan * node)
{
CommonScanState *scanstate;
- Plan *outerPlan;
+ Plan *outerPlan;
/* ----------------
* get information from node
@@ -369,11 +369,11 @@ void
ExecSeqReScan(SeqScan * node, ExprContext * exprCtxt, Plan * parent)
{
CommonScanState *scanstate;
- EState *estate;
- Plan *outerPlan;
- Relation rdesc;
- HeapScanDesc sdesc;
- ScanDirection direction;
+ EState *estate;
+ Plan *outerPlan;
+ Relation rdesc;
+ HeapScanDesc sdesc;
+ ScanDirection direction;
scanstate = node->scanstate;
estate = node->plan.state;
@@ -406,8 +406,8 @@ void
ExecSeqMarkPos(SeqScan * node)
{
CommonScanState *scanstate;
- Plan *outerPlan;
- HeapScanDesc sdesc;
+ Plan *outerPlan;
+ HeapScanDesc sdesc;
scanstate = node->scanstate;
@@ -445,8 +445,8 @@ void
ExecSeqRestrPos(SeqScan * node)
{
CommonScanState *scanstate;
- Plan *outerPlan;
- HeapScanDesc sdesc;
+ Plan *outerPlan;
+ HeapScanDesc sdesc;
scanstate = node->scanstate;
diff --git a/src/backend/executor/nodeSort.c b/src/backend/executor/nodeSort.c
index eb2e2e7b180..64f56bc99a7 100644
--- a/src/backend/executor/nodeSort.c
+++ b/src/backend/executor/nodeSort.c
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/executor/nodeSort.c,v 1.7 1997/09/07 04:41:45 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/executor/nodeSort.c,v 1.8 1997/09/08 02:22:50 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -32,17 +32,17 @@
* Returns an array of ScanKeyData.
* ----------------------------------------------------------------
*/
-static ScanKey
+static ScanKey
FormSortKeys(Sort * sortnode)
{
- ScanKey sortkeys;
- List *targetList;
- List *tl;
- int keycount;
- Resdom *resdom;
- AttrNumber resno;
- Index reskey;
- Oid reskeyop;
+ ScanKey sortkeys;
+ List *targetList;
+ List *tl;
+ int keycount;
+ Resdom *resdom;
+ AttrNumber resno;
+ Index reskey;
+ Oid reskeyop;
/* ----------------
* get information from the node
@@ -65,7 +65,7 @@ FormSortKeys(Sort * sortnode)
*/
foreach(tl, targetList)
{
- TargetEntry *target = (TargetEntry *) lfirst(tl);
+ TargetEntry *target = (TargetEntry *) lfirst(tl);
resdom = target->resdom;
resno = resdom->resno;
@@ -104,13 +104,13 @@ FormSortKeys(Sort * sortnode)
TupleTableSlot *
ExecSort(Sort * node)
{
- EState *estate;
- SortState *sortstate;
- Plan *outerNode;
- ScanDirection dir;
- int keycount;
- ScanKey sortkeys;
- HeapTuple heapTuple;
+ EState *estate;
+ SortState *sortstate;
+ Plan *outerNode;
+ ScanDirection dir;
+ int keycount;
+ ScanKey sortkeys;
+ HeapTuple heapTuple;
TupleTableSlot *slot;
/* ----------------
@@ -231,9 +231,9 @@ ExecSort(Sort * node)
bool
ExecInitSort(Sort * node, EState * estate, Plan * parent)
{
- SortState *sortstate;
- Plan *outerPlan;
- ScanKey sortkeys;
+ SortState *sortstate;
+ Plan *outerPlan;
+ ScanKey sortkeys;
SO1_printf("ExecInitSort: %s\n",
"initializing sort node");
@@ -330,8 +330,8 @@ ExecCountSlotsSort(Sort * node)
void
ExecEndSort(Sort * node)
{
- SortState *sortstate;
- Plan *outerPlan;
+ SortState *sortstate;
+ Plan *outerPlan;
/* ----------------
* get info from the sort state
@@ -371,7 +371,7 @@ ExecEndSort(Sort * node)
void
ExecSortMarkPos(Sort * node)
{
- SortState *sortstate;
+ SortState *sortstate;
/* ----------------
* if we haven't sorted yet, just return
@@ -395,7 +395,7 @@ ExecSortMarkPos(Sort * node)
void
ExecSortRestrPos(Sort * node)
{
- SortState *sortstate;
+ SortState *sortstate;
/* ----------------
* if we haven't sorted yet, just return.
diff --git a/src/backend/executor/nodeTee.c b/src/backend/executor/nodeTee.c
index 8a1e233125a..e3ddfe39d66 100644
--- a/src/backend/executor/nodeTee.c
+++ b/src/backend/executor/nodeTee.c
@@ -15,7 +15,7 @@
* ExecEndTee
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/executor/Attic/nodeTee.c,v 1.7 1997/09/07 04:41:46 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/executor/Attic/nodeTee.c,v 1.8 1997/09/08 02:22:51 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -47,12 +47,12 @@
bool
ExecInitTee(Tee * node, EState * currentEstate, Plan * parent)
{
- TeeState *teeState;
- Plan *outerPlan;
- int len;
- Relation bufferRel;
- TupleDesc tupType;
- EState *estate;
+ TeeState *teeState;
+ Plan *outerPlan;
+ int len;
+ Relation bufferRel;
+ TupleDesc tupType;
+ EState *estate;
/*
* it is possible that the Tee has already been initialized since it
@@ -154,7 +154,7 @@ ExecInitTee(Tee * node, EState * currentEstate, Plan * parent)
if (node->teeTableName[0] != '\0')
{
- Relation r;
+ Relation r;
teeState->tee_bufferRelname = pstrdup(node->teeTableName);
@@ -168,7 +168,7 @@ ExecInitTee(Tee * node, EState * currentEstate, Plan * parent)
bufferRel = heap_openr(teeState->tee_bufferRelname);
else
bufferRel = heap_open(heap_create(teeState->tee_bufferRelname,
- /*FIX */ NULL,
+ /* FIX */ NULL,
'n',
DEFAULT_SMGR,
tupType));
@@ -232,10 +232,10 @@ ExecCountSlotsTee(Tee * node)
static void
initTeeScanDescs(Tee * node)
{
- TeeState *teeState;
- Relation bufferRel;
- ScanDirection dir;
- MemoryContext orig;
+ TeeState *teeState;
+ Relation bufferRel;
+ ScanDirection dir;
+ MemoryContext orig;
teeState = node->teestate;
if (teeState->tee_leftScanDesc && teeState->tee_rightScanDesc)
@@ -292,20 +292,20 @@ initTeeScanDescs(Tee * node)
TupleTableSlot *
ExecTee(Tee * node, Plan * parent)
{
- EState *estate;
- TeeState *teeState;
- int leftPlace,
- rightPlace,
- lastPlace;
- int branch;
+ EState *estate;
+ TeeState *teeState;
+ int leftPlace,
+ rightPlace,
+ lastPlace;
+ int branch;
TupleTableSlot *result;
TupleTableSlot *slot;
- Plan *childNode;
- ScanDirection dir;
- HeapTuple heapTuple;
- Relation bufferRel;
- HeapScanDesc scanDesc;
- Buffer buffer;
+ Plan *childNode;
+ ScanDirection dir;
+ HeapTuple heapTuple;
+ Relation bufferRel;
+ HeapScanDesc scanDesc;
+ Buffer buffer;
estate = ((Plan *) node)->state;
teeState = node->teestate;
@@ -369,7 +369,7 @@ ExecTee(Tee * node, Plan * parent)
* move the scandesc forward so we don't re-read this
* tuple later
*/
- HeapTuple throwAway;
+ HeapTuple throwAway;
/* Buffer buffer; */
throwAway = heap_getnext(scanDesc,
@@ -446,9 +446,9 @@ void
ExecTeeReScan(Tee * node, ExprContext * exprCtxt, Plan * parent)
{
- EState *estate;
- TeeState *teeState;
- ScanDirection dir;
+ EState *estate;
+ TeeState *teeState;
+ ScanDirection dir;
estate = ((Plan *) node)->state;
teeState = node->teestate;
@@ -492,13 +492,13 @@ ExecTeeReScan(Tee * node, ExprContext * exprCtxt, Plan * parent)
void
ExecEndTee(Tee * node, Plan * parent)
{
- EState *estate;
- TeeState *teeState;
- int leftPlace,
- rightPlace,
- lastPlace;
- Relation bufferRel;
- MemoryContext orig;
+ EState *estate;
+ TeeState *teeState;
+ int leftPlace,
+ rightPlace,
+ lastPlace;
+ Relation bufferRel;
+ MemoryContext orig;
estate = ((Plan *) node)->state;
teeState = node->teestate;
diff --git a/src/backend/executor/nodeUnique.c b/src/backend/executor/nodeUnique.c
index 75e40ccad96..5a340b8cf55 100644
--- a/src/backend/executor/nodeUnique.c
+++ b/src/backend/executor/nodeUnique.c
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/executor/nodeUnique.c,v 1.8 1997/09/07 04:41:50 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/executor/nodeUnique.c,v 1.9 1997/09/08 02:22:52 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -47,15 +47,15 @@
* same ADT value. -cim
* ----------------------------------------------------------------
*/
-static bool /* true if tuples are identical, false
+static bool /* true if tuples are identical, false
* otherwise */
ExecIdenticalTuples(TupleTableSlot * t1, TupleTableSlot * t2)
{
- HeapTuple h1;
- HeapTuple h2;
- char *d1;
- char *d2;
- int len;
+ HeapTuple h1;
+ HeapTuple h2;
+ char *d1;
+ char *d2;
+ int len;
h1 = t1->val;
h2 = t2->val;
@@ -110,14 +110,14 @@ ExecIdenticalTuples(TupleTableSlot * t1, TupleTableSlot * t2)
TupleTableSlot * /* return: a tuple or NULL */
ExecUnique(Unique * node)
{
- UniqueState *uniquestate;
+ UniqueState *uniquestate;
TupleTableSlot *resultTupleSlot;
TupleTableSlot *slot;
- Plan *outerPlan;
- char *uniqueAttr;
- AttrNumber uniqueAttrNum;
- TupleDesc tupDesc;
- Oid typoutput;
+ Plan *outerPlan;
+ char *uniqueAttr;
+ AttrNumber uniqueAttrNum;
+ TupleDesc tupDesc;
+ Oid typoutput;
/* ----------------
* get information from the node
@@ -180,12 +180,12 @@ ExecUnique(Unique * node)
* to check equality, we check to see if the typoutput of the
* attributes are equal
*/
- bool isNull1,
- isNull2;
- char *attr1,
- *attr2;
- char *val1,
- *val2;
+ bool isNull1,
+ isNull2;
+ char *attr1,
+ *attr2;
+ char *val1,
+ *val2;
attr1 = heap_getattr(slot->val, InvalidBuffer,
uniqueAttrNum, tupDesc, &isNull1);
@@ -245,9 +245,9 @@ ExecUnique(Unique * node)
bool /* return: initialization status */
ExecInitUnique(Unique * node, EState * estate, Plan * parent)
{
- UniqueState *uniquestate;
- Plan *outerPlan;
- char *uniqueAttr;
+ UniqueState *uniquestate;
+ Plan *outerPlan;
+ char *uniqueAttr;
/* ----------------
* assign execution state to node
@@ -299,8 +299,8 @@ ExecInitUnique(Unique * node, EState * estate, Plan * parent)
if (uniqueAttr)
{
- TupleDesc tupDesc;
- int i = 0;
+ TupleDesc tupDesc;
+ int i = 0;
tupDesc = ExecGetResultType(uniquestate);
@@ -340,7 +340,7 @@ ExecCountSlotsUnique(Unique * node)
void
ExecEndUnique(Unique * node)
{
- UniqueState *uniquestate;
+ UniqueState *uniquestate;
uniquestate = node->uniquestate;
ExecEndNode(outerPlan((Plan *) node), (Plan *) node);
diff --git a/src/backend/executor/spi.c b/src/backend/executor/spi.c
index 1d05a752d24..de4915785dc 100644
--- a/src/backend/executor/spi.c
+++ b/src/backend/executor/spi.c
@@ -11,39 +11,39 @@
typedef struct
{
- QueryTreeList *qtlist; /* malloced */
- uint32 processed; /* by Executor */
- SPITupleTable *tuptable;
- Portal portal; /* portal per procedure */
- MemoryContext savedcxt;
- CommandId savedId;
-} _SPI_connection;
-
-static Portal _SPI_portal = (Portal) NULL;
+ QueryTreeList *qtlist; /* malloced */
+ uint32 processed; /* by Executor */
+ SPITupleTable *tuptable;
+ Portal portal; /* portal per procedure */
+ MemoryContext savedcxt;
+ CommandId savedId;
+} _SPI_connection;
+
+static Portal _SPI_portal = (Portal) NULL;
static _SPI_connection *_SPI_stack = NULL;
static _SPI_connection *_SPI_current = NULL;
-static int _SPI_connected = -1;
-static int _SPI_curid = -1;
+static int _SPI_connected = -1;
+static int _SPI_curid = -1;
-uint32 SPI_processed = 0;
-SPITupleTable *SPI_tuptable;
-int SPI_result;
+uint32 SPI_processed = 0;
+SPITupleTable *SPI_tuptable;
+int SPI_result;
-void spi_printtup(HeapTuple tuple, TupleDesc tupdesc);
+void spi_printtup(HeapTuple tuple, TupleDesc tupdesc);
typedef struct
{
- QueryTreeList *qtlist;
- List *ptlist;
- int nargs;
- Oid *argtypes;
-} _SPI_plan;
+ QueryTreeList *qtlist;
+ List *ptlist;
+ int nargs;
+ Oid *argtypes;
+} _SPI_plan;
-static int _SPI_execute(char *src, int tcount, _SPI_plan * plan);
-static int _SPI_pquery(QueryDesc * queryDesc, EState * state, int tcount);
+static int _SPI_execute(char *src, int tcount, _SPI_plan * plan);
+static int _SPI_pquery(QueryDesc * queryDesc, EState * state, int tcount);
#if 0
-static void _SPI_fetch(FetchStmt * stmt);
+static void _SPI_fetch(FetchStmt * stmt);
#endif
static int
@@ -52,23 +52,23 @@ _SPI_execute_plan(_SPI_plan * plan,
static _SPI_plan *_SPI_copy_plan(_SPI_plan * plan, bool local);
-static int _SPI_begin_call(bool execmem);
-static int _SPI_end_call(bool procmem);
+static int _SPI_begin_call(bool execmem);
+static int _SPI_end_call(bool procmem);
static MemoryContext _SPI_execmem(void);
static MemoryContext _SPI_procmem(void);
-static bool _SPI_checktuples(bool isRetrieveIntoRelation);
+static bool _SPI_checktuples(bool isRetrieveIntoRelation);
#ifdef SPI_EXECUTOR_STATS
-extern int ShowExecutorStats;
-extern void ResetUsage(void);
-extern void ShowUsage(void);
+extern int ShowExecutorStats;
+extern void ResetUsage(void);
+extern void ShowUsage(void);
#endif
int
SPI_connect()
{
- char pname[64];
+ char pname[64];
PortalVariableMemory pvmem;
/*
@@ -141,7 +141,7 @@ SPI_connect()
int
SPI_finish()
{
- int res;
+ int res;
res = _SPI_begin_call(false); /* live in procedure memory */
if (res < 0)
@@ -179,7 +179,7 @@ SPI_finish()
int
SPI_exec(char *src, int tcount)
{
- int res;
+ int res;
if (src == NULL || tcount < 0)
return (SPI_ERROR_ARGUMENT);
@@ -197,7 +197,7 @@ SPI_exec(char *src, int tcount)
int
SPI_execp(void *plan, char **Values, char *Nulls, int tcount)
{
- int res;
+ int res;
if (plan == NULL || tcount < 0)
return (SPI_ERROR_ARGUMENT);
@@ -216,10 +216,10 @@ SPI_execp(void *plan, char **Values, char *Nulls, int tcount)
return (res);
}
-void *
+void *
SPI_prepare(char *src, int nargs, Oid * argtypes)
{
- _SPI_plan *plan;
+ _SPI_plan *plan;
if (nargs < 0 || (nargs > 0 && argtypes == NULL))
{
@@ -248,10 +248,10 @@ SPI_prepare(char *src, int nargs, Oid * argtypes)
}
-void *
+void *
SPI_saveplan(void *plan)
{
- _SPI_plan *newplan;
+ _SPI_plan *newplan;
if (plan == NULL)
{
@@ -275,7 +275,7 @@ SPI_saveplan(void *plan)
int
SPI_fnumber(TupleDesc tupdesc, char *fname)
{
- int res;
+ int res;
if (_SPI_curid + 1 != _SPI_connected)
return (SPI_ERROR_UNCONNECTED);
@@ -289,12 +289,12 @@ SPI_fnumber(TupleDesc tupdesc, char *fname)
return (SPI_ERROR_NOATTRIBUTE);
}
-char *
+char *
SPI_getvalue(HeapTuple tuple, TupleDesc tupdesc, int fnumber)
{
- char *val;
- bool isnull;
- Oid foutoid;
+ char *val;
+ bool isnull;
+ Oid foutoid;
SPI_result = 0;
if (_SPI_curid + 1 != _SPI_connected)
@@ -319,10 +319,10 @@ SPI_getvalue(HeapTuple tuple, TupleDesc tupdesc, int fnumber)
return (fmgr(foutoid, val, gettypelem(tupdesc->attrs[fnumber - 1]->atttypid)));
}
-char *
+char *
SPI_getbinval(HeapTuple tuple, TupleDesc tupdesc, int fnumber, bool * isnull)
{
- char *val;
+ char *val;
*isnull = true;
SPI_result = 0;
@@ -340,10 +340,10 @@ SPI_getbinval(HeapTuple tuple, TupleDesc tupdesc, int fnumber, bool * isnull)
return (val);
}
-char *
+char *
SPI_gettype(TupleDesc tupdesc, int fnumber)
{
- HeapTuple typeTuple;
+ HeapTuple typeTuple;
SPI_result = 0;
if (_SPI_curid + 1 != _SPI_connected)
@@ -391,7 +391,7 @@ SPI_gettypeid(TupleDesc tupdesc, int fnumber)
return (tupdesc->attrs[fnumber - 1]->atttypid);
}
-char *
+char *
SPI_getrelname(Relation rel)
{
@@ -414,8 +414,8 @@ SPI_getrelname(Relation rel)
void
spi_printtup(HeapTuple tuple, TupleDesc tupdesc)
{
- SPITupleTable *tuptable;
- MemoryContext oldcxt;
+ SPITupleTable *tuptable;
+ MemoryContext oldcxt;
/*
* When called by Executor _SPI_curid expected to be equal to
@@ -459,18 +459,18 @@ spi_printtup(HeapTuple tuple, TupleDesc tupdesc)
static int
_SPI_execute(char *src, int tcount, _SPI_plan * plan)
{
- QueryTreeList *queryTree_list;
- List *planTree_list;
- List *ptlist;
- QueryDesc *qdesc;
- Query *queryTree;
- Plan *planTree;
- EState *state;
- int qlen;
- int nargs = 0;
- Oid *argtypes = NULL;
- int res;
- int i;
+ QueryTreeList *queryTree_list;
+ List *planTree_list;
+ List *ptlist;
+ QueryDesc *qdesc;
+ Query *queryTree;
+ Plan *planTree;
+ EState *state;
+ int qlen;
+ int nargs = 0;
+ Oid *argtypes = NULL;
+ int res;
+ int i;
/* Increment CommandCounter to see changes made by now */
CommandCounterIncrement();
@@ -502,7 +502,7 @@ _SPI_execute(char *src, int tcount, _SPI_plan * plan)
{
if (nodeTag(queryTree->utilityStmt) == T_CopyStmt)
{
- CopyStmt *stmt = (CopyStmt *) (queryTree->utilityStmt);
+ CopyStmt *stmt = (CopyStmt *) (queryTree->utilityStmt);
if (stmt->filename == NULL)
return (SPI_ERROR_COPY);
@@ -556,17 +556,17 @@ _SPI_execute(char *src, int tcount, _SPI_plan * plan)
static int
_SPI_execute_plan(_SPI_plan * plan, char **Values, char *Nulls, int tcount)
{
- QueryTreeList *queryTree_list = plan->qtlist;
- List *planTree_list = plan->ptlist;
- QueryDesc *qdesc;
- Query *queryTree;
- Plan *planTree;
- EState *state;
- int nargs = plan->nargs;
- int qlen = queryTree_list->len;
- int res;
- int i,
- k;
+ QueryTreeList *queryTree_list = plan->qtlist;
+ List *planTree_list = plan->ptlist;
+ QueryDesc *qdesc;
+ Query *queryTree;
+ Plan *planTree;
+ EState *state;
+ int nargs = plan->nargs;
+ int qlen = queryTree_list->len;
+ int res;
+ int i,
+ k;
/* Increment CommandCounter to see changes made by now */
CommandCounterIncrement();
@@ -598,7 +598,7 @@ _SPI_execute_plan(_SPI_plan * plan, char **Values, char *Nulls, int tcount)
state = CreateExecutorState();
if (nargs > 0)
{
- ParamListInfo paramLI = (ParamListInfo) palloc((nargs + 1) *
+ ParamListInfo paramLI = (ParamListInfo) palloc((nargs + 1) *
sizeof(ParamListInfoData));
state->es_param_list_info = paramLI;
@@ -627,14 +627,14 @@ _SPI_execute_plan(_SPI_plan * plan, char **Values, char *Nulls, int tcount)
static int
_SPI_pquery(QueryDesc * queryDesc, EState * state, int tcount)
{
- Query *parseTree;
- Plan *plan;
- int operation;
- TupleDesc tupdesc;
- bool isRetrieveIntoPortal = false;
- bool isRetrieveIntoRelation = false;
- char *intoName = NULL;
- int res;
+ Query *parseTree;
+ Plan *plan;
+ int operation;
+ TupleDesc tupdesc;
+ bool isRetrieveIntoPortal = false;
+ bool isRetrieveIntoRelation = false;
+ char *intoName = NULL;
+ int res;
parseTree = queryDesc->parsetree;
plan = queryDesc->plantree;
@@ -642,34 +642,34 @@ _SPI_pquery(QueryDesc * queryDesc, EState * state, int tcount)
switch (operation)
{
- case CMD_SELECT:
- res = SPI_OK_SELECT;
- if (parseTree->isPortal)
- {
- isRetrieveIntoPortal = true;
- intoName = parseTree->into;
- parseTree->isBinary = false; /* */
+ case CMD_SELECT:
+ res = SPI_OK_SELECT;
+ if (parseTree->isPortal)
+ {
+ isRetrieveIntoPortal = true;
+ intoName = parseTree->into;
+ parseTree->isBinary = false; /* */
- return (SPI_ERROR_CURSOR);
+ return (SPI_ERROR_CURSOR);
- }
- else if (parseTree->into != NULL) /* select into table */
- {
- res = SPI_OK_SELINTO;
- isRetrieveIntoRelation = true;
- }
- break;
- case CMD_INSERT:
- res = SPI_OK_INSERT;
- break;
- case CMD_DELETE:
- res = SPI_OK_DELETE;
- break;
- case CMD_UPDATE:
- res = SPI_OK_UPDATE;
- break;
- default:
- return (SPI_ERROR_OPUNKNOWN);
+ }
+ else if (parseTree->into != NULL) /* select into table */
+ {
+ res = SPI_OK_SELINTO;
+ isRetrieveIntoRelation = true;
+ }
+ break;
+ case CMD_INSERT:
+ res = SPI_OK_INSERT;
+ break;
+ case CMD_DELETE:
+ res = SPI_OK_DELETE;
+ break;
+ case CMD_UPDATE:
+ res = SPI_OK_UPDATE;
+ break;
+ default:
+ return (SPI_ERROR_OPUNKNOWN);
}
if (state == NULL) /* plan preparation */
@@ -725,13 +725,13 @@ _SPI_pquery(QueryDesc * queryDesc, EState * state, int tcount)
static void
_SPI_fetch(FetchStmt * stmt)
{
- char *name = stmt->portalname;
- int feature = (stmt->direction == FORWARD) ? EXEC_FOR : EXEC_BACK;
- int count = stmt->howMany;
- Portal portal;
- QueryDesc *queryDesc;
- EState *state;
- MemoryContext context;
+ char *name = stmt->portalname;
+ int feature = (stmt->direction == FORWARD) ? EXEC_FOR : EXEC_BACK;
+ int count = stmt->howMany;
+ Portal portal;
+ QueryDesc *queryDesc;
+ EState *state;
+ MemoryContext context;
if (name == NULL)
elog(FATAL, "SPI_fetch from blank portal unsupported");
@@ -761,10 +761,10 @@ _SPI_fetch(FetchStmt * stmt)
#endif
-static MemoryContext
+static MemoryContext
_SPI_execmem()
{
- MemoryContext oldcxt;
+ MemoryContext oldcxt;
PortalHeapMemory phmem;
phmem = PortalGetHeapMemory(_SPI_current->portal);
@@ -774,10 +774,10 @@ _SPI_execmem()
}
-static MemoryContext
+static MemoryContext
_SPI_procmem()
{
- MemoryContext oldcxt;
+ MemoryContext oldcxt;
PortalVariableMemory pvmem;
pvmem = PortalGetVariableMemory(_SPI_current->portal);
@@ -834,12 +834,12 @@ _SPI_end_call(bool procmem)
return (0);
}
-static bool
+static bool
_SPI_checktuples(bool isRetrieveIntoRelation)
{
- uint32 processed = _SPI_current->processed;
- SPITupleTable *tuptable = _SPI_current->tuptable;
- bool failed = false;
+ uint32 processed = _SPI_current->processed;
+ SPITupleTable *tuptable = _SPI_current->tuptable;
+ bool failed = false;
if (processed == 0)
{
@@ -866,9 +866,9 @@ _SPI_checktuples(bool isRetrieveIntoRelation)
static _SPI_plan *
_SPI_copy_plan(_SPI_plan * plan, bool local)
{
- _SPI_plan *newplan;
- MemoryContext oldcxt;
- int i;
+ _SPI_plan *newplan;
+ MemoryContext oldcxt;
+ int i;
if (local)
oldcxt = MemoryContextSwitchTo((MemoryContext)