mirror of
https://github.com/postgres/postgres.git
synced 2025-07-02 09:02:37 +03:00
pgindent run on all C files. Java run to follow. initdb/regression
tests pass.
This commit is contained in:
@ -15,7 +15,7 @@
|
||||
* ExecInitTee
|
||||
* ExecEndTee
|
||||
*
|
||||
* $Id: nodeTee.c,v 1.10 2001/03/22 06:16:13 momjian Exp $
|
||||
* $Id: nodeTee.c,v 1.11 2001/10/25 05:49:29 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -336,7 +336,6 @@ ExecTee(Tee * node, Plan *parent)
|
||||
slot = ExecProcNode(childNode, (Plan *) node);
|
||||
if (!TupIsNull(slot))
|
||||
{
|
||||
|
||||
/*
|
||||
* heap_insert changes something...
|
||||
*/
|
||||
@ -361,7 +360,6 @@ ExecTee(Tee * node, Plan *parent)
|
||||
teeState->tee_leftScanDesc : teeState->tee_rightScanDesc;
|
||||
|
||||
{
|
||||
|
||||
/*
|
||||
* move the scandesc forward so we don't re-read this
|
||||
* tuple later
|
||||
|
@ -6,7 +6,7 @@
|
||||
* Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
|
||||
* Portions Copyright (c) 1994, Regents of the University of California
|
||||
*
|
||||
* $Id: execAmi.c,v 1.59 2001/09/18 01:59:06 tgl Exp $
|
||||
* $Id: execAmi.c,v 1.60 2001/10/25 05:49:27 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -224,7 +224,6 @@ ExecCloseR(Plan *node)
|
||||
|
||||
for (i = 0; i < numIndices; i++)
|
||||
{
|
||||
|
||||
/*
|
||||
* shut down each of the index scans and close each of the
|
||||
* index relations
|
||||
@ -410,7 +409,7 @@ ExecMarkPos(Plan *node)
|
||||
{
|
||||
switch (nodeTag(node))
|
||||
{
|
||||
case T_SeqScan:
|
||||
case T_SeqScan:
|
||||
ExecSeqMarkPos((SeqScan *) node);
|
||||
break;
|
||||
|
||||
@ -452,7 +451,7 @@ ExecRestrPos(Plan *node)
|
||||
{
|
||||
switch (nodeTag(node))
|
||||
{
|
||||
case T_SeqScan:
|
||||
case T_SeqScan:
|
||||
ExecSeqRestrPos((SeqScan *) node);
|
||||
break;
|
||||
|
||||
|
@ -9,7 +9,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/executor/Attic/execFlatten.c,v 1.14 2001/01/24 19:42:53 momjian Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/executor/Attic/execFlatten.c,v 1.15 2001/10/25 05:49:27 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -33,7 +33,6 @@
|
||||
#ifdef SETS_FIXED
|
||||
static bool FjoinBumpOuterNodes(TargetEntry *tlist, ExprContext *econtext,
|
||||
DatumPtr results, char *nulls);
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
@ -81,7 +80,6 @@ ExecEvalFjoin(TargetEntry *tlist,
|
||||
*/
|
||||
if (!fjNode->fj_initialized)
|
||||
{
|
||||
|
||||
/*
|
||||
* Initialize all of the Outer nodes
|
||||
*/
|
||||
@ -127,7 +125,6 @@ ExecEvalFjoin(TargetEntry *tlist,
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
/*
|
||||
* If we're already initialized, all we need to do is get the next
|
||||
* inner result and pair it up with the existing outer node result
|
||||
@ -242,5 +239,4 @@ FjoinBumpOuterNodes(TargetEntry *tlist,
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
@ -8,7 +8,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/executor/execJunk.c,v 1.28 2001/05/27 20:48:51 tgl Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/executor/execJunk.c,v 1.29 2001/10/25 05:49:27 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -111,7 +111,6 @@ ExecInitJunkFilter(List *targetList, TupleDesc tupType,
|
||||
resjunk = resdom->resjunk;
|
||||
if (!resjunk)
|
||||
{
|
||||
|
||||
/*
|
||||
* make a copy of the resdom node, changing its resno.
|
||||
*/
|
||||
|
@ -27,7 +27,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/executor/execMain.c,v 1.148 2001/09/18 01:59:06 tgl Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/executor/execMain.c,v 1.149 2001/10/25 05:49:27 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -287,7 +287,6 @@ ExecutorEnd(QueryDesc *queryDesc, EState *estate)
|
||||
static void
|
||||
ExecCheckQueryPerms(CmdType operation, Query *parseTree, Plan *plan)
|
||||
{
|
||||
|
||||
/*
|
||||
* Check RTEs in the query's primary rangetable.
|
||||
*/
|
||||
@ -428,7 +427,6 @@ ExecCheckRTEPerms(RangeTblEntry *rte, CmdType operation)
|
||||
|
||||
if (rte->checkForWrite)
|
||||
{
|
||||
|
||||
/*
|
||||
* Note: write access in a SELECT context means SELECT FOR UPDATE.
|
||||
* Right now we don't distinguish that from true update as far as
|
||||
@ -521,7 +519,6 @@ InitPlan(CmdType operation, Query *parseTree, Plan *plan, EState *estate)
|
||||
|
||||
if (resultRelations != NIL)
|
||||
{
|
||||
|
||||
/*
|
||||
* Multiple result relations (due to inheritance)
|
||||
* parseTree->resultRelations identifies them all
|
||||
@ -544,7 +541,6 @@ InitPlan(CmdType operation, Query *parseTree, Plan *plan, EState *estate)
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
/*
|
||||
* Single result relation identified by
|
||||
* parseTree->resultRelation
|
||||
@ -564,7 +560,6 @@ InitPlan(CmdType operation, Query *parseTree, Plan *plan, EState *estate)
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
/*
|
||||
* if no result relation, then set state appropriately
|
||||
*/
|
||||
@ -599,9 +594,9 @@ InitPlan(CmdType operation, Query *parseTree, Plan *plan, EState *estate)
|
||||
|
||||
/*
|
||||
* initialize the executor "tuple" table. We need slots for all the
|
||||
* plan nodes, plus possibly output slots for the junkfilter(s).
|
||||
* At this point we aren't sure if we need junkfilters, so just add
|
||||
* slots for them unconditionally.
|
||||
* plan nodes, plus possibly output slots for the junkfilter(s). At
|
||||
* this point we aren't sure if we need junkfilters, so just add slots
|
||||
* for them unconditionally.
|
||||
*/
|
||||
{
|
||||
int nSlots = ExecCountSlotsNode(plan);
|
||||
@ -669,7 +664,6 @@ InitPlan(CmdType operation, Query *parseTree, Plan *plan, EState *estate)
|
||||
|
||||
if (junk_filter_needed)
|
||||
{
|
||||
|
||||
/*
|
||||
* If there are multiple result relations, each one needs its
|
||||
* own junk filter. Note this is only possible for
|
||||
@ -694,7 +688,7 @@ InitPlan(CmdType operation, Query *parseTree, Plan *plan, EState *estate)
|
||||
|
||||
j = ExecInitJunkFilter(subplan->targetlist,
|
||||
ExecGetTupType(subplan),
|
||||
ExecAllocTableSlot(estate->es_tupleTable));
|
||||
ExecAllocTableSlot(estate->es_tupleTable));
|
||||
resultRelInfo->ri_junkFilter = j;
|
||||
resultRelInfo++;
|
||||
subplans = lnext(subplans);
|
||||
@ -714,7 +708,7 @@ InitPlan(CmdType operation, Query *parseTree, Plan *plan, EState *estate)
|
||||
|
||||
j = ExecInitJunkFilter(plan->targetlist,
|
||||
tupType,
|
||||
ExecAllocTableSlot(estate->es_tupleTable));
|
||||
ExecAllocTableSlot(estate->es_tupleTable));
|
||||
estate->es_junkFilter = j;
|
||||
if (estate->es_result_relation_info)
|
||||
estate->es_result_relation_info->ri_junkFilter = j;
|
||||
@ -741,13 +735,11 @@ InitPlan(CmdType operation, Query *parseTree, Plan *plan, EState *estate)
|
||||
|
||||
if (!parseTree->isPortal)
|
||||
{
|
||||
|
||||
/*
|
||||
* a select into table
|
||||
*/
|
||||
if (parseTree->into != NULL)
|
||||
{
|
||||
|
||||
/*
|
||||
* create the "into" relation
|
||||
*/
|
||||
@ -1101,7 +1093,7 @@ lnext: ;
|
||||
newTuple = ExecRemoveJunk(junkfilter, slot);
|
||||
|
||||
slot = ExecStoreTuple(newTuple, /* tuple to store */
|
||||
junkfilter->jf_resultSlot, /* dest slot */
|
||||
junkfilter->jf_resultSlot, /* dest slot */
|
||||
InvalidBuffer, /* this tuple has no
|
||||
* buffer */
|
||||
true); /* tuple should be pfreed */
|
||||
@ -1234,7 +1226,7 @@ ExecAppend(TupleTableSlot *slot,
|
||||
|
||||
/* BEFORE ROW INSERT Triggers */
|
||||
if (resultRelInfo->ri_TrigDesc &&
|
||||
resultRelInfo->ri_TrigDesc->n_before_row[TRIGGER_EVENT_INSERT] > 0)
|
||||
resultRelInfo->ri_TrigDesc->n_before_row[TRIGGER_EVENT_INSERT] > 0)
|
||||
{
|
||||
HeapTuple newtuple;
|
||||
|
||||
@ -1245,7 +1237,6 @@ ExecAppend(TupleTableSlot *slot,
|
||||
|
||||
if (newtuple != tuple) /* modified by Trigger(s) */
|
||||
{
|
||||
|
||||
/*
|
||||
* Insert modified tuple into tuple table slot, replacing the
|
||||
* original. We assume that it was allocated in per-tuple
|
||||
@ -1314,7 +1305,7 @@ ExecDelete(TupleTableSlot *slot,
|
||||
|
||||
/* BEFORE ROW DELETE Triggers */
|
||||
if (resultRelInfo->ri_TrigDesc &&
|
||||
resultRelInfo->ri_TrigDesc->n_before_row[TRIGGER_EVENT_DELETE] > 0)
|
||||
resultRelInfo->ri_TrigDesc->n_before_row[TRIGGER_EVENT_DELETE] > 0)
|
||||
{
|
||||
bool dodelete;
|
||||
|
||||
@ -1421,7 +1412,7 @@ ExecReplace(TupleTableSlot *slot,
|
||||
|
||||
/* BEFORE ROW UPDATE Triggers */
|
||||
if (resultRelInfo->ri_TrigDesc &&
|
||||
resultRelInfo->ri_TrigDesc->n_before_row[TRIGGER_EVENT_UPDATE] > 0)
|
||||
resultRelInfo->ri_TrigDesc->n_before_row[TRIGGER_EVENT_UPDATE] > 0)
|
||||
{
|
||||
HeapTuple newtuple;
|
||||
|
||||
@ -1433,7 +1424,6 @@ ExecReplace(TupleTableSlot *slot,
|
||||
|
||||
if (newtuple != tuple) /* modified by Trigger(s) */
|
||||
{
|
||||
|
||||
/*
|
||||
* Insert modified tuple into tuple table slot, replacing the
|
||||
* original. We assume that it was allocated in per-tuple
|
||||
@ -1448,11 +1438,11 @@ ExecReplace(TupleTableSlot *slot,
|
||||
/*
|
||||
* Check the constraints of the tuple
|
||||
*
|
||||
* If we generate a new candidate tuple after EvalPlanQual testing,
|
||||
* we must loop back here and recheck constraints. (We don't need to
|
||||
* redo triggers, however. If there are any BEFORE triggers then
|
||||
* trigger.c will have done mark4update to lock the correct tuple,
|
||||
* so there's no need to do them again.)
|
||||
* If we generate a new candidate tuple after EvalPlanQual testing, we
|
||||
* must loop back here and recheck constraints. (We don't need to
|
||||
* redo triggers, however. If there are any BEFORE triggers then
|
||||
* trigger.c will have done mark4update to lock the correct tuple, so
|
||||
* there's no need to do them again.)
|
||||
*/
|
||||
lreplace:;
|
||||
if (resultRelationDesc->rd_att->constr)
|
||||
@ -1483,7 +1473,7 @@ lreplace:;
|
||||
*tupleid = ctid;
|
||||
tuple = ExecRemoveJunk(estate->es_junkFilter, epqslot);
|
||||
slot = ExecStoreTuple(tuple,
|
||||
estate->es_junkFilter->jf_resultSlot,
|
||||
estate->es_junkFilter->jf_resultSlot,
|
||||
InvalidBuffer, true);
|
||||
goto lreplace;
|
||||
}
|
||||
@ -1641,9 +1631,7 @@ EvalPlanQual(EState *estate, Index rti, ItemPointer tid)
|
||||
*/
|
||||
if (estate->es_result_relation_info != NULL &&
|
||||
estate->es_result_relation_info->ri_RangeTableIndex == rti)
|
||||
{
|
||||
relation = estate->es_result_relation_info->ri_RelationDesc;
|
||||
}
|
||||
else
|
||||
{
|
||||
List *l;
|
||||
@ -1724,7 +1712,7 @@ EvalPlanQual(EState *estate, Index rti, ItemPointer tid)
|
||||
*tid = tuple.t_self;
|
||||
|
||||
/*
|
||||
* Need to run a recheck subquery. Find or create a PQ stack entry.
|
||||
* Need to run a recheck subquery. Find or create a PQ stack entry.
|
||||
*/
|
||||
epq = (evalPlanQual *) estate->es_evalPlanQual;
|
||||
rtsize = length(estate->es_range_table);
|
||||
@ -1782,18 +1770,20 @@ EvalPlanQual(EState *estate, Index rti, ItemPointer tid)
|
||||
{
|
||||
newepq = (evalPlanQual *) palloc(sizeof(evalPlanQual));
|
||||
newepq->free = NULL;
|
||||
|
||||
/*
|
||||
* Each stack level has its own copy of the plan tree. This
|
||||
* Each stack level has its own copy of the plan tree. This
|
||||
* is wasteful, but necessary as long as plan nodes point to
|
||||
* exec state nodes rather than vice versa. Note that copyfuncs.c
|
||||
* doesn't attempt to copy the exec state nodes, which is a good
|
||||
* thing in this situation.
|
||||
* exec state nodes rather than vice versa. Note that
|
||||
* copyfuncs.c doesn't attempt to copy the exec state nodes,
|
||||
* which is a good thing in this situation.
|
||||
*/
|
||||
newepq->plan = copyObject(estate->es_origPlan);
|
||||
|
||||
/*
|
||||
* Init stack level's EState. We share top level's copy of
|
||||
* es_result_relations array and other non-changing status.
|
||||
* We need our own tupletable, es_param_exec_vals, and other
|
||||
* es_result_relations array and other non-changing status. We
|
||||
* need our own tupletable, es_param_exec_vals, and other
|
||||
* changeable state.
|
||||
*/
|
||||
epqstate = &(newepq->estate);
|
||||
@ -1805,11 +1795,12 @@ EvalPlanQual(EState *estate, Index rti, ItemPointer tid)
|
||||
sizeof(ParamExecData));
|
||||
epqstate->es_tupleTable = NULL;
|
||||
epqstate->es_per_tuple_exprcontext = NULL;
|
||||
|
||||
/*
|
||||
* Each epqstate must have its own es_evTupleNull state,
|
||||
* but all the stack entries share es_evTuple state. This
|
||||
* allows sub-rechecks to inherit the value being examined by
|
||||
* an outer recheck.
|
||||
* Each epqstate must have its own es_evTupleNull state, but
|
||||
* all the stack entries share es_evTuple state. This allows
|
||||
* sub-rechecks to inherit the value being examined by an
|
||||
* outer recheck.
|
||||
*/
|
||||
epqstate->es_evTupleNull = (bool *) palloc(rtsize * sizeof(bool));
|
||||
if (epq == NULL)
|
||||
@ -1842,12 +1833,12 @@ EvalPlanQual(EState *estate, Index rti, ItemPointer tid)
|
||||
epqstate = &(epq->estate);
|
||||
|
||||
/*
|
||||
* Ok - we're requested for the same RTE. Unfortunately we still
|
||||
* have to end and restart execution of the plan, because ExecReScan
|
||||
* Ok - we're requested for the same RTE. Unfortunately we still have
|
||||
* to end and restart execution of the plan, because ExecReScan
|
||||
* wouldn't ensure that upper plan nodes would reset themselves. We
|
||||
* could make that work if insertion of the target tuple were integrated
|
||||
* with the Param mechanism somehow, so that the upper plan nodes know
|
||||
* that their children's outputs have changed.
|
||||
* could make that work if insertion of the target tuple were
|
||||
* integrated with the Param mechanism somehow, so that the upper plan
|
||||
* nodes know that their children's outputs have changed.
|
||||
*/
|
||||
if (endNode)
|
||||
{
|
||||
@ -1858,8 +1849,8 @@ EvalPlanQual(EState *estate, Index rti, ItemPointer tid)
|
||||
}
|
||||
|
||||
/*
|
||||
* free old RTE' tuple, if any, and store target tuple where relation's
|
||||
* scan node will see it
|
||||
* free old RTE' tuple, if any, and store target tuple where
|
||||
* relation's scan node will see it
|
||||
*/
|
||||
if (epqstate->es_evTuple[rti - 1] != NULL)
|
||||
heap_freetuple(epqstate->es_evTuple[rti - 1]);
|
||||
|
@ -12,7 +12,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/executor/execProcnode.c,v 1.27 2001/09/18 01:59:06 tgl Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/executor/execProcnode.c,v 1.28 2001/10/25 05:49:27 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -267,9 +267,9 @@ ExecProcNode(Plan *node, Plan *parent)
|
||||
|
||||
switch (nodeTag(node))
|
||||
{
|
||||
/*
|
||||
* control nodes
|
||||
*/
|
||||
/*
|
||||
* control nodes
|
||||
*/
|
||||
case T_Result:
|
||||
result = ExecResult((Result *) node);
|
||||
break;
|
||||
@ -473,9 +473,9 @@ ExecEndNode(Plan *node, Plan *parent)
|
||||
|
||||
switch (nodeTag(node))
|
||||
{
|
||||
/*
|
||||
* control nodes
|
||||
*/
|
||||
/*
|
||||
* control nodes
|
||||
*/
|
||||
case T_Result:
|
||||
ExecEndResult((Result *) node);
|
||||
break;
|
||||
|
@ -8,7 +8,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/executor/execQual.c,v 1.88 2001/09/21 00:11:30 tgl Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/executor/execQual.c,v 1.89 2001/10/25 05:49:27 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -62,9 +62,9 @@ static Datum ExecEvalOr(Expr *orExpr, ExprContext *econtext, bool *isNull);
|
||||
static Datum ExecEvalCase(CaseExpr *caseExpr, ExprContext *econtext,
|
||||
bool *isNull, ExprDoneCond *isDone);
|
||||
static Datum ExecEvalNullTest(NullTest *ntest, ExprContext *econtext,
|
||||
bool *isNull, ExprDoneCond *isDone);
|
||||
bool *isNull, ExprDoneCond *isDone);
|
||||
static Datum ExecEvalBooleanTest(BooleanTest *btest, ExprContext *econtext,
|
||||
bool *isNull, ExprDoneCond *isDone);
|
||||
bool *isNull, ExprDoneCond *isDone);
|
||||
|
||||
|
||||
/*----------
|
||||
@ -126,7 +126,6 @@ ExecEvalArrayRef(ArrayRef *arrayRef,
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
/*
|
||||
* Empty refexpr indicates we are doing an INSERT into an array
|
||||
* column. For now, we just take the refassgnexpr (which the
|
||||
@ -339,9 +338,9 @@ ExecEvalVar(Var *variable, ExprContext *econtext, bool *isNull)
|
||||
* the entire tuple; we give back a whole slot so that callers know
|
||||
* what the tuple looks like.
|
||||
*
|
||||
* XXX this is a horrid crock: since the pointer to the slot might
|
||||
* live longer than the current evaluation context, we are forced to
|
||||
* copy the tuple and slot into a long-lived context --- we use
|
||||
* XXX this is a horrid crock: since the pointer to the slot might live
|
||||
* longer than the current evaluation context, we are forced to copy
|
||||
* the tuple and slot into a long-lived context --- we use
|
||||
* TransactionCommandContext which should be safe enough. This
|
||||
* represents a serious memory leak if many such tuples are processed
|
||||
* in one command, however. We ought to redesign the representation
|
||||
@ -434,7 +433,6 @@ ExecEvalParam(Param *expression, ExprContext *econtext, bool *isNull)
|
||||
matchFound = 0;
|
||||
if (paramList != NULL)
|
||||
{
|
||||
|
||||
/*
|
||||
* search for an entry in 'paramList' that matches the
|
||||
* `expression'.
|
||||
@ -485,7 +483,6 @@ ExecEvalParam(Param *expression, ExprContext *econtext, bool *isNull)
|
||||
|
||||
if (!matchFound)
|
||||
{
|
||||
|
||||
/*
|
||||
* ooops! we couldn't find this parameter in the parameter list.
|
||||
* Signal an error
|
||||
@ -1128,28 +1125,28 @@ ExecEvalNullTest(NullTest *ntest,
|
||||
|
||||
result = ExecEvalExpr(ntest->arg, econtext, isNull, isDone);
|
||||
switch (ntest->nulltesttype)
|
||||
{
|
||||
case IS_NULL:
|
||||
if (*isNull)
|
||||
{
|
||||
*isNull = false;
|
||||
return BoolGetDatum(true);
|
||||
}
|
||||
else
|
||||
return BoolGetDatum(false);
|
||||
case IS_NOT_NULL:
|
||||
if (*isNull)
|
||||
{
|
||||
*isNull = false;
|
||||
return BoolGetDatum(false);
|
||||
}
|
||||
else
|
||||
return BoolGetDatum(true);
|
||||
default:
|
||||
elog(ERROR, "ExecEvalNullTest: unexpected nulltesttype %d",
|
||||
(int) ntest->nulltesttype);
|
||||
return (Datum) 0; /* keep compiler quiet */
|
||||
}
|
||||
{
|
||||
case IS_NULL:
|
||||
if (*isNull)
|
||||
{
|
||||
*isNull = false;
|
||||
return BoolGetDatum(true);
|
||||
}
|
||||
else
|
||||
return BoolGetDatum(false);
|
||||
case IS_NOT_NULL:
|
||||
if (*isNull)
|
||||
{
|
||||
*isNull = false;
|
||||
return BoolGetDatum(false);
|
||||
}
|
||||
else
|
||||
return BoolGetDatum(true);
|
||||
default:
|
||||
elog(ERROR, "ExecEvalNullTest: unexpected nulltesttype %d",
|
||||
(int) ntest->nulltesttype);
|
||||
return (Datum) 0; /* keep compiler quiet */
|
||||
}
|
||||
}
|
||||
|
||||
/* ----------------------------------------------------------------
|
||||
@ -1168,68 +1165,68 @@ ExecEvalBooleanTest(BooleanTest *btest,
|
||||
|
||||
result = ExecEvalExpr(btest->arg, econtext, isNull, isDone);
|
||||
switch (btest->booltesttype)
|
||||
{
|
||||
case IS_TRUE:
|
||||
if (*isNull)
|
||||
{
|
||||
*isNull = false;
|
||||
return BoolGetDatum(false);
|
||||
}
|
||||
else if (DatumGetBool(result))
|
||||
return BoolGetDatum(true);
|
||||
{
|
||||
case IS_TRUE:
|
||||
if (*isNull)
|
||||
{
|
||||
*isNull = false;
|
||||
return BoolGetDatum(false);
|
||||
}
|
||||
else if (DatumGetBool(result))
|
||||
return BoolGetDatum(true);
|
||||
else
|
||||
return BoolGetDatum(false);
|
||||
case IS_NOT_TRUE:
|
||||
if (*isNull)
|
||||
{
|
||||
*isNull = false;
|
||||
return BoolGetDatum(true);
|
||||
}
|
||||
else if (DatumGetBool(result))
|
||||
return BoolGetDatum(false);
|
||||
return BoolGetDatum(false);
|
||||
case IS_NOT_TRUE:
|
||||
if (*isNull)
|
||||
{
|
||||
*isNull = false;
|
||||
return BoolGetDatum(true);
|
||||
}
|
||||
else if (DatumGetBool(result))
|
||||
return BoolGetDatum(false);
|
||||
else
|
||||
return BoolGetDatum(true);
|
||||
case IS_FALSE:
|
||||
if (*isNull)
|
||||
{
|
||||
*isNull = false;
|
||||
return BoolGetDatum(false);
|
||||
}
|
||||
else if (DatumGetBool(result))
|
||||
return BoolGetDatum(false);
|
||||
return BoolGetDatum(true);
|
||||
case IS_FALSE:
|
||||
if (*isNull)
|
||||
{
|
||||
*isNull = false;
|
||||
return BoolGetDatum(false);
|
||||
}
|
||||
else if (DatumGetBool(result))
|
||||
return BoolGetDatum(false);
|
||||
else
|
||||
return BoolGetDatum(true);
|
||||
case IS_NOT_FALSE:
|
||||
if (*isNull)
|
||||
{
|
||||
*isNull = false;
|
||||
return BoolGetDatum(true);
|
||||
}
|
||||
else if (DatumGetBool(result))
|
||||
return BoolGetDatum(true);
|
||||
return BoolGetDatum(true);
|
||||
case IS_NOT_FALSE:
|
||||
if (*isNull)
|
||||
{
|
||||
*isNull = false;
|
||||
return BoolGetDatum(true);
|
||||
}
|
||||
else if (DatumGetBool(result))
|
||||
return BoolGetDatum(true);
|
||||
else
|
||||
return BoolGetDatum(false);
|
||||
case IS_UNKNOWN:
|
||||
if (*isNull)
|
||||
{
|
||||
*isNull = false;
|
||||
return BoolGetDatum(true);
|
||||
}
|
||||
return BoolGetDatum(false);
|
||||
case IS_UNKNOWN:
|
||||
if (*isNull)
|
||||
{
|
||||
*isNull = false;
|
||||
return BoolGetDatum(true);
|
||||
}
|
||||
else
|
||||
return BoolGetDatum(false);
|
||||
case IS_NOT_UNKNOWN:
|
||||
if (*isNull)
|
||||
{
|
||||
*isNull = false;
|
||||
return BoolGetDatum(false);
|
||||
}
|
||||
return BoolGetDatum(false);
|
||||
case IS_NOT_UNKNOWN:
|
||||
if (*isNull)
|
||||
{
|
||||
*isNull = false;
|
||||
return BoolGetDatum(false);
|
||||
}
|
||||
else
|
||||
return BoolGetDatum(true);
|
||||
default:
|
||||
elog(ERROR, "ExecEvalBooleanTest: unexpected booltesttype %d",
|
||||
(int) btest->booltesttype);
|
||||
return (Datum) 0; /* keep compiler quiet */
|
||||
}
|
||||
return BoolGetDatum(true);
|
||||
default:
|
||||
elog(ERROR, "ExecEvalBooleanTest: unexpected booltesttype %d",
|
||||
(int) btest->booltesttype);
|
||||
return (Datum) 0; /* keep compiler quiet */
|
||||
}
|
||||
}
|
||||
|
||||
/* ----------------------------------------------------------------
|
||||
@ -1409,15 +1406,15 @@ ExecEvalExpr(Node *expression,
|
||||
break;
|
||||
case T_NullTest:
|
||||
retDatum = ExecEvalNullTest((NullTest *) expression,
|
||||
econtext,
|
||||
isNull,
|
||||
isDone);
|
||||
econtext,
|
||||
isNull,
|
||||
isDone);
|
||||
break;
|
||||
case T_BooleanTest:
|
||||
retDatum = ExecEvalBooleanTest((BooleanTest *) expression,
|
||||
econtext,
|
||||
isNull,
|
||||
isDone);
|
||||
econtext,
|
||||
isNull,
|
||||
isDone);
|
||||
break;
|
||||
|
||||
default:
|
||||
@ -1665,7 +1662,7 @@ ExecTargetList(List *targetlist,
|
||||
* generating multiple tuples, when one or more tlist items return
|
||||
* sets. (We expect the caller to call us again if we return:
|
||||
*
|
||||
* isDone = ExprMultipleResult.)
|
||||
* isDone = ExprMultipleResult.)
|
||||
*/
|
||||
if (nodomains > NPREALLOCDOMAINS)
|
||||
{
|
||||
@ -1774,13 +1771,11 @@ ExecTargetList(List *targetlist,
|
||||
|
||||
if (haveDoneSets)
|
||||
{
|
||||
|
||||
/*
|
||||
* note: can't get here unless we verified isDone != NULL
|
||||
*/
|
||||
if (*isDone == ExprSingleResult)
|
||||
{
|
||||
|
||||
/*
|
||||
* all sets are done, so report that tlist expansion is
|
||||
* complete.
|
||||
@ -1792,7 +1787,6 @@ ExecTargetList(List *targetlist,
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
/*
|
||||
* We have some done and some undone sets. Restart the done
|
||||
* ones so that we can deliver a tuple (if possible).
|
||||
@ -1815,7 +1809,6 @@ ExecTargetList(List *targetlist,
|
||||
|
||||
if (itemIsDone[resind] == ExprEndResult)
|
||||
{
|
||||
|
||||
/*
|
||||
* Oh dear, this item is returning an empty
|
||||
* set. Guess we can't make a tuple after all.
|
||||
|
@ -12,7 +12,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/executor/execScan.c,v 1.17 2001/03/22 06:16:12 momjian Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/executor/execScan.c,v 1.18 2001/10/25 05:49:27 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -122,7 +122,6 @@ ExecScan(Scan *node,
|
||||
*/
|
||||
if (!qual || ExecQual(qual, econtext, false))
|
||||
{
|
||||
|
||||
/*
|
||||
* Found a satisfactory scan tuple.
|
||||
*
|
||||
|
@ -15,7 +15,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/executor/execTuples.c,v 1.48 2001/03/22 06:16:12 momjian Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/executor/execTuples.c,v 1.49 2001/10/25 05:49:27 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -241,10 +241,10 @@ ExecAllocTableSlot(TupleTable table)
|
||||
Assert(table != NULL);
|
||||
|
||||
/*
|
||||
* if our table is full we have to allocate a larger size table.
|
||||
* Since ExecAllocTableSlot() is only called before the table is ever
|
||||
* used to store tuples, we don't have to worry about the contents of
|
||||
* the old table. If this changes, then we will have to preserve the
|
||||
* if our table is full we have to allocate a larger size table. Since
|
||||
* ExecAllocTableSlot() is only called before the table is ever used
|
||||
* to store tuples, we don't have to worry about the contents of the
|
||||
* old table. If this changes, then we will have to preserve the
|
||||
* contents. -cim 6/23/90
|
||||
*
|
||||
* Unfortunately, we *cannot* do this. All of the nodes in the plan that
|
||||
@ -347,7 +347,6 @@ ExecStoreTuple(HeapTuple tuple,
|
||||
Buffer buffer,
|
||||
bool shouldFree)
|
||||
{
|
||||
|
||||
/*
|
||||
* sanity checks
|
||||
*/
|
||||
@ -407,7 +406,7 @@ ExecClearTuple(TupleTableSlot *slot) /* slot in which to store tuple */
|
||||
|
||||
slot->val = (HeapTuple) NULL;
|
||||
|
||||
slot->ttc_shouldFree = true;/* probably useless code... */
|
||||
slot->ttc_shouldFree = true; /* probably useless code... */
|
||||
|
||||
/*
|
||||
* Drop the pin on the referenced buffer, if there is one.
|
||||
|
@ -8,7 +8,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/executor/execUtils.c,v 1.77 2001/07/16 05:06:58 tgl Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/executor/execUtils.c,v 1.78 2001/10/25 05:49:27 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -78,7 +78,6 @@ ResetTupleCount(void)
|
||||
NTupleReplaced = 0;
|
||||
NIndexTupleProcessed = 0;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
/* ----------------------------------------------------------------
|
||||
@ -117,7 +116,6 @@ DisplayTupleCount(FILE *statfp)
|
||||
(NTupleReplaced == 1) ? "" : "s");
|
||||
fprintf(statfp, "\n");
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
/* ----------------------------------------------------------------
|
||||
@ -504,26 +502,26 @@ ExecOpenIndices(ResultRelInfo *resultRelInfo)
|
||||
/*
|
||||
* Open (and lock, if necessary) the index relation
|
||||
*
|
||||
* If the index AM is not safe for concurrent updates, obtain
|
||||
* an exclusive lock on the index to lock out other updaters as
|
||||
* well as readers (index_beginscan places AccessShareLock).
|
||||
* We will release this lock in ExecCloseIndices.
|
||||
* If the index AM is not safe for concurrent updates, obtain an
|
||||
* exclusive lock on the index to lock out other updaters as well
|
||||
* as readers (index_beginscan places AccessShareLock). We will
|
||||
* release this lock in ExecCloseIndices.
|
||||
*
|
||||
* If the index AM supports concurrent updates, we obtain no lock
|
||||
* here at all, which is a tad weird, but safe since any critical
|
||||
* operation on the index (like deleting it) will acquire exclusive
|
||||
* lock on the parent table. Perhaps someday we should acquire
|
||||
* RowExclusiveLock on the index here?
|
||||
* operation on the index (like deleting it) will acquire
|
||||
* exclusive lock on the parent table. Perhaps someday we should
|
||||
* acquire RowExclusiveLock on the index here?
|
||||
*
|
||||
* If there are multiple not-concurrent-safe indexes, all backends
|
||||
* must lock the indexes in the same order or we will get deadlocks
|
||||
* here during concurrent updates. This is guaranteed by
|
||||
* RelationGetIndexList(), which promises to return the index list
|
||||
* in OID order.
|
||||
* must lock the indexes in the same order or we will get
|
||||
* deadlocks here during concurrent updates. This is guaranteed
|
||||
* by RelationGetIndexList(), which promises to return the index
|
||||
* list in OID order.
|
||||
*/
|
||||
indexDesc = index_open(indexOid);
|
||||
|
||||
if (! indexDesc->rd_am->amconcurrent)
|
||||
if (!indexDesc->rd_am->amconcurrent)
|
||||
LockRelation(indexDesc, AccessExclusiveLock);
|
||||
|
||||
/*
|
||||
@ -572,7 +570,7 @@ ExecCloseIndices(ResultRelInfo *resultRelInfo)
|
||||
continue;
|
||||
|
||||
/* Drop lock, if one was acquired by ExecOpenIndices */
|
||||
if (! indexDescs[i]->rd_am->amconcurrent)
|
||||
if (!indexDescs[i]->rd_am->amconcurrent)
|
||||
UnlockRelation(indexDescs[i], AccessExclusiveLock);
|
||||
|
||||
index_close(indexDescs[i]);
|
||||
|
@ -8,7 +8,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/executor/functions.c,v 1.45 2001/03/22 06:16:12 momjian Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/executor/functions.c,v 1.46 2001/10/25 05:49:27 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -32,7 +32,7 @@
|
||||
*/
|
||||
typedef enum
|
||||
{
|
||||
F_EXEC_START, F_EXEC_RUN, F_EXEC_DONE
|
||||
F_EXEC_START, F_EXEC_RUN, F_EXEC_DONE
|
||||
} ExecStatus;
|
||||
|
||||
typedef struct local_es
|
||||
@ -201,7 +201,6 @@ init_sql_fcache(FmgrInfo *finfo)
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
/*
|
||||
* This is a hack. We assume here that any function returning a
|
||||
* tuple returns it by reference. This needs to be fixed, since
|
||||
@ -257,7 +256,6 @@ init_sql_fcache(FmgrInfo *finfo)
|
||||
static void
|
||||
postquel_start(execution_state *es)
|
||||
{
|
||||
|
||||
/*
|
||||
* Do nothing for utility commands. (create, destroy...) DZ -
|
||||
* 30-8-1996
|
||||
@ -274,7 +272,6 @@ postquel_getnext(execution_state *es)
|
||||
|
||||
if (es->qd->operation == CMD_UTILITY)
|
||||
{
|
||||
|
||||
/*
|
||||
* Process a utility command. (create, destroy...) DZ - 30-8-1996
|
||||
*/
|
||||
@ -292,7 +289,6 @@ postquel_getnext(execution_state *es)
|
||||
static void
|
||||
postquel_end(execution_state *es)
|
||||
{
|
||||
|
||||
/*
|
||||
* Do nothing for utility commands. (create, destroy...) DZ -
|
||||
* 30-8-1996
|
||||
@ -417,7 +413,6 @@ postquel_execute(execution_state *es,
|
||||
*/
|
||||
if (fcache->returnsTuple)
|
||||
{
|
||||
|
||||
/*
|
||||
* XXX do we need to remove junk attrs from the result tuple?
|
||||
* Probably OK to leave them, as long as they are at the end.
|
||||
@ -528,7 +523,6 @@ fmgr_sql(PG_FUNCTION_ARGS)
|
||||
*/
|
||||
if (es == (execution_state *) NULL)
|
||||
{
|
||||
|
||||
/*
|
||||
* Reset the execution states to start over again
|
||||
*/
|
||||
|
@ -1,13 +1,13 @@
|
||||
/*-------------------------------------------------------------------------
|
||||
*
|
||||
* instrument.c
|
||||
* functions for instrumentation of plan execution
|
||||
* functions for instrumentation of plan execution
|
||||
*
|
||||
*
|
||||
* Copyright (c) 2001, PostgreSQL Global Development Group
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/executor/instrument.c,v 1.1 2001/09/18 01:59:06 tgl Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/executor/instrument.c,v 1.2 2001/10/25 05:49:28 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -22,9 +22,9 @@
|
||||
Instrumentation *
|
||||
InstrAlloc(void)
|
||||
{
|
||||
Instrumentation *instr = palloc( sizeof(Instrumentation) );
|
||||
Instrumentation *instr = palloc(sizeof(Instrumentation));
|
||||
|
||||
memset( instr, 0, sizeof(Instrumentation) );
|
||||
memset(instr, 0, sizeof(Instrumentation));
|
||||
|
||||
return instr;
|
||||
}
|
||||
@ -47,7 +47,7 @@ void
|
||||
InstrStopNode(Instrumentation *instr, bool returnedTuple)
|
||||
{
|
||||
struct timeval endtime;
|
||||
|
||||
|
||||
if (!instr)
|
||||
return;
|
||||
|
||||
@ -56,10 +56,10 @@ InstrStopNode(Instrumentation *instr, bool returnedTuple)
|
||||
elog(DEBUG, "InstrStopNode without start");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
gettimeofday(&endtime, NULL);
|
||||
|
||||
instr->counter.tv_sec += endtime.tv_sec - instr->starttime.tv_sec;
|
||||
|
||||
instr->counter.tv_sec += endtime.tv_sec - instr->starttime.tv_sec;
|
||||
instr->counter.tv_usec += endtime.tv_usec - instr->starttime.tv_usec;
|
||||
|
||||
/* Normalize after each add to avoid overflow/underflow of tv_usec */
|
||||
@ -90,10 +90,10 @@ InstrStopNode(Instrumentation *instr, bool returnedTuple)
|
||||
}
|
||||
|
||||
/* Finish a run cycle for a plan node */
|
||||
void
|
||||
void
|
||||
InstrEndLoop(Instrumentation *instr)
|
||||
{
|
||||
double totaltime;
|
||||
double totaltime;
|
||||
|
||||
if (!instr)
|
||||
return;
|
||||
@ -104,10 +104,10 @@ InstrEndLoop(Instrumentation *instr)
|
||||
|
||||
/* Accumulate statistics */
|
||||
totaltime = (double) instr->counter.tv_sec +
|
||||
(double) instr->counter.tv_usec / 1000000.0;
|
||||
(double) instr->counter.tv_usec / 1000000.0;
|
||||
|
||||
instr->startup += instr->firsttuple;
|
||||
instr->total += totaltime;
|
||||
instr->total += totaltime;
|
||||
instr->ntuples += instr->tuplecount;
|
||||
instr->nloops += 1;
|
||||
|
||||
|
@ -46,7 +46,7 @@
|
||||
* Portions Copyright (c) 1994, Regents of the University of California
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/executor/nodeAgg.c,v 1.77 2001/03/22 06:16:12 momjian Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/executor/nodeAgg.c,v 1.78 2001/10/25 05:49:28 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -73,7 +73,6 @@
|
||||
*/
|
||||
typedef struct AggStatePerAggData
|
||||
{
|
||||
|
||||
/*
|
||||
* These values are set up during ExecInitAgg() and do not change
|
||||
* thereafter:
|
||||
@ -178,7 +177,6 @@ initialize_aggregate(AggStatePerAgg peraggstate)
|
||||
*/
|
||||
if (aggref->aggdistinct)
|
||||
{
|
||||
|
||||
/*
|
||||
* In case of rescan, maybe there could be an uncompleted sort
|
||||
* operation? Clean it up if so.
|
||||
@ -228,7 +226,6 @@ advance_transition_function(AggStatePerAgg peraggstate,
|
||||
{
|
||||
if (isNull)
|
||||
{
|
||||
|
||||
/*
|
||||
* For a strict transfn, nothing happens at a NULL input
|
||||
* tuple; we just keep the prior transValue. However, if the
|
||||
@ -243,7 +240,6 @@ advance_transition_function(AggStatePerAgg peraggstate,
|
||||
}
|
||||
if (peraggstate->noTransValue)
|
||||
{
|
||||
|
||||
/*
|
||||
* transValue has not been initialized. This is the first
|
||||
* non-NULL input value. We use it as the initial value for
|
||||
@ -264,7 +260,6 @@ advance_transition_function(AggStatePerAgg peraggstate,
|
||||
}
|
||||
if (peraggstate->transValueIsNull)
|
||||
{
|
||||
|
||||
/*
|
||||
* Don't call a strict function with NULL inputs. Note it is
|
||||
* possible to get here despite the above tests, if the
|
||||
@ -333,7 +328,6 @@ process_sorted_aggregate(AggState *aggstate,
|
||||
while (tuplesort_getdatum(peraggstate->sortstate, true,
|
||||
&newVal, &isNull))
|
||||
{
|
||||
|
||||
/*
|
||||
* DISTINCT always suppresses nulls, per SQL spec, regardless of
|
||||
* the transition function's strictness.
|
||||
@ -398,7 +392,6 @@ static void
|
||||
finalize_aggregate(AggStatePerAgg peraggstate,
|
||||
Datum *resultVal, bool *resultIsNull)
|
||||
{
|
||||
|
||||
/*
|
||||
* Apply the agg's finalfn if one is provided, else return transValue.
|
||||
*/
|
||||
@ -757,7 +750,6 @@ ExecInitAgg(Agg *node, EState *estate, Plan *parent)
|
||||
aggstate->numaggs = numaggs = length(aggstate->aggs);
|
||||
if (numaggs <= 0)
|
||||
{
|
||||
|
||||
/*
|
||||
* This used to be treated as an error, but we can't do that
|
||||
* anymore because constant-expression simplification could
|
||||
@ -897,7 +889,6 @@ ExecInitAgg(Agg *node, EState *estate, Plan *parent)
|
||||
*/
|
||||
if (peraggstate->transfn.fn_strict && peraggstate->initValueIsNull)
|
||||
{
|
||||
|
||||
/*
|
||||
* Note: use the type from the input expression here, not
|
||||
* aggform->aggbasetype, because the latter might be 0.
|
||||
@ -913,7 +904,6 @@ ExecInitAgg(Agg *node, EState *estate, Plan *parent)
|
||||
|
||||
if (aggref->aggdistinct)
|
||||
{
|
||||
|
||||
/*
|
||||
* Note: use the type from the input expression here, not
|
||||
* aggform->aggbasetype, because the latter might be 0.
|
||||
@ -947,8 +937,8 @@ int
|
||||
ExecCountSlotsAgg(Agg *node)
|
||||
{
|
||||
return ExecCountSlotsNode(outerPlan(node)) +
|
||||
ExecCountSlotsNode(innerPlan(node)) +
|
||||
AGG_NSLOTS;
|
||||
ExecCountSlotsNode(innerPlan(node)) +
|
||||
AGG_NSLOTS;
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -8,7 +8,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/executor/nodeAppend.c,v 1.42 2001/05/15 00:33:36 tgl Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/executor/nodeAppend.c,v 1.43 2001/10/25 05:49:28 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -90,7 +90,6 @@ exec_append_initialize_next(Append *node)
|
||||
|
||||
if (whichplan < appendstate->as_firstplan)
|
||||
{
|
||||
|
||||
/*
|
||||
* 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
|
||||
@ -102,7 +101,6 @@ exec_append_initialize_next(Append *node)
|
||||
}
|
||||
else if (whichplan > appendstate->as_lastplan)
|
||||
{
|
||||
|
||||
/*
|
||||
* as above, end the scan if we go beyond the last scan in our
|
||||
* list..
|
||||
@ -112,7 +110,6 @@ exec_append_initialize_next(Append *node)
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
/*
|
||||
* initialize the scan
|
||||
*
|
||||
@ -182,12 +179,13 @@ ExecInitAppend(Append *node, EState *estate, Plan *parent)
|
||||
node->appendstate = appendstate;
|
||||
|
||||
/*
|
||||
* Do we want to scan just one subplan? (Special case for EvalPlanQual)
|
||||
* XXX pretty dirty way of determining that this case applies ...
|
||||
* Do we want to scan just one subplan? (Special case for
|
||||
* EvalPlanQual) XXX pretty dirty way of determining that this case
|
||||
* applies ...
|
||||
*/
|
||||
if (node->isTarget && estate->es_evTuple != NULL)
|
||||
{
|
||||
int tplan;
|
||||
int tplan;
|
||||
|
||||
tplan = estate->es_result_relation_info - estate->es_result_relations;
|
||||
Assert(tplan >= 0 && tplan < nplans);
|
||||
@ -301,7 +299,6 @@ ExecProcAppend(Append *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.
|
||||
@ -313,7 +310,6 @@ ExecProcAppend(Append *node)
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
/*
|
||||
* .. go on to the "next" subplan in the appropriate direction and
|
||||
* try processing again (recursively)
|
||||
@ -385,15 +381,17 @@ ExecReScanAppend(Append *node, ExprContext *exprCtxt, Plan *parent)
|
||||
Plan *subnode;
|
||||
|
||||
subnode = (Plan *) nth(i, node->appendplans);
|
||||
|
||||
/*
|
||||
* ExecReScan doesn't know about my subplans, so I have to do
|
||||
* changed-parameter signaling myself.
|
||||
*/
|
||||
if (node->plan.chgParam != NULL)
|
||||
SetChangedParamList(subnode, node->plan.chgParam);
|
||||
|
||||
/*
|
||||
* if chgParam of subnode is not null then plan will be re-scanned by
|
||||
* first ExecProcNode.
|
||||
* if chgParam of subnode is not null then plan will be re-scanned
|
||||
* by first ExecProcNode.
|
||||
*/
|
||||
if (subnode->chgParam == NULL)
|
||||
{
|
||||
|
@ -15,7 +15,7 @@
|
||||
* locate group boundaries.
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/executor/nodeGroup.c,v 1.43 2001/03/22 06:16:12 momjian Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/executor/nodeGroup.c,v 1.44 2001/10/25 05:49:28 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -122,7 +122,6 @@ ExecGroupEveryTuple(Group *node)
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
/*
|
||||
* Compare with first tuple and see if this tuple is of the
|
||||
* same group.
|
||||
@ -133,7 +132,6 @@ ExecGroupEveryTuple(Group *node)
|
||||
grpstate->eqfunctions,
|
||||
econtext->ecxt_per_tuple_memory))
|
||||
{
|
||||
|
||||
/*
|
||||
* No; save the tuple to return it next time, and return
|
||||
* NULL
|
||||
@ -478,7 +476,7 @@ execTuplesMatch(HeapTuple tuple1,
|
||||
* Look up the equality functions needed for execTuplesMatch.
|
||||
* The result is a palloc'd array.
|
||||
*/
|
||||
FmgrInfo *
|
||||
FmgrInfo *
|
||||
execTuplesMatchPrepare(TupleDesc tupdesc,
|
||||
int numCols,
|
||||
AttrNumber *matchColIdx)
|
||||
|
@ -7,7 +7,7 @@
|
||||
* Portions Copyright (c) 1994, Regents of the University of California
|
||||
*
|
||||
*
|
||||
* $Id: nodeHash.c,v 1.59 2001/08/13 19:50:11 tgl Exp $
|
||||
* $Id: nodeHash.c,v 1.60 2001/10/25 05:49:28 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -69,7 +69,6 @@ ExecHash(Hash *node)
|
||||
|
||||
if (nbatch > 0)
|
||||
{
|
||||
|
||||
/*
|
||||
* Open temp files for inner batches, if needed. Note that file
|
||||
* buffers are palloc'd in regular executor context.
|
||||
@ -165,8 +164,8 @@ int
|
||||
ExecCountSlotsHash(Hash *node)
|
||||
{
|
||||
return ExecCountSlotsNode(outerPlan(node)) +
|
||||
ExecCountSlotsNode(innerPlan(node)) +
|
||||
HASH_NSLOTS;
|
||||
ExecCountSlotsNode(innerPlan(node)) +
|
||||
HASH_NSLOTS;
|
||||
}
|
||||
|
||||
/* ---------------------------------------------------------------
|
||||
@ -279,7 +278,6 @@ ExecHashTableCreate(Hash *node)
|
||||
|
||||
if (nbatch > 0)
|
||||
{
|
||||
|
||||
/*
|
||||
* allocate and initialize the file arrays in hashCxt
|
||||
*/
|
||||
@ -480,7 +478,6 @@ ExecHashTableInsert(HashJoinTable hashtable,
|
||||
*/
|
||||
if (bucketno < hashtable->nbuckets)
|
||||
{
|
||||
|
||||
/*
|
||||
* put the tuple in hash table
|
||||
*/
|
||||
@ -506,7 +503,6 @@ ExecHashTableInsert(HashJoinTable hashtable,
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
/*
|
||||
* put the tuple into a tmp file for other batches
|
||||
*/
|
||||
@ -536,8 +532,8 @@ ExecHashGetBucket(HashJoinTable hashtable,
|
||||
MemoryContext oldContext;
|
||||
|
||||
/*
|
||||
* We reset the eval context each time to reclaim any memory leaked
|
||||
* in the hashkey expression or hashFunc itself.
|
||||
* We reset the eval context each time to reclaim any memory leaked in
|
||||
* the hashkey expression or hashFunc itself.
|
||||
*/
|
||||
ResetExprContext(econtext);
|
||||
|
||||
@ -657,15 +653,15 @@ hashFunc(Datum key, int len, bool byVal)
|
||||
else
|
||||
{
|
||||
/*
|
||||
* If this is a variable length type, then 'key' points to a "struct
|
||||
* varlena" and len == -1. NOTE: VARSIZE returns the "real" data
|
||||
* length plus the sizeof the "vl_len" attribute of varlena (the
|
||||
* length information). 'key' points to the beginning of the varlena
|
||||
* struct, so we have to use "VARDATA" to find the beginning of
|
||||
* the "real" data. Also, we have to be careful to detoast the
|
||||
* datum if it's toasted. (We don't worry about freeing the detoasted
|
||||
* copy; that happens for free when the per-tuple memory context
|
||||
* is reset in ExecHashGetBucket.)
|
||||
* If this is a variable length type, then 'key' points to a
|
||||
* "struct varlena" and len == -1. NOTE: VARSIZE returns the
|
||||
* "real" data length plus the sizeof the "vl_len" attribute of
|
||||
* varlena (the length information). 'key' points to the beginning
|
||||
* of the varlena struct, so we have to use "VARDATA" to find the
|
||||
* beginning of the "real" data. Also, we have to be careful to
|
||||
* detoast the datum if it's toasted. (We don't worry about
|
||||
* freeing the detoasted copy; that happens for free when the
|
||||
* per-tuple memory context is reset in ExecHashGetBucket.)
|
||||
*/
|
||||
unsigned char *k;
|
||||
|
||||
@ -737,7 +733,6 @@ ExecHashTableReset(HashJoinTable hashtable, long ntuples)
|
||||
void
|
||||
ExecReScanHash(Hash *node, ExprContext *exprCtxt, Plan *parent)
|
||||
{
|
||||
|
||||
/*
|
||||
* if chgParam of subnode is not null then plan will be re-scanned by
|
||||
* first ExecProcNode.
|
||||
|
@ -8,7 +8,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/executor/nodeHashjoin.c,v 1.38 2001/03/22 06:16:13 momjian Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/executor/nodeHashjoin.c,v 1.39 2001/10/25 05:49:28 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -148,7 +148,6 @@ ExecHashJoin(HashJoin *node)
|
||||
|
||||
for (;;)
|
||||
{
|
||||
|
||||
/*
|
||||
* If we don't have an outer tuple, get the next one
|
||||
*/
|
||||
@ -159,7 +158,6 @@ ExecHashJoin(HashJoin *node)
|
||||
hjstate);
|
||||
if (TupIsNull(outerTupleSlot))
|
||||
{
|
||||
|
||||
/*
|
||||
* when the last batch runs out, clean up and exit
|
||||
*/
|
||||
@ -193,7 +191,6 @@ ExecHashJoin(HashJoin *node)
|
||||
|
||||
if (batch > 0)
|
||||
{
|
||||
|
||||
/*
|
||||
* Need to postpone this outer tuple to a later batch.
|
||||
* Save it in the corresponding outer-batch file.
|
||||
@ -270,7 +267,6 @@ ExecHashJoin(HashJoin *node)
|
||||
if (!hjstate->hj_MatchedOuter &&
|
||||
node->join.jointype == JOIN_LEFT)
|
||||
{
|
||||
|
||||
/*
|
||||
* We are doing an outer join and there were no join matches
|
||||
* for this outer tuple. Generate a fake join tuple with
|
||||
@ -281,7 +277,6 @@ ExecHashJoin(HashJoin *node)
|
||||
|
||||
if (ExecQual(otherqual, econtext, false))
|
||||
{
|
||||
|
||||
/*
|
||||
* qualification was satisfied so we project and return
|
||||
* the slot containing the result tuple using
|
||||
@ -411,8 +406,8 @@ int
|
||||
ExecCountSlotsHashJoin(HashJoin *node)
|
||||
{
|
||||
return ExecCountSlotsNode(outerPlan(node)) +
|
||||
ExecCountSlotsNode(innerPlan(node)) +
|
||||
HASHJOIN_NSLOTS;
|
||||
ExecCountSlotsNode(innerPlan(node)) +
|
||||
HASHJOIN_NSLOTS;
|
||||
}
|
||||
|
||||
/* ----------------------------------------------------------------
|
||||
@ -565,7 +560,6 @@ ExecHashJoinNewBatch(HashJoinState *hjstate)
|
||||
|
||||
if (newbatch > 1)
|
||||
{
|
||||
|
||||
/*
|
||||
* We no longer need the previous outer batch file; close it right
|
||||
* away to free disk space.
|
||||
|
@ -8,7 +8,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/executor/nodeIndexscan.c,v 1.62 2001/07/15 22:48:17 tgl Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/executor/nodeIndexscan.c,v 1.63 2001/10/25 05:49:28 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -222,7 +222,7 @@ IndexNext(IndexScan *node)
|
||||
qual = lnext(qual);
|
||||
}
|
||||
if (!prev_matches)
|
||||
return slot;/* OK to return tuple */
|
||||
return slot; /* OK to return tuple */
|
||||
/* Duplicate tuple, so drop it and loop back for another */
|
||||
ExecClearTuple(slot);
|
||||
}
|
||||
@ -337,7 +337,6 @@ ExecIndexReScan(IndexScan *node, ExprContext *exprCtxt, Plan *parent)
|
||||
|
||||
if (econtext)
|
||||
{
|
||||
|
||||
/*
|
||||
* If we are being passed an outer tuple, save it for runtime key
|
||||
* calc
|
||||
@ -377,7 +376,6 @@ ExecIndexReScan(IndexScan *node, ExprContext *exprCtxt, Plan *parent)
|
||||
run_keys = runtimeKeyInfo[i];
|
||||
for (j = 0; j < n_keys; j++)
|
||||
{
|
||||
|
||||
/*
|
||||
* If we have a run-time key, then extract the run-time
|
||||
* expression and evaluate it with respect to the current
|
||||
@ -703,10 +701,10 @@ ExecInitIndexScan(IndexScan *node, EState *estate, Plan *parent)
|
||||
Expr *clause; /* one clause of index qual */
|
||||
Oper *op; /* operator used in clause */
|
||||
Node *leftop; /* expr on lhs of operator */
|
||||
Node *rightop;/* expr on rhs ... */
|
||||
Node *rightop; /* expr on rhs ... */
|
||||
bits16 flags = 0;
|
||||
|
||||
int scanvar;/* which var identifies varattno */
|
||||
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) */
|
||||
@ -772,7 +770,6 @@ ExecInitIndexScan(IndexScan *node, EState *estate, Plan *parent)
|
||||
|
||||
if (IsA(leftop, Var) &&var_is_rel((Var *) leftop))
|
||||
{
|
||||
|
||||
/*
|
||||
* if the leftop is a "rel-var", then it means that it is
|
||||
* a var node which tells us which attribute to use for
|
||||
@ -783,7 +780,6 @@ ExecInitIndexScan(IndexScan *node, EState *estate, Plan *parent)
|
||||
}
|
||||
else if (IsA(leftop, Const))
|
||||
{
|
||||
|
||||
/*
|
||||
* if the leftop is a const node then it means it
|
||||
* identifies the value to place in our scan key.
|
||||
@ -820,7 +816,6 @@ ExecInitIndexScan(IndexScan *node, EState *estate, Plan *parent)
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
/*
|
||||
* otherwise, the leftop contains an expression evaluable
|
||||
* at runtime to figure out the value to place in our scan
|
||||
@ -842,7 +837,6 @@ ExecInitIndexScan(IndexScan *node, EState *estate, Plan *parent)
|
||||
|
||||
if (IsA(rightop, Var) &&var_is_rel((Var *) rightop))
|
||||
{
|
||||
|
||||
/*
|
||||
* here we make sure only one op identifies the
|
||||
* scan-attribute...
|
||||
@ -861,7 +855,6 @@ ExecInitIndexScan(IndexScan *node, EState *estate, Plan *parent)
|
||||
}
|
||||
else if (IsA(rightop, Const))
|
||||
{
|
||||
|
||||
/*
|
||||
* if the rightop is a const node then it means it
|
||||
* identifies the value to place in our scan key.
|
||||
@ -898,7 +891,6 @@ ExecInitIndexScan(IndexScan *node, EState *estate, Plan *parent)
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
/*
|
||||
* otherwise, the rightop contains an expression evaluable
|
||||
* at runtime to figure out the value to place in our scan
|
||||
@ -1023,7 +1015,7 @@ ExecInitIndexScan(IndexScan *node, EState *estate, Plan *parent)
|
||||
ExecOpenScanR(indexOid, /* relation */
|
||||
numScanKeys[i], /* nkeys */
|
||||
scanKeys[i], /* scan key */
|
||||
true, /* is index */
|
||||
true, /* is index */
|
||||
direction, /* scan direction */
|
||||
estate->es_snapshot,
|
||||
&(relationDescs[i]), /* return: rel desc */
|
||||
@ -1045,5 +1037,5 @@ int
|
||||
ExecCountSlotsIndexScan(IndexScan *node)
|
||||
{
|
||||
return ExecCountSlotsNode(outerPlan((Plan *) node)) +
|
||||
ExecCountSlotsNode(innerPlan((Plan *) node)) + INDEXSCAN_NSLOTS;
|
||||
ExecCountSlotsNode(innerPlan((Plan *) node)) + INDEXSCAN_NSLOTS;
|
||||
}
|
||||
|
@ -8,7 +8,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/executor/nodeLimit.c,v 1.7 2001/08/06 18:05:07 tgl Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/executor/nodeLimit.c,v 1.8 2001/10/25 05:49:29 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -66,7 +66,6 @@ ExecLimit(Limit *node)
|
||||
*/
|
||||
for (;;)
|
||||
{
|
||||
|
||||
/*
|
||||
* If we have reached the subplan EOF or the limit, just quit.
|
||||
*
|
||||
@ -76,11 +75,11 @@ ExecLimit(Limit *node)
|
||||
* here is for position > netlimit not position >= netlimit.
|
||||
*
|
||||
* Similarly, when scanning backwards, we must re-fetch the last
|
||||
* tuple in the offset region before we can return NULL.
|
||||
* Otherwise we won't be correctly aligned to start going forward
|
||||
* again. So, although you might think we can quit when position
|
||||
* equals offset + 1, we have to fetch a subplan tuple first, and
|
||||
* then exit when position = offset.
|
||||
* tuple in the offset region before we can return NULL. Otherwise
|
||||
* we won't be correctly aligned to start going forward again.
|
||||
* So, although you might think we can quit when position equals
|
||||
* offset + 1, we have to fetch a subplan tuple first, and then
|
||||
* exit when position = offset.
|
||||
*/
|
||||
if (ScanDirectionIsForward(direction))
|
||||
{
|
||||
@ -101,7 +100,6 @@ ExecLimit(Limit *node)
|
||||
slot = ExecProcNode(outerPlan, (Plan *) node);
|
||||
if (TupIsNull(slot))
|
||||
{
|
||||
|
||||
/*
|
||||
* We are at start or end of the subplan. Update local state
|
||||
* appropriately, but always return NULL.
|
||||
@ -269,8 +267,8 @@ int
|
||||
ExecCountSlotsLimit(Limit *node)
|
||||
{
|
||||
return ExecCountSlotsNode(outerPlan(node)) +
|
||||
ExecCountSlotsNode(innerPlan(node)) +
|
||||
LIMIT_NSLOTS;
|
||||
ExecCountSlotsNode(innerPlan(node)) +
|
||||
LIMIT_NSLOTS;
|
||||
}
|
||||
|
||||
/* ----------------------------------------------------------------
|
||||
|
@ -8,7 +8,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/executor/nodeMaterial.c,v 1.36 2001/05/27 20:42:19 tgl Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/executor/nodeMaterial.c,v 1.37 2001/10/25 05:49:29 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -185,8 +185,8 @@ int
|
||||
ExecCountSlotsMaterial(Material *node)
|
||||
{
|
||||
return ExecCountSlotsNode(outerPlan((Plan *) node)) +
|
||||
ExecCountSlotsNode(innerPlan((Plan *) node)) +
|
||||
MATERIAL_NSLOTS;
|
||||
ExecCountSlotsNode(innerPlan((Plan *) node)) +
|
||||
MATERIAL_NSLOTS;
|
||||
}
|
||||
|
||||
/* ----------------------------------------------------------------
|
||||
|
@ -8,7 +8,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/executor/nodeMergejoin.c,v 1.45 2001/03/23 04:49:53 momjian Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/executor/nodeMergejoin.c,v 1.46 2001/10/25 05:49:29 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -124,7 +124,6 @@ MJFormSkipQual(List *qualList, char *replaceopname)
|
||||
|
||||
foreach(qualcdr, qualCopy)
|
||||
{
|
||||
|
||||
/*
|
||||
* first get the current (op .. ..) list
|
||||
*/
|
||||
@ -321,7 +320,6 @@ ExecMergeTupleDump(MergeJoinState *mergestate)
|
||||
|
||||
printf("******** \n");
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
/* ----------------------------------------------------------------
|
||||
@ -431,7 +429,7 @@ ExecMergeJoin(MergeJoin *node)
|
||||
default:
|
||||
elog(ERROR, "ExecMergeJoin: unsupported join type %d",
|
||||
(int) node->join.jointype);
|
||||
doFillOuter = false;/* keep compiler quiet */
|
||||
doFillOuter = false; /* keep compiler quiet */
|
||||
doFillInner = false;
|
||||
break;
|
||||
}
|
||||
@ -476,7 +474,6 @@ ExecMergeJoin(MergeJoin *node)
|
||||
*/
|
||||
for (;;)
|
||||
{
|
||||
|
||||
/*
|
||||
* get the current state of the join and do things accordingly.
|
||||
* Note: The join states are highlighted with 32-* comments for
|
||||
@ -486,7 +483,6 @@ 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 fetch
|
||||
@ -505,7 +501,6 @@ ExecMergeJoin(MergeJoin *node)
|
||||
MJ_printf("ExecMergeJoin: outer subplan is empty\n");
|
||||
if (doFillInner)
|
||||
{
|
||||
|
||||
/*
|
||||
* Need to emit right-join tuples for remaining
|
||||
* inner tuples. We set MatchedInner = true to
|
||||
@ -526,7 +521,6 @@ ExecMergeJoin(MergeJoin *node)
|
||||
MJ_printf("ExecMergeJoin: inner subplan is empty\n");
|
||||
if (doFillOuter)
|
||||
{
|
||||
|
||||
/*
|
||||
* Need to emit left-join tuples for all outer
|
||||
* tuples, including the one we just fetched. We
|
||||
@ -632,7 +626,6 @@ ExecMergeJoin(MergeJoin *node)
|
||||
|
||||
if (qualResult)
|
||||
{
|
||||
|
||||
/*
|
||||
* qualification succeeded. now form the desired
|
||||
* projection tuple and return the slot containing
|
||||
@ -669,7 +662,6 @@ ExecMergeJoin(MergeJoin *node)
|
||||
|
||||
if (doFillInner && !mergestate->mj_MatchedInner)
|
||||
{
|
||||
|
||||
/*
|
||||
* Generate a fake join tuple with nulls for the outer
|
||||
* tuple, and return it if it passes the non-join
|
||||
@ -686,7 +678,6 @@ ExecMergeJoin(MergeJoin *node)
|
||||
|
||||
if (ExecQual(otherqual, econtext, false))
|
||||
{
|
||||
|
||||
/*
|
||||
* qualification succeeded. now form the desired
|
||||
* projection tuple and return the slot containing
|
||||
@ -747,7 +738,6 @@ ExecMergeJoin(MergeJoin *node)
|
||||
|
||||
if (doFillOuter && !mergestate->mj_MatchedOuter)
|
||||
{
|
||||
|
||||
/*
|
||||
* Generate a fake join tuple with nulls for the inner
|
||||
* tuple, and return it if it passes the non-join
|
||||
@ -764,7 +754,6 @@ ExecMergeJoin(MergeJoin *node)
|
||||
|
||||
if (ExecQual(otherqual, econtext, false))
|
||||
{
|
||||
|
||||
/*
|
||||
* qualification succeeded. now form the desired
|
||||
* projection tuple and return the slot containing
|
||||
@ -805,7 +794,6 @@ ExecMergeJoin(MergeJoin *node)
|
||||
innerTupleSlot = mergestate->mj_InnerTupleSlot;
|
||||
if (doFillInner && !TupIsNull(innerTupleSlot))
|
||||
{
|
||||
|
||||
/*
|
||||
* Need to emit right-join tuples for remaining
|
||||
* inner tuples.
|
||||
@ -873,7 +861,6 @@ ExecMergeJoin(MergeJoin *node)
|
||||
|
||||
if (qualResult)
|
||||
{
|
||||
|
||||
/*
|
||||
* the merge clause matched so now we restore the
|
||||
* inner scan position to the first mark, and loop
|
||||
@ -915,7 +902,6 @@ ExecMergeJoin(MergeJoin *node)
|
||||
{
|
||||
if (doFillOuter)
|
||||
{
|
||||
|
||||
/*
|
||||
* Need to emit left-join tuples for remaining
|
||||
* outer tuples.
|
||||
@ -1036,7 +1022,6 @@ ExecMergeJoin(MergeJoin *node)
|
||||
|
||||
if (doFillOuter && !mergestate->mj_MatchedOuter)
|
||||
{
|
||||
|
||||
/*
|
||||
* Generate a fake join tuple with nulls for the inner
|
||||
* tuple, and return it if it passes the non-join
|
||||
@ -1053,7 +1038,6 @@ ExecMergeJoin(MergeJoin *node)
|
||||
|
||||
if (ExecQual(otherqual, econtext, false))
|
||||
{
|
||||
|
||||
/*
|
||||
* qualification succeeded. now form the desired
|
||||
* projection tuple and return the slot containing
|
||||
@ -1094,7 +1078,6 @@ ExecMergeJoin(MergeJoin *node)
|
||||
innerTupleSlot = mergestate->mj_InnerTupleSlot;
|
||||
if (doFillInner && !TupIsNull(innerTupleSlot))
|
||||
{
|
||||
|
||||
/*
|
||||
* Need to emit right-join tuples for remaining
|
||||
* inner tuples.
|
||||
@ -1216,7 +1199,6 @@ ExecMergeJoin(MergeJoin *node)
|
||||
|
||||
if (doFillInner && !mergestate->mj_MatchedInner)
|
||||
{
|
||||
|
||||
/*
|
||||
* Generate a fake join tuple with nulls for the outer
|
||||
* tuple, and return it if it passes the non-join
|
||||
@ -1233,7 +1215,6 @@ ExecMergeJoin(MergeJoin *node)
|
||||
|
||||
if (ExecQual(otherqual, econtext, false))
|
||||
{
|
||||
|
||||
/*
|
||||
* qualification succeeded. now form the desired
|
||||
* projection tuple and return the slot containing
|
||||
@ -1274,7 +1255,6 @@ ExecMergeJoin(MergeJoin *node)
|
||||
outerTupleSlot = mergestate->mj_OuterTupleSlot;
|
||||
if (doFillOuter && !TupIsNull(outerTupleSlot))
|
||||
{
|
||||
|
||||
/*
|
||||
* Need to emit left-join tuples for remaining
|
||||
* outer tuples.
|
||||
@ -1304,7 +1284,6 @@ ExecMergeJoin(MergeJoin *node)
|
||||
|
||||
if (!mergestate->mj_MatchedInner)
|
||||
{
|
||||
|
||||
/*
|
||||
* Generate a fake join tuple with nulls for the outer
|
||||
* tuple, and return it if it passes the non-join
|
||||
@ -1321,7 +1300,6 @@ ExecMergeJoin(MergeJoin *node)
|
||||
|
||||
if (ExecQual(otherqual, econtext, false))
|
||||
{
|
||||
|
||||
/*
|
||||
* qualification succeeded. now form the desired
|
||||
* projection tuple and return the slot containing
|
||||
@ -1373,7 +1351,6 @@ ExecMergeJoin(MergeJoin *node)
|
||||
|
||||
if (!mergestate->mj_MatchedOuter)
|
||||
{
|
||||
|
||||
/*
|
||||
* Generate a fake join tuple with nulls for the inner
|
||||
* tuple, and return it if it passes the non-join
|
||||
@ -1390,7 +1367,6 @@ ExecMergeJoin(MergeJoin *node)
|
||||
|
||||
if (ExecQual(otherqual, econtext, false))
|
||||
{
|
||||
|
||||
/*
|
||||
* qualification succeeded. now form the desired
|
||||
* projection tuple and return the slot containing
|
||||
@ -1579,8 +1555,8 @@ int
|
||||
ExecCountSlotsMergeJoin(MergeJoin *node)
|
||||
{
|
||||
return ExecCountSlotsNode(outerPlan((Plan *) node)) +
|
||||
ExecCountSlotsNode(innerPlan((Plan *) node)) +
|
||||
MERGEJOIN_NSLOTS;
|
||||
ExecCountSlotsNode(innerPlan((Plan *) node)) +
|
||||
MERGEJOIN_NSLOTS;
|
||||
}
|
||||
|
||||
/* ----------------------------------------------------------------
|
||||
|
@ -8,7 +8,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/executor/nodeNestloop.c,v 1.24 2001/03/22 06:16:13 momjian Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/executor/nodeNestloop.c,v 1.25 2001/10/25 05:49:29 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -118,7 +118,6 @@ ExecNestLoop(NestLoop *node)
|
||||
|
||||
for (;;)
|
||||
{
|
||||
|
||||
/*
|
||||
* If we don't have an outer tuple, get the next one and reset the
|
||||
* inner scan.
|
||||
@ -174,7 +173,6 @@ ExecNestLoop(NestLoop *node)
|
||||
if (!nlstate->nl_MatchedOuter &&
|
||||
node->join.jointype == JOIN_LEFT)
|
||||
{
|
||||
|
||||
/*
|
||||
* We are doing an outer join and there were no join
|
||||
* matches for this outer tuple. Generate a fake join
|
||||
@ -187,7 +185,6 @@ ExecNestLoop(NestLoop *node)
|
||||
|
||||
if (ExecQual(otherqual, econtext, false))
|
||||
{
|
||||
|
||||
/*
|
||||
* qualification was satisfied so we project and
|
||||
* return the slot containing the result tuple using
|
||||
@ -231,7 +228,6 @@ ExecNestLoop(NestLoop *node)
|
||||
|
||||
if (otherqual == NIL || ExecQual(otherqual, econtext, false))
|
||||
{
|
||||
|
||||
/*
|
||||
* qualification was satisfied so we project and return
|
||||
* the slot containing the result tuple using
|
||||
@ -346,8 +342,8 @@ int
|
||||
ExecCountSlotsNestLoop(NestLoop *node)
|
||||
{
|
||||
return ExecCountSlotsNode(outerPlan(node)) +
|
||||
ExecCountSlotsNode(innerPlan(node)) +
|
||||
NESTLOOP_NSLOTS;
|
||||
ExecCountSlotsNode(innerPlan(node)) +
|
||||
NESTLOOP_NSLOTS;
|
||||
}
|
||||
|
||||
/* ----------------------------------------------------------------
|
||||
|
@ -34,7 +34,7 @@
|
||||
* Portions Copyright (c) 1994, Regents of the University of California
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/executor/nodeResult.c,v 1.19 2001/03/22 06:16:13 momjian Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/executor/nodeResult.c,v 1.20 2001/10/25 05:49:29 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -125,7 +125,6 @@ ExecResult(Result *node)
|
||||
|
||||
if (outerPlan != NULL)
|
||||
{
|
||||
|
||||
/*
|
||||
* retrieve tuples from the outer plan until there are no
|
||||
* more.
|
||||
@ -146,7 +145,6 @@ ExecResult(Result *node)
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
/*
|
||||
* if we don't have an outer plan, then we are just generating
|
||||
* the results from a constant target list. Do it only once.
|
||||
|
@ -8,7 +8,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/executor/nodeSeqscan.c,v 1.31 2001/07/15 22:48:18 tgl Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/executor/nodeSeqscan.c,v 1.32 2001/10/25 05:49:29 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -127,7 +127,6 @@ SeqNext(SeqScan *node)
|
||||
TupleTableSlot *
|
||||
ExecSeqScan(SeqScan *node)
|
||||
{
|
||||
|
||||
/*
|
||||
* use SeqNext as access method
|
||||
*/
|
||||
@ -246,8 +245,8 @@ int
|
||||
ExecCountSlotsSeqScan(SeqScan *node)
|
||||
{
|
||||
return ExecCountSlotsNode(outerPlan(node)) +
|
||||
ExecCountSlotsNode(innerPlan(node)) +
|
||||
SEQSCAN_NSLOTS;
|
||||
ExecCountSlotsNode(innerPlan(node)) +
|
||||
SEQSCAN_NSLOTS;
|
||||
}
|
||||
|
||||
/* ----------------------------------------------------------------
|
||||
|
@ -21,7 +21,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/executor/nodeSetOp.c,v 1.4 2001/03/22 06:16:13 momjian Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/executor/nodeSetOp.c,v 1.5 2001/10/25 05:49:29 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -100,7 +100,6 @@ ExecSetOp(SetOp *node)
|
||||
|
||||
if (TupIsNull(resultTupleSlot))
|
||||
{
|
||||
|
||||
/*
|
||||
* First of group: save a copy in result slot, and reset
|
||||
* duplicate-counters for new group.
|
||||
@ -118,7 +117,6 @@ ExecSetOp(SetOp *node)
|
||||
}
|
||||
else if (setopstate->subplan_done)
|
||||
{
|
||||
|
||||
/*
|
||||
* Reached end of input, so finish processing final group
|
||||
*/
|
||||
@ -126,7 +124,6 @@ ExecSetOp(SetOp *node)
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
/*
|
||||
* Else test if the new tuple and the previously saved tuple
|
||||
* match.
|
||||
@ -144,7 +141,6 @@ ExecSetOp(SetOp *node)
|
||||
|
||||
if (endOfGroup)
|
||||
{
|
||||
|
||||
/*
|
||||
* We've reached the end of the group containing resultTuple.
|
||||
* Decide how many copies (if any) to emit. This logic is
|
||||
@ -187,7 +183,6 @@ ExecSetOp(SetOp *node)
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
/*
|
||||
* Current tuple is member of same group as resultTuple. Count
|
||||
* it in the appropriate counter.
|
||||
@ -294,8 +289,8 @@ int
|
||||
ExecCountSlotsSetOp(SetOp *node)
|
||||
{
|
||||
return ExecCountSlotsNode(outerPlan(node)) +
|
||||
ExecCountSlotsNode(innerPlan(node)) +
|
||||
SETOP_NSLOTS;
|
||||
ExecCountSlotsNode(innerPlan(node)) +
|
||||
SETOP_NSLOTS;
|
||||
}
|
||||
|
||||
/* ----------------------------------------------------------------
|
||||
|
@ -8,7 +8,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/executor/nodeSort.c,v 1.34 2001/05/27 20:42:19 tgl Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/executor/nodeSort.c,v 1.35 2001/10/25 05:49:29 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -275,8 +275,8 @@ int
|
||||
ExecCountSlotsSort(Sort *node)
|
||||
{
|
||||
return ExecCountSlotsNode(outerPlan((Plan *) node)) +
|
||||
ExecCountSlotsNode(innerPlan((Plan *) node)) +
|
||||
SORT_NSLOTS;
|
||||
ExecCountSlotsNode(innerPlan((Plan *) node)) +
|
||||
SORT_NSLOTS;
|
||||
}
|
||||
|
||||
/* ----------------------------------------------------------------
|
||||
|
@ -7,7 +7,7 @@
|
||||
* Portions Copyright (c) 1994, Regents of the University of California
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/executor/nodeSubplan.c,v 1.31 2001/09/18 01:59:06 tgl Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/executor/nodeSubplan.c,v 1.32 2001/10/25 05:49:29 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -257,7 +257,6 @@ ExecSubPlan(SubPlan *node, List *pvar, ExprContext *econtext, bool *isNull)
|
||||
|
||||
if (!found)
|
||||
{
|
||||
|
||||
/*
|
||||
* deal with empty subplan result. result/isNull were previously
|
||||
* initialized correctly for all sublink types except EXPR and
|
||||
|
@ -12,7 +12,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/executor/nodeSubqueryscan.c,v 1.10 2001/09/18 01:59:06 tgl Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/executor/nodeSubqueryscan.c,v 1.11 2001/10/25 05:49:29 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -63,8 +63,8 @@ SubqueryNext(SubqueryScan *node)
|
||||
direction = estate->es_direction;
|
||||
|
||||
/*
|
||||
* We need not support EvalPlanQual here, since we are not scanning
|
||||
* a real relation.
|
||||
* We need not support EvalPlanQual here, since we are not scanning a
|
||||
* real relation.
|
||||
*/
|
||||
|
||||
/*
|
||||
@ -92,7 +92,6 @@ SubqueryNext(SubqueryScan *node)
|
||||
TupleTableSlot *
|
||||
ExecSubqueryScan(SubqueryScan *node)
|
||||
{
|
||||
|
||||
/*
|
||||
* use SubqueryNext as access method
|
||||
*/
|
||||
@ -181,8 +180,8 @@ ExecCountSlotsSubqueryScan(SubqueryScan *node)
|
||||
* The subplan has its own tuple table and must not be counted here!
|
||||
*/
|
||||
return ExecCountSlotsNode(outerPlan(node)) +
|
||||
ExecCountSlotsNode(innerPlan(node)) +
|
||||
SUBQUERYSCAN_NSLOTS;
|
||||
ExecCountSlotsNode(innerPlan(node)) +
|
||||
SUBQUERYSCAN_NSLOTS;
|
||||
}
|
||||
|
||||
/* ----------------------------------------------------------------
|
||||
@ -251,6 +250,7 @@ ExecSubqueryReScan(SubqueryScan *node, ExprContext *exprCtxt, Plan *parent)
|
||||
*/
|
||||
if (node->scan.plan.chgParam != NULL)
|
||||
SetChangedParamList(node->subplan, node->scan.plan.chgParam);
|
||||
|
||||
/*
|
||||
* if chgParam of subnode is not null then plan will be re-scanned by
|
||||
* first ExecProcNode.
|
||||
|
@ -8,7 +8,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/executor/nodeTidscan.c,v 1.19 2001/09/29 07:57:06 inoue Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/executor/nodeTidscan.c,v 1.20 2001/10/25 05:49:29 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -29,7 +29,7 @@
|
||||
#include "access/heapam.h"
|
||||
#include "parser/parsetree.h"
|
||||
|
||||
static int TidListCreate(List *, ExprContext *, ItemPointerData []);
|
||||
static int TidListCreate(List *, ExprContext *, ItemPointerData[]);
|
||||
static TupleTableSlot *TidNext(TidScan *node);
|
||||
|
||||
static int
|
||||
@ -80,7 +80,7 @@ TidNext(TidScan *node)
|
||||
|
||||
bool bBackward;
|
||||
int tidNumber;
|
||||
ItemPointerData* tidList;
|
||||
ItemPointerData *tidList;
|
||||
|
||||
/*
|
||||
* extract necessary information from tid scan node
|
||||
@ -233,7 +233,6 @@ TidNext(TidScan *node)
|
||||
TupleTableSlot *
|
||||
ExecTidScan(TidScan *node)
|
||||
{
|
||||
|
||||
/*
|
||||
* use TidNext as access method
|
||||
*/
|
||||
@ -249,7 +248,7 @@ ExecTidReScan(TidScan *node, ExprContext *exprCtxt, Plan *parent)
|
||||
{
|
||||
EState *estate;
|
||||
TidScanState *tidstate;
|
||||
ItemPointerData* tidList;
|
||||
ItemPointerData *tidList;
|
||||
|
||||
tidstate = node->tidstate;
|
||||
estate = node->scan.plan.state;
|
||||
@ -357,7 +356,6 @@ ExecTidRestrPos(TidScan *node)
|
||||
tidstate = node->tidstate;
|
||||
tidstate->tss_TidPtr = tidstate->tss_MarkTidPtr;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
/* ----------------------------------------------------------------
|
||||
@ -376,7 +374,7 @@ ExecInitTidScan(TidScan *node, EState *estate, Plan *parent)
|
||||
{
|
||||
TidScanState *tidstate;
|
||||
CommonScanState *scanstate;
|
||||
ItemPointerData* tidList;
|
||||
ItemPointerData *tidList;
|
||||
int numTids;
|
||||
int tidPtr;
|
||||
List *rangeTable;
|
||||
@ -482,5 +480,5 @@ int
|
||||
ExecCountSlotsTidScan(TidScan *node)
|
||||
{
|
||||
return ExecCountSlotsNode(outerPlan((Plan *) node)) +
|
||||
ExecCountSlotsNode(innerPlan((Plan *) node)) + TIDSCAN_NSLOTS;
|
||||
ExecCountSlotsNode(innerPlan((Plan *) node)) + TIDSCAN_NSLOTS;
|
||||
}
|
||||
|
@ -8,7 +8,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/executor/nodeUnique.c,v 1.32 2001/03/22 06:16:13 momjian Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/executor/nodeUnique.c,v 1.33 2001/10/25 05:49:29 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -61,7 +61,6 @@ ExecUnique(Unique *node)
|
||||
*/
|
||||
for (;;)
|
||||
{
|
||||
|
||||
/*
|
||||
* fetch a tuple from the outer subplan
|
||||
*/
|
||||
@ -186,8 +185,8 @@ int
|
||||
ExecCountSlotsUnique(Unique *node)
|
||||
{
|
||||
return ExecCountSlotsNode(outerPlan(node)) +
|
||||
ExecCountSlotsNode(innerPlan(node)) +
|
||||
UNIQUE_NSLOTS;
|
||||
ExecCountSlotsNode(innerPlan(node)) +
|
||||
UNIQUE_NSLOTS;
|
||||
}
|
||||
|
||||
/* ----------------------------------------------------------------
|
||||
|
@ -8,7 +8,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/executor/spi.c,v 1.59 2001/10/23 17:38:25 tgl Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/executor/spi.c,v 1.60 2001/10/25 05:49:29 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -37,7 +37,7 @@ static int _SPI_execute_plan(_SPI_plan *plan,
|
||||
Datum *Values, char *Nulls, int tcount);
|
||||
|
||||
static void _SPI_cursor_operation(Portal portal, bool forward, int count,
|
||||
CommandDest dest);
|
||||
CommandDest dest);
|
||||
|
||||
static _SPI_plan *_SPI_copy_plan(_SPI_plan *plan, int location);
|
||||
|
||||
@ -51,7 +51,6 @@ static bool _SPI_checktuples(void);
|
||||
extern int ShowExecutorStats;
|
||||
extern void ResetUsage(void);
|
||||
extern void ShowUsage(void);
|
||||
|
||||
#endif
|
||||
|
||||
/* =================== interface functions =================== */
|
||||
@ -298,7 +297,7 @@ SPI_saveplan(void *plan)
|
||||
int
|
||||
SPI_freeplan(void *plan)
|
||||
{
|
||||
_SPI_plan *spiplan = (_SPI_plan *)plan;
|
||||
_SPI_plan *spiplan = (_SPI_plan *) plan;
|
||||
|
||||
if (plan == NULL)
|
||||
return SPI_ERROR_ARGUMENT;
|
||||
@ -444,7 +443,7 @@ SPI_fnumber(TupleDesc tupdesc, char *fname)
|
||||
return res + 1;
|
||||
}
|
||||
|
||||
sysatt = SystemAttributeByName(fname, true /* "oid" will be accepted */);
|
||||
sysatt = SystemAttributeByName(fname, true /* "oid" will be accepted */ );
|
||||
if (sysatt != NULL)
|
||||
return sysatt->attnum;
|
||||
|
||||
@ -673,26 +672,26 @@ SPI_freetuptable(SPITupleTable *tuptable)
|
||||
Portal
|
||||
SPI_cursor_open(char *name, void *plan, Datum *Values, char *Nulls)
|
||||
{
|
||||
static int unnamed_portal_count = 0;
|
||||
static int unnamed_portal_count = 0;
|
||||
|
||||
_SPI_plan *spiplan = (_SPI_plan *)plan;
|
||||
List *qtlist = spiplan->qtlist;
|
||||
List *ptlist = spiplan->ptlist;
|
||||
Query *queryTree;
|
||||
Plan *planTree;
|
||||
QueryDesc *queryDesc;
|
||||
EState *eState;
|
||||
TupleDesc attinfo;
|
||||
MemoryContext oldcontext;
|
||||
Portal portal;
|
||||
char portalname[64];
|
||||
int k;
|
||||
_SPI_plan *spiplan = (_SPI_plan *) plan;
|
||||
List *qtlist = spiplan->qtlist;
|
||||
List *ptlist = spiplan->ptlist;
|
||||
Query *queryTree;
|
||||
Plan *planTree;
|
||||
QueryDesc *queryDesc;
|
||||
EState *eState;
|
||||
TupleDesc attinfo;
|
||||
MemoryContext oldcontext;
|
||||
Portal portal;
|
||||
char portalname[64];
|
||||
int k;
|
||||
|
||||
/* Ensure that the plan contains only one regular SELECT query */
|
||||
if (length(ptlist) != 1)
|
||||
elog(ERROR, "cannot open multi-query plan as cursor");
|
||||
queryTree = (Query *)lfirst(qtlist);
|
||||
planTree = (Plan *)lfirst(ptlist);
|
||||
queryTree = (Query *) lfirst(qtlist);
|
||||
planTree = (Plan *) lfirst(ptlist);
|
||||
|
||||
if (queryTree->commandType != CMD_SELECT)
|
||||
elog(ERROR, "plan in SPI_cursor_open() is not a SELECT");
|
||||
@ -712,7 +711,7 @@ SPI_cursor_open(char *name, void *plan, Datum *Values, char *Nulls)
|
||||
{
|
||||
for (;;)
|
||||
{
|
||||
unnamed_portal_count++;
|
||||
unnamed_portal_count++;
|
||||
if (unnamed_portal_count < 0)
|
||||
unnamed_portal_count = 0;
|
||||
sprintf(portalname, "<unnamed cursor %d>", unnamed_portal_count);
|
||||
@ -735,30 +734,31 @@ SPI_cursor_open(char *name, void *plan, Datum *Values, char *Nulls)
|
||||
|
||||
/* Switch to portals memory and copy the parsetree and plan to there */
|
||||
oldcontext = MemoryContextSwitchTo(PortalGetHeapMemory(portal));
|
||||
queryTree = copyObject(queryTree);
|
||||
planTree = copyObject(planTree);
|
||||
queryTree = copyObject(queryTree);
|
||||
planTree = copyObject(planTree);
|
||||
|
||||
/* Modify the parsetree to be a cursor */
|
||||
queryTree->isPortal = true;
|
||||
queryTree->into = pstrdup(name);
|
||||
queryTree->into = pstrdup(name);
|
||||
queryTree->isBinary = false;
|
||||
|
||||
|
||||
/* Create the QueryDesc object and the executor state */
|
||||
queryDesc = CreateQueryDesc(queryTree, planTree, SPI);
|
||||
eState = CreateExecutorState();
|
||||
eState = CreateExecutorState();
|
||||
|
||||
/* If the plan has parameters, put them into the executor state */
|
||||
if (spiplan->nargs > 0)
|
||||
{
|
||||
ParamListInfo paramLI = (ParamListInfo) palloc((spiplan->nargs + 1) *
|
||||
sizeof(ParamListInfoData));
|
||||
ParamListInfo paramLI = (ParamListInfo) palloc((spiplan->nargs + 1) *
|
||||
sizeof(ParamListInfoData));
|
||||
|
||||
eState->es_param_list_info = paramLI;
|
||||
for (k = 0; k < spiplan->nargs; paramLI++, k++)
|
||||
{
|
||||
paramLI->kind = PARAM_NUM;
|
||||
paramLI->id = k + 1;
|
||||
paramLI->isnull = (Nulls && Nulls[k] == 'n');
|
||||
paramLI->value = Values[k];
|
||||
paramLI->kind = PARAM_NUM;
|
||||
paramLI->id = k + 1;
|
||||
paramLI->isnull = (Nulls && Nulls[k] == 'n');
|
||||
paramLI->value = Values[k];
|
||||
}
|
||||
paramLI->kind = PARAM_INVALID;
|
||||
}
|
||||
@ -872,7 +872,7 @@ spi_printtup(HeapTuple tuple, TupleDesc tupdesc, DestReceiver *self)
|
||||
tuptable->vals = (HeapTuple *) palloc(tuptable->alloced * sizeof(HeapTuple));
|
||||
tuptable->tupdesc = CreateTupleDescCopy(tupdesc);
|
||||
}
|
||||
else
|
||||
else
|
||||
{
|
||||
MemoryContextSwitchTo(tuptable->tuptabcxt);
|
||||
|
||||
@ -881,7 +881,7 @@ spi_printtup(HeapTuple tuple, TupleDesc tupdesc, DestReceiver *self)
|
||||
tuptable->free = 256;
|
||||
tuptable->alloced += tuptable->free;
|
||||
tuptable->vals = (HeapTuple *) repalloc(tuptable->vals,
|
||||
tuptable->alloced * sizeof(HeapTuple));
|
||||
tuptable->alloced * sizeof(HeapTuple));
|
||||
}
|
||||
}
|
||||
|
||||
@ -1171,12 +1171,12 @@ _SPI_pquery(QueryDesc *queryDesc, EState *state, int tcount)
|
||||
*/
|
||||
static void
|
||||
_SPI_cursor_operation(Portal portal, bool forward, int count,
|
||||
CommandDest dest)
|
||||
CommandDest dest)
|
||||
{
|
||||
QueryDesc *querydesc;
|
||||
EState *estate;
|
||||
MemoryContext oldcontext;
|
||||
CommandDest olddest;
|
||||
QueryDesc *querydesc;
|
||||
EState *estate;
|
||||
MemoryContext oldcontext;
|
||||
CommandDest olddest;
|
||||
|
||||
/* Check that the portal is valid */
|
||||
if (!PortalIsValid(portal))
|
||||
@ -1193,8 +1193,8 @@ _SPI_cursor_operation(Portal portal, bool forward, int count,
|
||||
|
||||
/* Switch to the portals memory context */
|
||||
oldcontext = MemoryContextSwitchTo(PortalGetHeapMemory(portal));
|
||||
querydesc = PortalGetQueryDesc(portal);
|
||||
estate = PortalGetState(portal);
|
||||
querydesc = PortalGetQueryDesc(portal);
|
||||
estate = PortalGetState(portal);
|
||||
|
||||
/* Save the queries command destination and set it to SPI (for fetch) */
|
||||
/* or None (for move) */
|
||||
@ -1206,7 +1206,7 @@ _SPI_cursor_operation(Portal portal, bool forward, int count,
|
||||
{
|
||||
if (!portal->atEnd)
|
||||
{
|
||||
ExecutorRun(querydesc, estate, EXEC_FOR, (long)count);
|
||||
ExecutorRun(querydesc, estate, EXEC_FOR, (long) count);
|
||||
_SPI_current->processed = estate->es_processed;
|
||||
if (estate->es_processed > 0)
|
||||
portal->atStart = false;
|
||||
@ -1237,7 +1237,7 @@ _SPI_cursor_operation(Portal portal, bool forward, int count,
|
||||
|
||||
/* Put the result into place for access by caller */
|
||||
SPI_processed = _SPI_current->processed;
|
||||
SPI_tuptable = _SPI_current->tuptable;
|
||||
SPI_tuptable = _SPI_current->tuptable;
|
||||
|
||||
/* Pop the SPI stack */
|
||||
_SPI_end_call(true);
|
||||
@ -1278,7 +1278,6 @@ _SPI_begin_call(bool execmem)
|
||||
static int
|
||||
_SPI_end_call(bool procmem)
|
||||
{
|
||||
|
||||
/*
|
||||
* We' returning to procedure where _SPI_curid == _SPI_connected - 1
|
||||
*/
|
||||
|
Reference in New Issue
Block a user