aboutsummaryrefslogtreecommitdiff
path: root/src/backend/executor/nodeAppend.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/backend/executor/nodeAppend.c')
-rw-r--r--src/backend/executor/nodeAppend.c131
1 files changed, 58 insertions, 73 deletions
diff --git a/src/backend/executor/nodeAppend.c b/src/backend/executor/nodeAppend.c
index 390f9fc1d91..f8b4b89bc93 100644
--- a/src/backend/executor/nodeAppend.c
+++ b/src/backend/executor/nodeAppend.c
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/executor/nodeAppend.c,v 1.39 2001/01/24 19:42:54 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/executor/nodeAppend.c,v 1.40 2001/03/22 06:16:12 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -81,9 +81,8 @@ exec_append_initialize_next(Append *node)
int whichplan;
int nplans;
- /* ----------------
- * get information from the append node
- * ----------------
+ /*
+ * get information from the append node
*/
estate = node->plan.state;
appendstate = node->appendstate;
@@ -92,35 +91,34 @@ exec_append_initialize_next(Append *node)
if (whichplan < 0)
{
- /* ----------------
- * if scanning in reverse, we start at
- * the last scan in the list and then
- * proceed back to the first.. in any case
- * we inform ExecProcAppend that we are
- * at the end of the line by returning FALSE
- * ----------------
+
+ /*
+ * if scanning in reverse, we start at the last scan in the list
+ * and then proceed back to the first.. in any case we inform
+ * ExecProcAppend that we are at the end of the line by returning
+ * FALSE
*/
appendstate->as_whichplan = 0;
return FALSE;
}
else if (whichplan >= nplans)
{
- /* ----------------
- * as above, end the scan if we go beyond
- * the last scan in our list..
- * ----------------
+
+ /*
+ * as above, end the scan if we go beyond the last scan in our
+ * list..
*/
appendstate->as_whichplan = nplans - 1;
return FALSE;
}
else
{
- /* ----------------
- * initialize the scan
+
+ /*
+ * initialize the scan
*
* If we are controlling the target relation, select the proper
* active ResultRelInfo and junk filter for this target.
- * ----------------
*/
if (node->isTarget)
{
@@ -162,10 +160,8 @@ ExecInitAppend(Append *node, EState *estate, Plan *parent)
CXT1_printf("ExecInitAppend: context is %d\n", CurrentMemoryContext);
- /* ----------------
- * assign execution state to node and get information
- * for append state
- * ----------------
+ /*
+ * assign execution state to node and get information for append state
*/
node->plan.state = estate;
@@ -175,9 +171,8 @@ ExecInitAppend(Append *node, EState *estate, Plan *parent)
initialized = (bool *) palloc(nplans * sizeof(bool));
MemSet(initialized, 0, nplans * sizeof(bool));
- /* ----------------
- * create new AppendState for our append node
- * ----------------
+ /*
+ * create new AppendState for our append node
*/
appendstate = makeNode(AppendState);
appendstate->as_whichplan = 0;
@@ -186,26 +181,24 @@ ExecInitAppend(Append *node, EState *estate, Plan *parent)
node->appendstate = appendstate;
- /* ----------------
- * Miscellaneous initialization
+ /*
+ * Miscellaneous initialization
*
- * Append plans don't have expression contexts because they
- * never call ExecQual or ExecProject.
- * ----------------
+ * Append plans don't have expression contexts because they never call
+ * ExecQual or ExecProject.
*/
#define APPEND_NSLOTS 1
- /* ----------------
- * append nodes still have Result slots, which hold pointers
- * to tuples, so we have to initialize them.
- * ----------------
+
+ /*
+ * append nodes still have Result slots, which hold pointers to
+ * tuples, so we have to initialize them.
*/
ExecInitResultTupleSlot(estate, &appendstate->cstate);
- /* ----------------
- * call ExecInitNode on each of the plans in our list
- * and save the results into the array "initialized"
- * ----------------
+ /*
+ * call ExecInitNode on each of the plans in our list and save the
+ * results into the array "initialized"
*/
for (i = 0; i < nplans; i++)
{
@@ -216,16 +209,14 @@ ExecInitAppend(Append *node, EState *estate, Plan *parent)
initialized[i] = ExecInitNode(initNode, estate, (Plan *) node);
}
- /* ----------------
- * initialize tuple type
- * ----------------
+ /*
+ * initialize tuple type
*/
ExecAssignResultTypeFromTL((Plan *) node, &appendstate->cstate);
appendstate->cstate.cs_ProjInfo = NULL;
- /* ----------------
- * return the result from the first subplan's initialization
- * ----------------
+ /*
+ * return the result from the first subplan's initialization
*/
appendstate->as_whichplan = 0;
exec_append_initialize_next(node);
@@ -264,9 +255,8 @@ ExecProcAppend(Append *node)
TupleTableSlot *result_slot;
ScanDirection direction;
- /* ----------------
- * get information from the node
- * ----------------
+ /*
+ * get information from the node
*/
appendstate = node->appendstate;
estate = node->plan.state;
@@ -275,49 +265,46 @@ ExecProcAppend(Append *node)
whichplan = appendstate->as_whichplan;
result_slot = appendstate->cstate.cs_ResultTupleSlot;
- /* ----------------
- * figure out which subplan we are currently processing
- * ----------------
+ /*
+ * figure out which subplan we are currently processing
*/
subnode = (Plan *) nth(whichplan, appendplans);
if (subnode == NULL)
elog(DEBUG, "ExecProcAppend: subnode is NULL");
- /* ----------------
- * get a tuple from the subplan
- * ----------------
+ /*
+ * get a tuple from the subplan
*/
result = ExecProcNode(subnode, (Plan *) node);
if (!TupIsNull(result))
{
- /* ----------------
- * if the subplan gave us something then place a copy of
- * whatever we get into our result slot and return it.
+
+ /*
+ * if the subplan gave us something then place a copy of whatever
+ * we get into our result slot and return it.
*
- * Note we rely on the subplan to retain ownership of the
- * tuple for as long as we need it --- we don't copy it.
- * ----------------
+ * Note we rely on the subplan to retain ownership of the tuple for
+ * as long as we need it --- we don't copy it.
*/
return ExecStoreTuple(result->val, result_slot, InvalidBuffer, false);
}
else
{
- /* ----------------
- * .. go on to the "next" subplan in the appropriate
- * direction and try processing again (recursively)
- * ----------------
+
+ /*
+ * .. go on to the "next" subplan in the appropriate direction and
+ * try processing again (recursively)
*/
if (ScanDirectionIsForward(direction))
appendstate->as_whichplan++;
else
appendstate->as_whichplan--;
- /* ----------------
- * return something from next node or an empty slot
- * if all of our subplans have been exhausted.
- * ----------------
+ /*
+ * return something from next node or an empty slot if all of our
+ * subplans have been exhausted.
*/
if (exec_append_initialize_next(node))
{
@@ -347,9 +334,8 @@ ExecEndAppend(Append *node)
bool *initialized;
int i;
- /* ----------------
- * get information from the node
- * ----------------
+ /*
+ * get information from the node
*/
appendstate = node->appendstate;
estate = node->plan.state;
@@ -357,9 +343,8 @@ ExecEndAppend(Append *node)
nplans = appendstate->as_nplans;
initialized = appendstate->as_initialized;
- /* ----------------
- * shut down each of the subscans
- * ----------------
+ /*
+ * shut down each of the subscans
*/
for (i = 0; i < nplans; i++)
{