mirror of
https://github.com/postgres/postgres.git
synced 2025-07-02 09:02:37 +03:00
Another PGINDENT run that changes variable indenting and case label indenting. Also static variable indenting.
This commit is contained in:
@ -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_SeqScan:
|
||||
ExecSeqReScan((SeqScan *) node, exprCtxt, parent);
|
||||
return;
|
||||
|
||||
case T_IndexScan:
|
||||
ExecIndexReScan((IndexScan *) node, exprCtxt, parent);
|
||||
return;
|
||||
case T_IndexScan:
|
||||
ExecIndexReScan((IndexScan *) node, exprCtxt, parent);
|
||||
return;
|
||||
|
||||
case T_Material:
|
||||
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;
|
||||
/*
|
||||
* 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);
|
||||
|
@ -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,
|
||||
|
@ -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;
|
||||
|
@ -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_DELETE:
|
||||
ExecDelete(slot, tupleid, estate);
|
||||
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;
|
||||
|
||||
Async_Notify(rDesc->rd_rel->relname.data);
|
||||
case CMD_INSERT:
|
||||
ExecAppend(slot, tupleid, estate);
|
||||
result = NULL;
|
||||
current_tuple_count = 0;
|
||||
numberTuples = 1;
|
||||
elog(DEBUG, "ExecNotify %s", &rDesc->rd_rel->relname);
|
||||
}
|
||||
break;
|
||||
break;
|
||||
|
||||
default:
|
||||
elog(DEBUG, "ExecutePlan: unknown operation in queryDesc");
|
||||
result = NULL;
|
||||
break;
|
||||
case CMD_DELETE:
|
||||
ExecDelete(slot, tupleid, estate);
|
||||
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;
|
||||
|
||||
Async_Notify(rDesc->rd_rel->relname.data);
|
||||
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;
|
||||
}
|
||||
/* ----------------
|
||||
* 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);
|
||||
|
@ -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;
|
||||
/* ----------------
|
||||
* control nodes
|
||||
* ----------------
|
||||
*/
|
||||
case T_Result:
|
||||
result = ExecInitResult((Result *) node, estate, parent);
|
||||
break;
|
||||
|
||||
case T_Append:
|
||||
result = ExecInitAppend((Append *) 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;
|
||||
/* ----------------
|
||||
* scan nodes
|
||||
* ----------------
|
||||
*/
|
||||
case T_SeqScan:
|
||||
result = ExecInitSeqScan((SeqScan *) node, estate, parent);
|
||||
break;
|
||||
|
||||
case T_IndexScan:
|
||||
result = ExecInitIndexScan((IndexScan *) 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;
|
||||
/* ----------------
|
||||
* join nodes
|
||||
* ----------------
|
||||
*/
|
||||
case T_NestLoop:
|
||||
result = ExecInitNestLoop((NestLoop *) node, estate, parent);
|
||||
break;
|
||||
|
||||
case T_MergeJoin:
|
||||
result = ExecInitMergeJoin((MergeJoin *) 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;
|
||||
/* ----------------
|
||||
* materialization nodes
|
||||
* ----------------
|
||||
*/
|
||||
case T_Material:
|
||||
result = ExecInitMaterial((Material *) node, estate, parent);
|
||||
break;
|
||||
|
||||
case T_Sort:
|
||||
result = ExecInitSort((Sort *) 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_Unique:
|
||||
result = ExecInitUnique((Unique *) node, estate, parent);
|
||||
break;
|
||||
|
||||
case T_Group:
|
||||
result = ExecInitGroup((Group *) 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_Agg:
|
||||
result = ExecInitAgg((Agg *) node, estate, parent);
|
||||
break;
|
||||
|
||||
case T_Hash:
|
||||
result = ExecInitHash((Hash *) 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_HashJoin:
|
||||
result = ExecInitHashJoin((HashJoin *) node, estate, parent);
|
||||
break;
|
||||
|
||||
case T_Tee:
|
||||
result = ExecInitTee((Tee *) 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;
|
||||
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;
|
||||
/* ----------------
|
||||
* control nodes
|
||||
* ----------------
|
||||
*/
|
||||
case T_Result:
|
||||
result = ExecResult((Result *) node);
|
||||
break;
|
||||
|
||||
case T_Append:
|
||||
result = ExecProcAppend((Append *) node);
|
||||
break;
|
||||
case T_Append:
|
||||
result = ExecProcAppend((Append *) node);
|
||||
break;
|
||||
|
||||
/* ----------------
|
||||
* scan nodes
|
||||
* ----------------
|
||||
*/
|
||||
case T_SeqScan:
|
||||
result = ExecSeqScan((SeqScan *) node);
|
||||
break;
|
||||
/* ----------------
|
||||
* scan nodes
|
||||
* ----------------
|
||||
*/
|
||||
case T_SeqScan:
|
||||
result = ExecSeqScan((SeqScan *) node);
|
||||
break;
|
||||
|
||||
case T_IndexScan:
|
||||
result = ExecIndexScan((IndexScan *) node);
|
||||
break;
|
||||
case T_IndexScan:
|
||||
result = ExecIndexScan((IndexScan *) node);
|
||||
break;
|
||||
|
||||
/* ----------------
|
||||
* join nodes
|
||||
* ----------------
|
||||
*/
|
||||
case T_NestLoop:
|
||||
result = ExecNestLoop((NestLoop *) node, parent);
|
||||
break;
|
||||
/* ----------------
|
||||
* join nodes
|
||||
* ----------------
|
||||
*/
|
||||
case T_NestLoop:
|
||||
result = ExecNestLoop((NestLoop *) node, parent);
|
||||
break;
|
||||
|
||||
case T_MergeJoin:
|
||||
result = ExecMergeJoin((MergeJoin *) node);
|
||||
break;
|
||||
case T_MergeJoin:
|
||||
result = ExecMergeJoin((MergeJoin *) node);
|
||||
break;
|
||||
|
||||
/* ----------------
|
||||
* materialization nodes
|
||||
* ----------------
|
||||
*/
|
||||
case T_Material:
|
||||
result = ExecMaterial((Material *) node);
|
||||
break;
|
||||
/* ----------------
|
||||
* materialization nodes
|
||||
* ----------------
|
||||
*/
|
||||
case T_Material:
|
||||
result = ExecMaterial((Material *) node);
|
||||
break;
|
||||
|
||||
case T_Sort:
|
||||
result = ExecSort((Sort *) node);
|
||||
break;
|
||||
case T_Sort:
|
||||
result = ExecSort((Sort *) node);
|
||||
break;
|
||||
|
||||
case T_Unique:
|
||||
result = ExecUnique((Unique *) node);
|
||||
break;
|
||||
case T_Unique:
|
||||
result = ExecUnique((Unique *) node);
|
||||
break;
|
||||
|
||||
case T_Group:
|
||||
result = ExecGroup((Group *) node);
|
||||
break;
|
||||
case T_Group:
|
||||
result = ExecGroup((Group *) node);
|
||||
break;
|
||||
|
||||
case T_Agg:
|
||||
result = ExecAgg((Agg *) node);
|
||||
break;
|
||||
case T_Agg:
|
||||
result = ExecAgg((Agg *) node);
|
||||
break;
|
||||
|
||||
case T_Hash:
|
||||
result = ExecHash((Hash *) node);
|
||||
break;
|
||||
case T_Hash:
|
||||
result = ExecHash((Hash *) node);
|
||||
break;
|
||||
|
||||
case T_HashJoin:
|
||||
result = ExecHashJoin((HashJoin *) node);
|
||||
break;
|
||||
case T_HashJoin:
|
||||
result = ExecHashJoin((HashJoin *) node);
|
||||
break;
|
||||
|
||||
case T_Tee:
|
||||
result = ExecTee((Tee *) node, parent);
|
||||
break;
|
||||
case T_Tee:
|
||||
result = ExecTee((Tee *) node, parent);
|
||||
break;
|
||||
|
||||
default:
|
||||
elog(DEBUG, "ExecProcNode: node not yet supported: %d",
|
||||
nodeTag(node));
|
||||
result = FALSE;
|
||||
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);
|
||||
/* ----------------
|
||||
* control nodes
|
||||
* ----------------
|
||||
*/
|
||||
case T_Result:
|
||||
return ExecCountSlotsResult((Result *) node);
|
||||
|
||||
case T_Append:
|
||||
return ExecCountSlotsAppend((Append *) node);
|
||||
case T_Append:
|
||||
return ExecCountSlotsAppend((Append *) node);
|
||||
|
||||
/* ----------------
|
||||
* scan nodes
|
||||
* ----------------
|
||||
*/
|
||||
case T_SeqScan:
|
||||
return ExecCountSlotsSeqScan((SeqScan *) node);
|
||||
/* ----------------
|
||||
* scan nodes
|
||||
* ----------------
|
||||
*/
|
||||
case T_SeqScan:
|
||||
return ExecCountSlotsSeqScan((SeqScan *) node);
|
||||
|
||||
case T_IndexScan:
|
||||
return ExecCountSlotsIndexScan((IndexScan *) node);
|
||||
case T_IndexScan:
|
||||
return ExecCountSlotsIndexScan((IndexScan *) node);
|
||||
|
||||
/* ----------------
|
||||
* join nodes
|
||||
* ----------------
|
||||
*/
|
||||
case T_NestLoop:
|
||||
return ExecCountSlotsNestLoop((NestLoop *) node);
|
||||
/* ----------------
|
||||
* join nodes
|
||||
* ----------------
|
||||
*/
|
||||
case T_NestLoop:
|
||||
return ExecCountSlotsNestLoop((NestLoop *) node);
|
||||
|
||||
case T_MergeJoin:
|
||||
return ExecCountSlotsMergeJoin((MergeJoin *) node);
|
||||
case T_MergeJoin:
|
||||
return ExecCountSlotsMergeJoin((MergeJoin *) node);
|
||||
|
||||
/* ----------------
|
||||
* materialization nodes
|
||||
* ----------------
|
||||
*/
|
||||
case T_Material:
|
||||
return ExecCountSlotsMaterial((Material *) node);
|
||||
/* ----------------
|
||||
* materialization nodes
|
||||
* ----------------
|
||||
*/
|
||||
case T_Material:
|
||||
return ExecCountSlotsMaterial((Material *) node);
|
||||
|
||||
case T_Sort:
|
||||
return ExecCountSlotsSort((Sort *) node);
|
||||
case T_Sort:
|
||||
return ExecCountSlotsSort((Sort *) node);
|
||||
|
||||
case T_Unique:
|
||||
return ExecCountSlotsUnique((Unique *) node);
|
||||
case T_Unique:
|
||||
return ExecCountSlotsUnique((Unique *) node);
|
||||
|
||||
case T_Group:
|
||||
return ExecCountSlotsGroup((Group *) node);
|
||||
case T_Group:
|
||||
return ExecCountSlotsGroup((Group *) node);
|
||||
|
||||
case T_Agg:
|
||||
return ExecCountSlotsAgg((Agg *) node);
|
||||
case T_Agg:
|
||||
return ExecCountSlotsAgg((Agg *) node);
|
||||
|
||||
case T_Hash:
|
||||
return ExecCountSlotsHash((Hash *) node);
|
||||
case T_Hash:
|
||||
return ExecCountSlotsHash((Hash *) node);
|
||||
|
||||
case T_HashJoin:
|
||||
return ExecCountSlotsHashJoin((HashJoin *) node);
|
||||
case T_HashJoin:
|
||||
return ExecCountSlotsHashJoin((HashJoin *) node);
|
||||
|
||||
case T_Tee:
|
||||
return ExecCountSlotsTee((Tee *) node);
|
||||
case T_Tee:
|
||||
return ExecCountSlotsTee((Tee *) node);
|
||||
|
||||
default:
|
||||
elog(WARN, "ExecCountSlotsNode: node not yet supported: %d",
|
||||
nodeTag(node));
|
||||
break;
|
||||
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;
|
||||
/* ----------------
|
||||
* control nodes
|
||||
* ----------------
|
||||
*/
|
||||
case T_Result:
|
||||
ExecEndResult((Result *) node);
|
||||
break;
|
||||
|
||||
case T_Append:
|
||||
ExecEndAppend((Append *) node);
|
||||
break;
|
||||
case T_Append:
|
||||
ExecEndAppend((Append *) node);
|
||||
break;
|
||||
|
||||
/* ----------------
|
||||
* scan nodes
|
||||
* ----------------
|
||||
*/
|
||||
case T_SeqScan:
|
||||
ExecEndSeqScan((SeqScan *) node);
|
||||
break;
|
||||
/* ----------------
|
||||
* scan nodes
|
||||
* ----------------
|
||||
*/
|
||||
case T_SeqScan:
|
||||
ExecEndSeqScan((SeqScan *) node);
|
||||
break;
|
||||
|
||||
case T_IndexScan:
|
||||
ExecEndIndexScan((IndexScan *) node);
|
||||
break;
|
||||
case T_IndexScan:
|
||||
ExecEndIndexScan((IndexScan *) node);
|
||||
break;
|
||||
|
||||
/* ----------------
|
||||
* join nodes
|
||||
* ----------------
|
||||
*/
|
||||
case T_NestLoop:
|
||||
ExecEndNestLoop((NestLoop *) node);
|
||||
break;
|
||||
/* ----------------
|
||||
* join nodes
|
||||
* ----------------
|
||||
*/
|
||||
case T_NestLoop:
|
||||
ExecEndNestLoop((NestLoop *) node);
|
||||
break;
|
||||
|
||||
case T_MergeJoin:
|
||||
ExecEndMergeJoin((MergeJoin *) node);
|
||||
break;
|
||||
case T_MergeJoin:
|
||||
ExecEndMergeJoin((MergeJoin *) node);
|
||||
break;
|
||||
|
||||
/* ----------------
|
||||
* materialization nodes
|
||||
* ----------------
|
||||
*/
|
||||
case T_Material:
|
||||
ExecEndMaterial((Material *) node);
|
||||
break;
|
||||
/* ----------------
|
||||
* materialization nodes
|
||||
* ----------------
|
||||
*/
|
||||
case T_Material:
|
||||
ExecEndMaterial((Material *) node);
|
||||
break;
|
||||
|
||||
case T_Sort:
|
||||
ExecEndSort((Sort *) node);
|
||||
break;
|
||||
case T_Sort:
|
||||
ExecEndSort((Sort *) node);
|
||||
break;
|
||||
|
||||
case T_Unique:
|
||||
ExecEndUnique((Unique *) node);
|
||||
break;
|
||||
case T_Unique:
|
||||
ExecEndUnique((Unique *) node);
|
||||
break;
|
||||
|
||||
case T_Group:
|
||||
ExecEndGroup((Group *) node);
|
||||
break;
|
||||
case T_Group:
|
||||
ExecEndGroup((Group *) node);
|
||||
break;
|
||||
|
||||
case T_Agg:
|
||||
ExecEndAgg((Agg *) node);
|
||||
break;
|
||||
case T_Agg:
|
||||
ExecEndAgg((Agg *) node);
|
||||
break;
|
||||
|
||||
/* ----------------
|
||||
* XXX add hooks to these
|
||||
* ----------------
|
||||
*/
|
||||
case T_Hash:
|
||||
ExecEndHash((Hash *) node);
|
||||
break;
|
||||
/* ----------------
|
||||
* XXX add hooks to these
|
||||
* ----------------
|
||||
*/
|
||||
case T_Hash:
|
||||
ExecEndHash((Hash *) node);
|
||||
break;
|
||||
|
||||
case T_HashJoin:
|
||||
ExecEndHashJoin((HashJoin *) node);
|
||||
break;
|
||||
case T_HashJoin:
|
||||
ExecEndHashJoin((HashJoin *) node);
|
||||
break;
|
||||
|
||||
case T_Tee:
|
||||
ExecEndTee((Tee *) node, parent);
|
||||
break;
|
||||
case T_Tee:
|
||||
ExecEndTee((Tee *) node, parent);
|
||||
break;
|
||||
|
||||
default:
|
||||
elog(DEBUG, "ExecEndNode: node not yet supported",
|
||||
nodeTag(node));
|
||||
break;
|
||||
default:
|
||||
elog(DEBUG, "ExecEndNode: node not yet supported",
|
||||
nodeTag(node));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -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;
|
||||
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)
|
||||
{
|
||||
elog(WARN,
|
||||
"ExecEvalParam: new/old params with same id & diff names");
|
||||
}
|
||||
}
|
||||
break;
|
||||
default:
|
||||
|
||||
/*
|
||||
* sanity check
|
||||
* oops! this is not supposed to happen!
|
||||
*/
|
||||
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);
|
||||
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;
|
||||
|
||||
if (con->constisnull)
|
||||
*isNull = true;
|
||||
retDatum = con->constvalue;
|
||||
case T_Var:
|
||||
retDatum = (Datum) ExecEvalVar((Var *) 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_Const:
|
||||
{
|
||||
Const *con = (Const *) expression;
|
||||
|
||||
if (con->constisnull)
|
||||
*isNull = true;
|
||||
retDatum = con->constvalue;
|
||||
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_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
|
||||
|
@ -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;
|
||||
|
||||
|
||||
|
@ -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;
|
||||
case T_Result:
|
||||
{
|
||||
ResultState *resstate = ((Result *) node)->resstate;
|
||||
|
||||
slot = resstate->cstate.cs_ResultTupleSlot;
|
||||
}
|
||||
break;
|
||||
|
||||
case T_SeqScan:
|
||||
{
|
||||
CommonScanState *scanstate = ((SeqScan *) node)->scanstate;
|
||||
|
||||
slot = scanstate->cstate.cs_ResultTupleSlot;
|
||||
}
|
||||
break;
|
||||
|
||||
case T_NestLoop:
|
||||
{
|
||||
NestLoopState *nlstate = ((NestLoop *) node)->nlstate;
|
||||
|
||||
slot = nlstate->jstate.cs_ResultTupleSlot;
|
||||
}
|
||||
break;
|
||||
|
||||
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 = resstate->cstate.cs_ResultTupleSlot;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
case T_IndexScan:
|
||||
{
|
||||
CommonScanState *scanstate = ((IndexScan *) node)->scan.scanstate;
|
||||
case T_SeqScan:
|
||||
{
|
||||
CommonScanState *scanstate = ((SeqScan *) node)->scanstate;
|
||||
|
||||
slot = scanstate->cstate.cs_ResultTupleSlot;
|
||||
}
|
||||
break;
|
||||
slot = scanstate->cstate.cs_ResultTupleSlot;
|
||||
}
|
||||
break;
|
||||
|
||||
case T_Material:
|
||||
{
|
||||
MaterialState *matstate = ((Material *) node)->matstate;
|
||||
case T_NestLoop:
|
||||
{
|
||||
NestLoopState *nlstate = ((NestLoop *) node)->nlstate;
|
||||
|
||||
slot = matstate->csstate.css_ScanTupleSlot;
|
||||
}
|
||||
break;
|
||||
slot = nlstate->jstate.cs_ResultTupleSlot;
|
||||
}
|
||||
break;
|
||||
|
||||
case T_Sort:
|
||||
{
|
||||
SortState *sortstate = ((Sort *) node)->sortstate;
|
||||
case T_Append:
|
||||
{
|
||||
Append *n = (Append *) node;
|
||||
AppendState *unionstate;
|
||||
List *unionplans;
|
||||
int whichplan;
|
||||
Plan *subplan;
|
||||
|
||||
slot = sortstate->csstate.css_ScanTupleSlot;
|
||||
}
|
||||
break;
|
||||
unionstate = n->unionstate;
|
||||
unionplans = n->unionplans;
|
||||
whichplan = unionstate->as_whichplan;
|
||||
|
||||
case T_Agg:
|
||||
{
|
||||
AggState *aggstate = ((Agg *) node)->aggstate;
|
||||
subplan = (Plan *) nth(whichplan, unionplans);
|
||||
slot = NodeGetResultTupleSlot(subplan);
|
||||
break;
|
||||
}
|
||||
|
||||
slot = aggstate->csstate.cstate.cs_ResultTupleSlot;
|
||||
}
|
||||
break;
|
||||
case T_IndexScan:
|
||||
{
|
||||
CommonScanState *scanstate = ((IndexScan *) node)->scan.scanstate;
|
||||
|
||||
case T_Group:
|
||||
{
|
||||
GroupState *grpstate = ((Group *) node)->grpstate;
|
||||
slot = scanstate->cstate.cs_ResultTupleSlot;
|
||||
}
|
||||
break;
|
||||
|
||||
slot = grpstate->csstate.cstate.cs_ResultTupleSlot;
|
||||
}
|
||||
break;
|
||||
case T_Material:
|
||||
{
|
||||
MaterialState *matstate = ((Material *) node)->matstate;
|
||||
|
||||
case T_Hash:
|
||||
{
|
||||
HashState *hashstate = ((Hash *) node)->hashstate;
|
||||
slot = matstate->csstate.css_ScanTupleSlot;
|
||||
}
|
||||
break;
|
||||
|
||||
slot = hashstate->cstate.cs_ResultTupleSlot;
|
||||
}
|
||||
break;
|
||||
case T_Sort:
|
||||
{
|
||||
SortState *sortstate = ((Sort *) node)->sortstate;
|
||||
|
||||
case T_Unique:
|
||||
{
|
||||
UniqueState *uniquestate = ((Unique *) node)->uniquestate;
|
||||
slot = sortstate->csstate.css_ScanTupleSlot;
|
||||
}
|
||||
break;
|
||||
|
||||
slot = uniquestate->cs_ResultTupleSlot;
|
||||
}
|
||||
break;
|
||||
case T_Agg:
|
||||
{
|
||||
AggState *aggstate = ((Agg *) node)->aggstate;
|
||||
|
||||
case T_MergeJoin:
|
||||
{
|
||||
MergeJoinState *mergestate = ((MergeJoin *) node)->mergestate;
|
||||
slot = aggstate->csstate.cstate.cs_ResultTupleSlot;
|
||||
}
|
||||
break;
|
||||
|
||||
slot = mergestate->jstate.cs_ResultTupleSlot;
|
||||
}
|
||||
break;
|
||||
case T_Group:
|
||||
{
|
||||
GroupState *grpstate = ((Group *) node)->grpstate;
|
||||
|
||||
case T_HashJoin:
|
||||
{
|
||||
HashJoinState *hashjoinstate = ((HashJoin *) node)->hashjoinstate;
|
||||
slot = grpstate->csstate.cstate.cs_ResultTupleSlot;
|
||||
}
|
||||
break;
|
||||
|
||||
slot = hashjoinstate->jstate.cs_ResultTupleSlot;
|
||||
}
|
||||
break;
|
||||
case T_Hash:
|
||||
{
|
||||
HashState *hashstate = ((Hash *) node)->hashstate;
|
||||
|
||||
case T_Tee:
|
||||
{
|
||||
TeeState *teestate = ((Tee *) node)->teestate;
|
||||
slot = hashstate->cstate.cs_ResultTupleSlot;
|
||||
}
|
||||
break;
|
||||
|
||||
slot = teestate->cstate.cs_ResultTupleSlot;
|
||||
}
|
||||
break;
|
||||
case T_Unique:
|
||||
{
|
||||
UniqueState *uniquestate = ((Unique *) node)->uniquestate;
|
||||
|
||||
default:
|
||||
/* ----------------
|
||||
* should never get here
|
||||
* ----------------
|
||||
*/
|
||||
elog(WARN, "NodeGetResultTupleSlot: node not yet supported: %d ",
|
||||
nodeTag(node));
|
||||
slot = uniquestate->cs_ResultTupleSlot;
|
||||
}
|
||||
break;
|
||||
|
||||
return NULL;
|
||||
case T_MergeJoin:
|
||||
{
|
||||
MergeJoinState *mergestate = ((MergeJoin *) node)->mergestate;
|
||||
|
||||
slot = mergestate->jstate.cs_ResultTupleSlot;
|
||||
}
|
||||
break;
|
||||
|
||||
case T_HashJoin:
|
||||
{
|
||||
HashJoinState *hashjoinstate = ((HashJoin *) node)->hashjoinstate;
|
||||
|
||||
slot = hashjoinstate->jstate.cs_ResultTupleSlot;
|
||||
}
|
||||
break;
|
||||
|
||||
case T_Tee:
|
||||
{
|
||||
TeeState *teestate = ((Tee *) node)->teestate;
|
||||
|
||||
slot = teestate->cstate.cs_ResultTupleSlot;
|
||||
}
|
||||
break;
|
||||
|
||||
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;
|
||||
|
||||
|
@ -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;
|
||||
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;
|
||||
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;
|
||||
IndexTuple indexTuple;
|
||||
TupleDesc heapDescriptor;
|
||||
TupleDesc indexDescriptor;
|
||||
Datum *datum;
|
||||
char *nulls;
|
||||
|
||||
int numberOfAttributes;
|
||||
AttrNumber *keyAttributeNumbers;
|
||||
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++)
|
||||
{
|
||||
|
@ -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
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
@ -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++)
|
||||
{
|
||||
|
@ -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)
|
||||
|
@ -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));
|
||||
|
@ -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;
|
||||
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;
|
||||
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;
|
||||
Pointer *runtimeKeyInfo;
|
||||
bool have_runtime_keys;
|
||||
List *rangeTable;
|
||||
RangeTblEntry *rtentry;
|
||||
Index relid;
|
||||
Oid reloid;
|
||||
TimeQual timeQual;
|
||||
|
||||
Relation currentRelation;
|
||||
HeapScanDesc currentScanDesc;
|
||||
ScanDirection direction;
|
||||
int baseid;
|
||||
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;
|
||||
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) */
|
||||
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);
|
||||
|
||||
|
@ -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.
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -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");
|
||||
|
@ -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;
|
||||
|
||||
|
@ -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;
|
||||
|
||||
|
@ -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.
|
||||
|
@ -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;
|
||||
|
@ -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);
|
||||
|
@ -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;
|
||||
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 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)
|
||||
|
Reference in New Issue
Block a user