aboutsummaryrefslogtreecommitdiff
path: root/src/backend/executor
diff options
context:
space:
mode:
Diffstat (limited to 'src/backend/executor')
-rw-r--r--src/backend/executor/execAmi.c69
-rw-r--r--src/backend/executor/execMain.c47
-rw-r--r--src/backend/executor/execProcnode.c46
-rw-r--r--src/backend/executor/execQual.c74
-rw-r--r--src/backend/executor/execTuples.c10
-rw-r--r--src/backend/executor/execUtils.c26
-rw-r--r--src/backend/executor/nodeAgg.c63
-rw-r--r--src/backend/executor/nodeAppend.c6
-rw-r--r--src/backend/executor/nodeGroup.c47
-rw-r--r--src/backend/executor/nodeHash.c20
-rw-r--r--src/backend/executor/nodeHashjoin.c39
-rw-r--r--src/backend/executor/nodeIndexscan.c40
-rw-r--r--src/backend/executor/nodeMaterial.c16
-rw-r--r--src/backend/executor/nodeMergejoin.c11
-rw-r--r--src/backend/executor/nodeNestloop.c18
-rw-r--r--src/backend/executor/nodeResult.c26
-rw-r--r--src/backend/executor/nodeSort.c20
-rw-r--r--src/backend/executor/nodeSubplan.c276
-rw-r--r--src/backend/executor/nodeTee.c10
-rw-r--r--src/backend/executor/nodeUnique.c35
-rw-r--r--src/backend/executor/spi.c103
21 files changed, 516 insertions, 486 deletions
diff --git a/src/backend/executor/execAmi.c b/src/backend/executor/execAmi.c
index 450f6e5358b..b2851d83b4a 100644
--- a/src/backend/executor/execAmi.c
+++ b/src/backend/executor/execAmi.c
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/executor/execAmi.c,v 1.18 1998/02/23 06:26:53 vadim Exp $
+ * $Header: /cvsroot/pgsql/src/backend/executor/execAmi.c,v 1.19 1998/02/26 04:31:08 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -296,29 +296,32 @@ void
ExecReScan(Plan *node, ExprContext *exprCtxt, Plan *parent)
{
- if ( node->chgParam != NULL ) /* Wow! */
+ if (node->chgParam != NULL) /* Wow! */
{
- List *lst;
-
- foreach (lst, node->initPlan)
+ List *lst;
+
+ foreach(lst, node->initPlan)
{
- Plan *splan = ((SubPlan*) lfirst (lst))->plan;
- if ( splan->extParam != NULL ) /* don't care about child locParam */
- SetChangedParamList (splan, node->chgParam);
- if ( splan->chgParam != NULL )
- ExecReScanSetParamPlan ((SubPlan*) lfirst (lst), node);
+ Plan *splan = ((SubPlan *) lfirst(lst))->plan;
+
+ if (splan->extParam != NULL) /* don't care about child
+ * locParam */
+ SetChangedParamList(splan, node->chgParam);
+ if (splan->chgParam != NULL)
+ ExecReScanSetParamPlan((SubPlan *) lfirst(lst), node);
}
- foreach (lst, node->subPlan)
+ foreach(lst, node->subPlan)
{
- Plan *splan = ((SubPlan*) lfirst (lst))->plan;
- if ( splan->extParam != NULL )
- SetChangedParamList (splan, node->chgParam);
+ Plan *splan = ((SubPlan *) lfirst(lst))->plan;
+
+ if (splan->extParam != NULL)
+ SetChangedParamList(splan, node->chgParam);
}
/* Well. Now set chgParam for left/right trees. */
- if ( node->lefttree != NULL )
- SetChangedParamList (node->lefttree, node->chgParam);
- if ( node->righttree != NULL )
- SetChangedParamList (node->righttree, node->chgParam);
+ if (node->lefttree != NULL)
+ SetChangedParamList(node->lefttree, node->chgParam);
+ if (node->righttree != NULL)
+ SetChangedParamList(node->righttree, node->chgParam);
}
switch (nodeTag(node))
@@ -332,38 +335,38 @@ ExecReScan(Plan *node, ExprContext *exprCtxt, Plan *parent)
break;
case T_Material:
- ExecMaterialReScan((Material*) node, exprCtxt, parent);
+ ExecMaterialReScan((Material *) node, exprCtxt, parent);
break;
case T_NestLoop:
- ExecReScanNestLoop((NestLoop*) node, exprCtxt, parent);
+ ExecReScanNestLoop((NestLoop *) node, exprCtxt, parent);
break;
case T_HashJoin:
- ExecReScanHashJoin((HashJoin*) node, exprCtxt, parent);
+ ExecReScanHashJoin((HashJoin *) node, exprCtxt, parent);
break;
case T_Hash:
- ExecReScanHash((Hash*) node, exprCtxt, parent);
+ ExecReScanHash((Hash *) node, exprCtxt, parent);
break;
case T_Agg:
- ExecReScanAgg((Agg*) node, exprCtxt, parent);
+ ExecReScanAgg((Agg *) node, exprCtxt, parent);
break;
case T_Result:
- ExecReScanResult((Result*) node, exprCtxt, parent);
+ ExecReScanResult((Result *) node, exprCtxt, parent);
break;
case T_Unique:
- ExecReScanUnique((Unique*) node, exprCtxt, parent);
+ ExecReScanUnique((Unique *) node, exprCtxt, parent);
break;
case T_Sort:
- ExecReScanSort((Sort*) node, exprCtxt, parent);
+ ExecReScanSort((Sort *) node, exprCtxt, parent);
break;
-/*
+/*
* Tee is never used
case T_Tee:
ExecTeeReScan((Tee *) node, exprCtxt, parent);
@@ -373,10 +376,10 @@ ExecReScan(Plan *node, ExprContext *exprCtxt, Plan *parent)
elog(ERROR, "ExecReScan: node type %u not supported", nodeTag(node));
return;
}
-
- if ( node->chgParam != NULL )
+
+ if (node->chgParam != NULL)
{
- freeList (node->chgParam);
+ freeList(node->chgParam);
node->chgParam = NULL;
}
}
@@ -415,7 +418,7 @@ ExecMarkPos(Plan *node)
{
switch (nodeTag(node))
{
- case T_SeqScan:
+ case T_SeqScan:
ExecSeqMarkPos((SeqScan *) node);
break;
@@ -445,7 +448,7 @@ ExecRestrPos(Plan *node)
{
switch (nodeTag(node))
{
- case T_SeqScan:
+ case T_SeqScan:
ExecSeqRestrPos((SeqScan *) node);
return;
@@ -510,7 +513,7 @@ ExecCreatR(TupleDesc tupType,
* '\0 '
*/
relDesc = heap_create("", tupType);
- }
+ }
else
{
/* ----------------
diff --git a/src/backend/executor/execMain.c b/src/backend/executor/execMain.c
index 760d277dee9..6326ab215d9 100644
--- a/src/backend/executor/execMain.c
+++ b/src/backend/executor/execMain.c
@@ -26,7 +26,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/executor/execMain.c,v 1.43 1998/02/21 06:31:37 scrappy Exp $
+ * $Header: /cvsroot/pgsql/src/backend/executor/execMain.c,v 1.44 1998/02/26 04:31:09 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -57,22 +57,28 @@
/* decls for local routines only used within this module */
-static void ExecCheckPerms(CmdType operation, int resultRelation, List *rangeTable,
+static void
+ExecCheckPerms(CmdType operation, int resultRelation, List *rangeTable,
Query *parseTree);
-static TupleDesc InitPlan(CmdType operation, Query *parseTree,
+static TupleDesc
+InitPlan(CmdType operation, Query *parseTree,
Plan *plan, EState *estate);
static void EndPlan(Plan *plan, EState *estate);
-static TupleTableSlot * ExecutePlan(EState *estate, Plan *plan,
+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 ExecAppend(TupleTableSlot *slot, ItemPointer tupleid,
+static void
+ExecAppend(TupleTableSlot *slot, ItemPointer tupleid,
EState *estate);
-static void ExecDelete(TupleTableSlot *slot, ItemPointer tupleid,
+static void
+ExecDelete(TupleTableSlot *slot, ItemPointer tupleid,
EState *estate);
-static void ExecReplace(TupleTableSlot *slot, ItemPointer tupleid,
+static void
+ExecReplace(TupleTableSlot *slot, ItemPointer tupleid,
EState *estate, Query *parseTree);
/* end of local decls */
@@ -83,13 +89,14 @@ static int queryLimit = ALL_TUPLES;
#undef ALL_TUPLES
#define ALL_TUPLES queryLimit
-int ExecutorLimit(int limit);
+int ExecutorLimit(int limit);
int
ExecutorLimit(int limit)
{
return queryLimit = limit;
}
+
#endif
/* ----------------------------------------------------------------
@@ -110,14 +117,14 @@ ExecutorStart(QueryDesc *queryDesc, EState *estate)
/* sanity checks */
Assert(queryDesc != NULL);
-
+
if (queryDesc->plantree->nParamExec > 0)
{
- estate->es_param_exec_vals = (ParamExecData*)
- palloc (queryDesc->plantree->nParamExec * sizeof (ParamExecData));
- memset (estate->es_param_exec_vals, 0 , queryDesc->plantree->nParamExec * sizeof (ParamExecData));
+ estate->es_param_exec_vals = (ParamExecData *)
+ palloc(queryDesc->plantree->nParamExec * sizeof(ParamExecData));
+ memset(estate->es_param_exec_vals, 0, queryDesc->plantree->nParamExec * sizeof(ParamExecData));
}
-
+
result = InitPlan(queryDesc->operation,
queryDesc->parsetree,
queryDesc->plantree,
@@ -301,11 +308,12 @@ ExecCheckPerms(CmdType operation,
if (rte->skipAcl)
{
+
/*
- * This happens if the access to this table is due
- * to a view query rewriting - the rewrite handler
- * checked the permissions against the view owner,
- * so we just skip this entry.
+ * This happens if the access to this table is due to a view
+ * query rewriting - the rewrite handler checked the
+ * permissions against the view owner, so we just skip this
+ * entry.
*/
continue;
}
@@ -1239,8 +1247,8 @@ ExecAttrDefault(Relation rel, HeapTuple tuple)
econtext->ecxt_outertuple = NULL; /* outer tuple slot */
econtext->ecxt_relation = NULL; /* relation */
econtext->ecxt_relid = 0; /* relid */
- econtext->ecxt_param_list_info = NULL; /* param list info */
- econtext->ecxt_param_exec_vals = NULL; /* exec param values */
+ econtext->ecxt_param_list_info = NULL; /* param list info */
+ econtext->ecxt_param_exec_vals = NULL; /* exec param values */
econtext->ecxt_range_table = NULL; /* range table */
for (i = 0; i < ndef; i++)
{
@@ -1283,6 +1291,7 @@ ExecAttrDefault(Relation rel, HeapTuple tuple)
return (newtuple);
}
+
#endif
static char *
diff --git a/src/backend/executor/execProcnode.c b/src/backend/executor/execProcnode.c
index 017fdfba4d1..f5842ecad32 100644
--- a/src/backend/executor/execProcnode.c
+++ b/src/backend/executor/execProcnode.c
@@ -11,7 +11,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/executor/execProcnode.c,v 1.8 1998/02/13 03:26:40 vadim Exp $
+ * $Header: /cvsroot/pgsql/src/backend/executor/execProcnode.c,v 1.9 1998/02/26 04:31:11 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -116,14 +116,14 @@ ExecInitNode(Plan *node, EState *estate, Plan *parent)
*/
if (node == NULL)
return FALSE;
-
- foreach (subp, node->initPlan)
+
+ foreach(subp, node->initPlan)
{
- result = ExecInitSubPlan ((SubPlan*) lfirst (subp), estate, node);
- if ( result == FALSE )
+ result = ExecInitSubPlan((SubPlan *) lfirst(subp), estate, node);
+ if (result == FALSE)
return (FALSE);
}
-
+
switch (nodeTag(node))
{
/* ----------------
@@ -202,13 +202,13 @@ ExecInitNode(Plan *node, EState *estate, Plan *parent)
elog(ERROR, "ExecInitNode: node %d unsupported", nodeTag(node));
result = FALSE;
}
-
- if ( result != FALSE )
+
+ if (result != FALSE)
{
- foreach (subp, node->subPlan)
+ foreach(subp, node->subPlan)
{
- result = ExecInitSubPlan ((SubPlan*) lfirst (subp), estate, node);
- if ( result == FALSE )
+ result = ExecInitSubPlan((SubPlan *) lfirst(subp), estate, node);
+ if (result == FALSE)
return (FALSE);
}
}
@@ -235,10 +235,10 @@ ExecProcNode(Plan *node, Plan *parent)
*/
if (node == NULL)
return NULL;
-
- if ( node->chgParam != NULL ) /* something changed */
- ExecReScan (node, NULL, parent); /* let ReScan handle this */
-
+
+ if (node->chgParam != NULL) /* something changed */
+ ExecReScan(node, NULL, parent); /* let ReScan handle this */
+
switch (nodeTag(node))
{
/* ----------------
@@ -410,7 +410,7 @@ void
ExecEndNode(Plan *node, Plan *parent)
{
List *subp;
-
+
/* ----------------
* do nothing when we get to the end
* of a leaf on tree.
@@ -418,18 +418,18 @@ ExecEndNode(Plan *node, Plan *parent)
*/
if (node == NULL)
return;
-
- foreach (subp, node->initPlan)
+
+ foreach(subp, node->initPlan)
{
- ExecEndSubPlan ((SubPlan*) lfirst (subp));
+ ExecEndSubPlan((SubPlan *) lfirst(subp));
}
- foreach (subp, node->subPlan)
+ foreach(subp, node->subPlan)
{
- ExecEndSubPlan ((SubPlan*) lfirst (subp));
+ ExecEndSubPlan((SubPlan *) lfirst(subp));
}
- if ( node->chgParam != NULL )
+ if (node->chgParam != NULL)
{
- freeList (node->chgParam);
+ freeList(node->chgParam);
node->chgParam = NULL;
}
diff --git a/src/backend/executor/execQual.c b/src/backend/executor/execQual.c
index 78c91539c7f..55a12bd8317 100644
--- a/src/backend/executor/execQual.c
+++ b/src/backend/executor/execQual.c
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/executor/execQual.c,v 1.25 1998/02/13 03:26:42 vadim Exp $
+ * $Header: /cvsroot/pgsql/src/backend/executor/execQual.c,v 1.26 1998/02/26 04:31:13 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -71,19 +71,24 @@ int execConstLen;
/* static functions decls */
static Datum ExecEvalAggreg(Aggreg *agg, ExprContext *econtext, bool *isNull);
-static Datum ExecEvalArrayRef(ArrayRef *arrayRef, ExprContext *econtext,
+static Datum
+ExecEvalArrayRef(ArrayRef *arrayRef, ExprContext *econtext,
bool *isNull, bool *isDone);
static Datum ExecEvalAnd(Expr *andExpr, ExprContext *econtext, bool *isNull);
-static Datum ExecEvalFunc(Expr *funcClause, ExprContext *econtext,
+static Datum
+ExecEvalFunc(Expr *funcClause, ExprContext *econtext,
bool *isNull, bool *isDone);
-static void ExecEvalFuncArgs(FunctionCachePtr fcache, ExprContext *econtext,
+static void
+ExecEvalFuncArgs(FunctionCachePtr fcache, ExprContext *econtext,
List *argList, Datum argV[], bool *argIsDone);
static Datum ExecEvalNot(Expr *notclause, ExprContext *econtext, bool *isNull);
-static Datum ExecEvalOper(Expr *opClause, ExprContext *econtext,
+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 ExecMakeFunctionResult(Node *node, List *arguments,
+static Datum
+ExecMakeFunctionResult(Node *node, List *arguments,
ExprContext *econtext, bool *isNull, bool *isDone);
static bool ExecQualClause(Node *clause, ExprContext *econtext);
@@ -301,10 +306,11 @@ ExecEvalVar(Var *variable, ExprContext *econtext, bool *isNull)
return (Datum) tempSlot;
}
- result = heap_getattr(heapTuple, /* tuple containing attribute */
- attnum, /* attribute number of desired attribute */
- tuple_type,/* tuple descriptor of tuple */
- isNull); /* return: is attribute null? */
+ result = heap_getattr(heapTuple, /* tuple containing attribute */
+ attnum, /* attribute number of desired
+ * attribute */
+ tuple_type, /* tuple descriptor of tuple */
+ isNull); /* return: is attribute null? */
/* ----------------
* return null if att is null
@@ -379,18 +385,18 @@ ExecEvalParam(Param *expression, ExprContext *econtext, bool *isNull)
AttrNumber thisParameterId = expression->paramid;
int matchFound;
ParamListInfo paramList;
-
- if ( thisParameterKind == PARAM_EXEC )
+
+ if (thisParameterKind == PARAM_EXEC)
{
- ParamExecData *prm = &(econtext->ecxt_param_exec_vals[thisParameterId]);
-
- if ( prm->execPlan != NULL )
- ExecSetParamPlan (prm->execPlan);
- Assert (prm->execPlan == NULL);
+ ParamExecData *prm = &(econtext->ecxt_param_exec_vals[thisParameterId]);
+
+ if (prm->execPlan != NULL)
+ ExecSetParamPlan(prm->execPlan);
+ Assert(prm->execPlan == NULL);
*isNull = prm->isnull;
return (prm->value);
}
-
+
thisParameterName = expression->paramname;
paramList = econtext->ecxt_param_list_info;
@@ -544,7 +550,7 @@ GetAttributeByNum(TupleTableSlot *slot,
/* XXX char16 name for catalogs */
#ifdef NOT_USED
-char *
+char *
att_by_num(TupleTableSlot *slot,
AttrNumber attrno,
bool *isNull)
@@ -554,7 +560,7 @@ att_by_num(TupleTableSlot *slot,
#endif
-char *
+char *
GetAttributeByName(TupleTableSlot *slot, char *attname, bool *isNull)
{
AttrNumber attrno;
@@ -605,7 +611,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));
@@ -1045,19 +1051,21 @@ ExecEvalOr(Expr *orExpr, ExprContext *econtext, bool *isNull)
if (*isNull)
{
IsNull = *isNull;
+
/*
- * Many functions don't (or can't!) check is an argument
- * NULL or NOT_NULL and may return TRUE (1) with *isNull TRUE
- * (an_int4_column <> 1: int4ne returns TRUE for NULLs).
- * Not having time to fix function manager I want to fix
- * OR: if we had 'x <> 1 OR x isnull' then TRUE, TRUE were
- * returned by 'x <> 1' for NULL ... but ExecQualClause say
- * that qualification *fails* if isnull is TRUE for all values
- * returned by ExecEvalExpr. So, force this rule here: if isnull
- * is TRUE then clause failed. Note: nullvalue() & nonnullvalue()
- * always set isnull to FALSE for NULLs. - vadim 09/22/97
+ * Many functions don't (or can't!) check is an argument NULL
+ * or NOT_NULL and may return TRUE (1) with *isNull TRUE
+ * (an_int4_column <> 1: int4ne returns TRUE for NULLs). Not
+ * having time to fix function manager I want to fix OR: if we
+ * had 'x <> 1 OR x isnull' then TRUE, TRUE were returned by
+ * 'x <> 1' for NULL ... but ExecQualClause say that
+ * qualification *fails* if isnull is TRUE for all values
+ * returned by ExecEvalExpr. So, force this rule here: if
+ * isnull is TRUE then clause failed. Note: nullvalue() &
+ * nonnullvalue() always set isnull to FALSE for NULLs. -
+ * vadim 09/22/97
*/
- const_value = 0;
+ const_value = 0;
}
/* ----------------
@@ -1238,7 +1246,7 @@ ExecEvalExpr(Node *expression,
retDatum = (Datum) ExecEvalNot(expr, econtext, isNull);
break;
case SUBPLAN_EXPR:
- retDatum = (Datum) ExecSubPlan((SubPlan*) expr->oper, expr->args, econtext);
+ retDatum = (Datum) ExecSubPlan((SubPlan *) expr->oper, expr->args, econtext);
break;
default:
elog(ERROR, "ExecEvalExpr: unknown expression type %d", expr->opType);
diff --git a/src/backend/executor/execTuples.c b/src/backend/executor/execTuples.c
index 5f2336ce19d..3d64ba0095b 100644
--- a/src/backend/executor/execTuples.c
+++ b/src/backend/executor/execTuples.c
@@ -14,7 +14,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/executor/execTuples.c,v 1.16 1998/02/10 04:00:50 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/executor/execTuples.c,v 1.17 1998/02/26 04:31:14 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -986,8 +986,8 @@ ExecTypeFromTL(List *targetList)
resdom->resno,
resdom->resname,
/* fix for SELECT NULL ... */
- (restype ? restype : UNKNOWNOID),
- resdom->restypmod,
+ (restype ? restype : UNKNOWNOID),
+ resdom->restypmod,
0,
false);
@@ -1021,7 +1021,7 @@ ExecTypeFromTL(List *targetList)
fjRes->resno,
fjRes->resname,
restype,
- fjRes->restypmod,
+ fjRes->restypmod,
0,
false);
/*
@@ -1045,7 +1045,7 @@ ExecTypeFromTL(List *targetList)
fjRes->resno,
fjRes->resname,
restype,
- fjRes->restypmod,
+ fjRes->restypmod,
0,
false);
diff --git a/src/backend/executor/execUtils.c b/src/backend/executor/execUtils.c
index 69ef6671075..6f30db27cff 100644
--- a/src/backend/executor/execUtils.c
+++ b/src/backend/executor/execUtils.c
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/executor/execUtils.c,v 1.29 1998/02/13 03:26:43 vadim Exp $
+ * $Header: /cvsroot/pgsql/src/backend/executor/execUtils.c,v 1.30 1998/02/26 04:31:15 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -189,7 +189,7 @@ ExecAssignExprContext(EState *estate, CommonState *commonstate)
econtext->ecxt_relid = 0; /* relid */
econtext->ecxt_param_list_info = estate->es_param_list_info;
econtext->ecxt_param_exec_vals = estate->es_param_exec_vals;
- econtext->ecxt_range_table = estate->es_range_table; /* range table */
+ econtext->ecxt_range_table = estate->es_range_table; /* range table */
commonstate->cs_ExprContext = econtext;
}
@@ -1176,24 +1176,24 @@ ExecInsertIndexTuples(TupleTableSlot *slot,
pfree(econtext);
}
-void
-SetChangedParamList (Plan *node, List *newchg)
+void
+SetChangedParamList(Plan *node, List *newchg)
{
- List *nl;
-
- foreach (nl, newchg)
+ List *nl;
+
+ foreach(nl, newchg)
{
- int paramId = lfirsti(nl);
-
+ int paramId = lfirsti(nl);
+
/* if this node doesn't depend on a param ... */
- if ( !intMember (paramId, node->extParam) &&
- !intMember (paramId, node->locParam) )
+ if (!intMember(paramId, node->extParam) &&
+ !intMember(paramId, node->locParam))
continue;
/* if this param is already in list of changed ones ... */
- if ( intMember (paramId, node->chgParam) )
+ if (intMember(paramId, node->chgParam))
continue;
/* else - add this param to the list */
- node->chgParam = lappendi (node->chgParam, paramId);
+ node->chgParam = lappendi(node->chgParam, paramId);
}
}
diff --git a/src/backend/executor/nodeAgg.c b/src/backend/executor/nodeAgg.c
index 9778e365a58..848bd616bf0 100644
--- a/src/backend/executor/nodeAgg.c
+++ b/src/backend/executor/nodeAgg.c
@@ -121,7 +121,7 @@ ExecAgg(Agg *node)
econtext = aggstate->csstate.cstate.cs_ExprContext;
nagg = length(node->aggs);
- aggregates = (Aggreg **)palloc(sizeof(Aggreg *) * nagg);
+ aggregates = (Aggreg **) palloc(sizeof(Aggreg *) * nagg);
/* take List* and make it an array that can be quickly indexed */
alist = node->aggs;
@@ -333,18 +333,18 @@ ExecAgg(Agg *node)
break;
case T_Expr:
- {
- FunctionCachePtr fcache_ptr;
-
- if (nodeTag(tagnode) == T_Func)
- fcache_ptr = ((Func *) tagnode)->func_fcache;
- else
- fcache_ptr = ((Oper *) tagnode)->op_fcache;
- attlen = fcache_ptr->typlen;
- byVal = fcache_ptr->typbyval;
-
- break;
- }
+ {
+ FunctionCachePtr fcache_ptr;
+
+ if (nodeTag(tagnode) == T_Func)
+ fcache_ptr = ((Func *) tagnode)->func_fcache;
+ else
+ fcache_ptr = ((Oper *) tagnode)->op_fcache;
+ attlen = fcache_ptr->typlen;
+ byVal = fcache_ptr->typbyval;
+
+ break;
+ }
case T_Const:
attlen = ((Const *) aggregates[i]->target)->constlen;
byVal = ((Const *) aggregates[i]->target)->constbyval;
@@ -375,8 +375,8 @@ ExecAgg(Agg *node)
args[0] = value1[i];
args[1] = newVal;
value1[i] =
- (Datum) fmgr_c(&aggfns->xfn1,
- (FmgrValues *) args,
+ (Datum) fmgr_c(&aggfns->xfn1,
+ (FmgrValues *) args,
&isNull1);
Assert(!isNull1);
}
@@ -440,7 +440,7 @@ ExecAgg(Agg *node)
else
elog(NOTICE, "ExecAgg: no valid transition functions??");
value1[i] = (Datum) fmgr_c(&aggfns->finalfn,
- (FmgrValues *) args, &(nulls[i]));
+ (FmgrValues *) args, &(nulls[i]));
}
else if (aggfns->xfn1.fn_addr != NULL)
{
@@ -545,15 +545,15 @@ ExecInitAgg(Agg *node, EState *estate, Plan *parent)
ExecInitNode(outerPlan, estate, (Plan *) node);
/*
- * Result runs in its own context, but make it use our aggregates
- * fix for 'select sum(2+2)'
+ * Result runs in its own context, but make it use our aggregates fix
+ * for 'select sum(2+2)'
*/
if (nodeTag(outerPlan) == T_Result)
{
- ((Result *)outerPlan)->resstate->cstate.cs_ProjInfo->pi_exprContext->ecxt_values =
- econtext->ecxt_values;
- ((Result *)outerPlan)->resstate->cstate.cs_ProjInfo->pi_exprContext->ecxt_nulls =
- econtext->ecxt_nulls;
+ ((Result *) outerPlan)->resstate->cstate.cs_ProjInfo->pi_exprContext->ecxt_values =
+ econtext->ecxt_values;
+ ((Result *) outerPlan)->resstate->cstate.cs_ProjInfo->pi_exprContext->ecxt_nulls =
+ econtext->ecxt_nulls;
}
@@ -661,7 +661,7 @@ aggGetAttr(TupleTableSlot *slot,
return (Datum) tempSlot;
}
- result =
+ result =
heap_getattr(heapTuple, /* tuple containing attribute */
attnum, /* attribute number of desired attribute */
tuple_type,/* tuple descriptor of tuple */
@@ -680,17 +680,18 @@ aggGetAttr(TupleTableSlot *slot,
void
ExecReScanAgg(Agg *node, ExprContext *exprCtxt, Plan *parent)
{
- AggState *aggstate = node->aggstate;
- ExprContext *econtext = aggstate->csstate.cstate.cs_ExprContext;
+ AggState *aggstate = node->aggstate;
+ ExprContext *econtext = aggstate->csstate.cstate.cs_ExprContext;
aggstate->agg_done = FALSE;
MemSet(econtext->ecxt_values, 0, sizeof(Datum) * length(node->aggs));
MemSet(econtext->ecxt_nulls, 0, length(node->aggs));
- /*
- * if chgParam of subnode is not null then plan
- * will be re-scanned by first ExecProcNode.
+
+ /*
+ * if chgParam of subnode is not null then plan will be re-scanned by
+ * first ExecProcNode.
*/
- if (((Plan*) node)->lefttree->chgParam == NULL)
- ExecReScan (((Plan*) node)->lefttree, exprCtxt, (Plan *) node);
-
+ if (((Plan *) node)->lefttree->chgParam == NULL)
+ ExecReScan(((Plan *) node)->lefttree, exprCtxt, (Plan *) node);
+
}
diff --git a/src/backend/executor/nodeAppend.c b/src/backend/executor/nodeAppend.c
index cdc0e56a1b7..86286284e91 100644
--- a/src/backend/executor/nodeAppend.c
+++ b/src/backend/executor/nodeAppend.c
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/executor/nodeAppend.c,v 1.10 1997/12/27 06:40:50 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/executor/nodeAppend.c,v 1.11 1998/02/26 04:31:21 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -150,7 +150,7 @@ exec_append_initialize_next(Append *node)
}
else
estate->es_range_table = nth(whichplan, rts);
-
+
if (unionstate->as_junkFilter_list)
{
estate->es_junkFilter =
@@ -161,7 +161,7 @@ exec_append_initialize_next(Append *node)
{
estate->es_result_relation_info =
(RelationInfo *) nth(whichplan,
- unionstate->as_result_relation_info_list);
+ unionstate->as_result_relation_info_list);
}
result_slot->ttc_whichplan = whichplan;
diff --git a/src/backend/executor/nodeGroup.c b/src/backend/executor/nodeGroup.c
index fa733e2da09..81e4b540ec0 100644
--- a/src/backend/executor/nodeGroup.c
+++ b/src/backend/executor/nodeGroup.c
@@ -13,7 +13,7 @@
* columns. (ie. tuples from the same group are consecutive)
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/executor/nodeGroup.c,v 1.17 1998/02/18 12:40:43 vadim Exp $
+ * $Header: /cvsroot/pgsql/src/backend/executor/nodeGroup.c,v 1.18 1998/02/26 04:31:24 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -113,24 +113,25 @@ ExecGroupEveryTuple(Group *node)
firsttuple = grpstate->grp_firstTuple;
/* this should occur on the first call only */
- if (firsttuple == NULL)
+ if (firsttuple == NULL)
{
- grpstate->grp_firstTuple = heap_copytuple (outerTuple);
+ grpstate->grp_firstTuple = heap_copytuple(outerTuple);
}
else
{
+
/*
- * Compare with first tuple and see if this tuple is of
- * the same group.
+ * Compare with first tuple and see if this tuple is of the
+ * same group.
*/
if (!sameGroup(firsttuple, outerslot->val,
- node->numCols, node->grpColIdx,
- ExecGetScanType(&grpstate->csstate)))
+ node->numCols, node->grpColIdx,
+ ExecGetScanType(&grpstate->csstate)))
{
grpstate->grp_useFirstTuple = TRUE;
- pfree (firsttuple);
- grpstate->grp_firstTuple = heap_copytuple (outerTuple);
-
+ pfree(firsttuple);
+ grpstate->grp_firstTuple = heap_copytuple(outerTuple);
+
return NULL; /* signifies the end of the group */
}
}
@@ -188,7 +189,7 @@ ExecGroupOneTuple(Group *node)
firsttuple = grpstate->grp_firstTuple;
/* this should occur on the first call only */
- if (firsttuple == NULL)
+ if (firsttuple == NULL)
{
outerslot = ExecProcNode(outerPlan(node), (Plan *) node);
if (outerslot)
@@ -198,7 +199,7 @@ ExecGroupOneTuple(Group *node)
grpstate->grp_done = TRUE;
return NULL;
}
- grpstate->grp_firstTuple = firsttuple = heap_copytuple (outerTuple);
+ grpstate->grp_firstTuple = firsttuple = heap_copytuple(outerTuple);
}
/*
@@ -238,12 +239,12 @@ ExecGroupOneTuple(Group *node)
false);
econtext->ecxt_scantuple = grpstate->csstate.css_ScanTupleSlot;
resultSlot = ExecProject(projInfo, &isDone);
-
+
/* save outerTuple if we are not done yet */
if (!grpstate->grp_done)
{
- pfree (firsttuple);
- grpstate->grp_firstTuple = heap_copytuple (outerTuple);
+ pfree(firsttuple);
+ grpstate->grp_firstTuple = heap_copytuple(outerTuple);
}
return resultSlot;
@@ -340,7 +341,7 @@ ExecEndGroup(Group *node)
ExecClearTuple(grpstate->csstate.css_ScanTupleSlot);
if (grpstate->grp_firstTuple != NULL)
{
- pfree (grpstate->grp_firstTuple);
+ pfree(grpstate->grp_firstTuple);
grpstate->grp_firstTuple = NULL;
}
}
@@ -362,7 +363,7 @@ sameGroup(HeapTuple oldtuple,
bool isNull1,
isNull2;
Datum attr1,
- attr2;
+ attr2;
char *val1,
*val2;
int i;
@@ -391,10 +392,10 @@ sameGroup(HeapTuple oldtuple,
val1 = fmgr(typoutput, attr1,
gettypelem(tupdesc->attrs[att - 1]->atttypid),
- tupdesc->attrs[att - 1]->atttypmod);
+ tupdesc->attrs[att - 1]->atttypmod);
val2 = fmgr(typoutput, attr2,
gettypelem(tupdesc->attrs[att - 1]->atttypid),
- tupdesc->attrs[att - 1]->atttypmod);
+ tupdesc->attrs[att - 1]->atttypmod);
/*
* now, val1 and val2 are ascii representations so we can use
@@ -402,12 +403,12 @@ sameGroup(HeapTuple oldtuple,
*/
if (strcmp(val1, val2) != 0)
{
- pfree (val1);
- pfree (val2);
+ pfree(val1);
+ pfree(val2);
return FALSE;
}
- pfree (val1);
- pfree (val2);
+ pfree(val1);
+ pfree(val2);
}
else
{
diff --git a/src/backend/executor/nodeHash.c b/src/backend/executor/nodeHash.c
index 5ebf508c0c0..81eca617fb4 100644
--- a/src/backend/executor/nodeHash.c
+++ b/src/backend/executor/nodeHash.c
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/executor/nodeHash.c,v 1.19 1998/02/13 03:26:46 vadim Exp $
+ * $Header: /cvsroot/pgsql/src/backend/executor/nodeHash.c,v 1.20 1998/02/26 04:31:25 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -781,7 +781,7 @@ static int
hashFunc(char *key, int len)
{
unsigned int h;
- int l;
+ int l;
unsigned char *k;
/*
@@ -901,12 +901,12 @@ ExecReScanHash(Hash *node, ExprContext *exprCtxt, Plan *parent)
pfree(hashstate->hashBatches);
hashstate->hashBatches = NULL;
}
-
- /*
- * if chgParam of subnode is not null then plan
- * will be re-scanned by first ExecProcNode.
- */
- if (((Plan*) node)->lefttree->chgParam == NULL)
- ExecReScan (((Plan*) node)->lefttree, exprCtxt, (Plan *) node);
-
+
+ /*
+ * if chgParam of subnode is not null then plan will be re-scanned by
+ * first ExecProcNode.
+ */
+ if (((Plan *) node)->lefttree->chgParam == NULL)
+ ExecReScan(((Plan *) node)->lefttree, exprCtxt, (Plan *) node);
+
}
diff --git a/src/backend/executor/nodeHashjoin.c b/src/backend/executor/nodeHashjoin.c
index 21132410d45..9a99e80da58 100644
--- a/src/backend/executor/nodeHashjoin.c
+++ b/src/backend/executor/nodeHashjoin.c
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/executor/nodeHashjoin.c,v 1.10 1998/02/13 03:26:47 vadim Exp $
+ * $Header: /cvsroot/pgsql/src/backend/executor/nodeHashjoin.c,v 1.11 1998/02/26 04:31:26 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -156,7 +156,7 @@ ExecHashJoin(HashJoin *node)
}
else if (hashtable == NULL)
return (NULL);
-
+
nbatch = hashtable->nbatch;
outerbatches = hjstate->hj_OuterBatches;
if (nbatch > 0 && outerbatches == NULL)
@@ -212,12 +212,14 @@ ExecHashJoin(HashJoin *node)
while (curbatch <= nbatch && TupIsNull(outerTupleSlot))
{
+
/*
* if the current batch runs out, switch to new batch
*/
curbatch = ExecHashJoinNewBatch(hjstate);
if (curbatch > nbatch)
{
+
/*
* when the last batch runs out, clean up
*/
@@ -350,6 +352,7 @@ ExecHashJoin(HashJoin *node)
curbatch = ExecHashJoinNewBatch(hjstate);
if (curbatch > nbatch)
{
+
/*
* when the last batch runs out, clean up
*/
@@ -806,7 +809,7 @@ ExecHashJoinGetBatch(int bucketno, HashJoinTable hashtable, int nbatch)
* ----------------------------------------------------------------
*/
-char *
+char *
ExecHashJoinSaveTuple(HeapTuple heapTuple,
char *buffer,
File file,
@@ -845,16 +848,16 @@ ExecHashJoinSaveTuple(HeapTuple heapTuple,
void
ExecReScanHashJoin(HashJoin *node, ExprContext *exprCtxt, Plan *parent)
{
- HashJoinState *hjstate = node->hashjoinstate;
+ HashJoinState *hjstate = node->hashjoinstate;
if (!node->hashdone)
return;
-
+
node->hashdone = false;
-
- /*
- * Unfortunately, currently we have to destroy hashtable
- * in all cases...
+
+ /*
+ * Unfortunately, currently we have to destroy hashtable in all
+ * cases...
*/
if (hjstate->hj_HashTable)
{
@@ -872,14 +875,14 @@ ExecReScanHashJoin(HashJoin *node, ExprContext *exprCtxt, Plan *parent)
hjstate->jstate.cs_OuterTupleSlot = (TupleTableSlot *) NULL;
hjstate->jstate.cs_TupFromTlist = (bool) false;
-
- /*
- * if chgParam of subnodes is not null then plans
- * will be re-scanned by first ExecProcNode.
+
+ /*
+ * if chgParam of subnodes is not null then plans will be re-scanned
+ * by first ExecProcNode.
*/
- if (((Plan*) node)->lefttree->chgParam == NULL)
- ExecReScan (((Plan*) node)->lefttree, exprCtxt, (Plan *) node);
- if (((Plan*) node)->righttree->chgParam == NULL)
- ExecReScan (((Plan*) node)->righttree, exprCtxt, (Plan *) node);
-
+ if (((Plan *) node)->lefttree->chgParam == NULL)
+ ExecReScan(((Plan *) node)->lefttree, exprCtxt, (Plan *) node);
+ if (((Plan *) node)->righttree->chgParam == NULL)
+ ExecReScan(((Plan *) node)->righttree, exprCtxt, (Plan *) node);
+
}
diff --git a/src/backend/executor/nodeIndexscan.c b/src/backend/executor/nodeIndexscan.c
index d15c9bfb35a..4c01e5b1f2a 100644
--- a/src/backend/executor/nodeIndexscan.c
+++ b/src/backend/executor/nodeIndexscan.c
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/executor/nodeIndexscan.c,v 1.14 1998/02/13 03:26:49 vadim Exp $
+ * $Header: /cvsroot/pgsql/src/backend/executor/nodeIndexscan.c,v 1.15 1998/02/26 04:31:26 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -267,11 +267,11 @@ ExecIndexReScan(IndexScan *node, ExprContext *exprCtxt, Plan *parent)
n_keys = numScanKeys[indexPtr];
run_keys = (int *) runtimeKeyInfo[indexPtr];
scan_keys = (ScanKey) scanKeys[indexPtr];
-
+
/* it's possible in subselects */
if (exprCtxt == NULL)
exprCtxt = node->scan.scanstate->cstate.cs_ExprContext;
-
+
for (j = 0; j < n_keys; j++)
{
@@ -488,7 +488,7 @@ ExecInitIndexScan(IndexScan *node, EState *estate, Plan *parent)
HeapScanDesc currentScanDesc;
ScanDirection direction;
int baseid;
-
+
List *execParam = NULL;
/* ----------------
@@ -711,22 +711,22 @@ ExecInitIndexScan(IndexScan *node, EState *estate, Plan *parent)
* it identifies the value to place in our scan key.
* ----------------
*/
-
+
/* Life was so easy before ... subselects */
- if ( ((Param *) leftop)->paramkind == PARAM_EXEC )
+ if (((Param *) leftop)->paramkind == PARAM_EXEC)
{
have_runtime_keys = true;
run_keys[j] = LEFT_OP;
- execParam = lappendi (execParam, ((Param*) leftop)->paramid);
+ execParam = lappendi(execParam, ((Param *) leftop)->paramid);
}
else
{
scanvalue = ExecEvalParam((Param *) leftop,
- scanstate->cstate.cs_ExprContext,
+ scanstate->cstate.cs_ExprContext,
&isnull);
if (isnull)
flags |= SK_ISNULL;
-
+
run_keys[j] = NO_OP;
}
}
@@ -804,22 +804,22 @@ ExecInitIndexScan(IndexScan *node, EState *estate, Plan *parent)
* it identifies the value to place in our scan key.
* ----------------
*/
-
+
/* Life was so easy before ... subselects */
- if ( ((Param *) rightop)->paramkind == PARAM_EXEC )
+ if (((Param *) rightop)->paramkind == PARAM_EXEC)
{
have_runtime_keys = true;
run_keys[j] = RIGHT_OP;
- execParam = lappendi (execParam, ((Param*) rightop)->paramid);
+ execParam = lappendi(execParam, ((Param *) rightop)->paramid);
}
else
{
scanvalue = ExecEvalParam((Param *) rightop,
- scanstate->cstate.cs_ExprContext,
+ scanstate->cstate.cs_ExprContext,
&isnull);
if (isnull)
flags |= SK_ISNULL;
-
+
run_keys[j] = NO_OP;
}
}
@@ -989,13 +989,13 @@ ExecInitIndexScan(IndexScan *node, EState *estate, Plan *parent)
indexstate->iss_ScanDescs = scanDescs;
indexstate->cstate.cs_TupFromTlist = false;
-
- /*
- * if there are some PARAM_EXEC in skankeys then
- * force index rescan on first scan.
+
+ /*
+ * if there are some PARAM_EXEC in skankeys then force index rescan on
+ * first scan.
*/
- ((Plan*) node)->chgParam = execParam;
-
+ ((Plan *) node)->chgParam = execParam;
+
/* ----------------
* all done.
* ----------------
diff --git a/src/backend/executor/nodeMaterial.c b/src/backend/executor/nodeMaterial.c
index 800bab2b315..596b199ddc5 100644
--- a/src/backend/executor/nodeMaterial.c
+++ b/src/backend/executor/nodeMaterial.c
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/executor/nodeMaterial.c,v 1.12 1998/02/13 03:26:50 vadim Exp $
+ * $Header: /cvsroot/pgsql/src/backend/executor/nodeMaterial.c,v 1.13 1998/02/26 04:31:28 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -350,16 +350,16 @@ ExecEndMaterial(Material *node)
void
ExecMaterialReScan(Material *node, ExprContext *exprCtxt, Plan *parent)
{
- MaterialState *matstate = node->matstate;
+ MaterialState *matstate = node->matstate;
if (matstate->mat_Flag == false)
return;
-
- matstate->csstate.css_currentScanDesc =
- ExecReScanR (matstate->csstate.css_currentRelation,
- matstate->csstate.css_currentScanDesc,
- node->plan.state->es_direction, 0, NULL);
-
+
+ matstate->csstate.css_currentScanDesc =
+ ExecReScanR(matstate->csstate.css_currentRelation,
+ matstate->csstate.css_currentScanDesc,
+ node->plan.state->es_direction, 0, NULL);
+
}
#ifdef NOT_USED /* not used */
diff --git a/src/backend/executor/nodeMergejoin.c b/src/backend/executor/nodeMergejoin.c
index e592bb31642..005047f337f 100644
--- a/src/backend/executor/nodeMergejoin.c
+++ b/src/backend/executor/nodeMergejoin.c
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/executor/nodeMergejoin.c,v 1.12 1997/09/08 21:43:15 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/executor/nodeMergejoin.c,v 1.13 1998/02/26 04:31:30 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -749,7 +749,8 @@ ExecMergeJoin(MergeJoin *node)
*
* new outer tuple > marked tuple
*
- *****************************
+ ****************************
+ *
*
*
*
@@ -831,7 +832,8 @@ ExecMergeJoin(MergeJoin *node)
* we have to advance the outer scan until we find the outer
* 8.
*
- *****************************
+ ****************************
+ *
*
*
*
@@ -935,7 +937,8 @@ ExecMergeJoin(MergeJoin *node)
* we have to advance the inner scan until we find the inner
* 12.
*
- *****************************
+ ****************************
+ *
*
*
*
diff --git a/src/backend/executor/nodeNestloop.c b/src/backend/executor/nodeNestloop.c
index 4d1fb12cd2f..0d5b210945f 100644
--- a/src/backend/executor/nodeNestloop.c
+++ b/src/backend/executor/nodeNestloop.c
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/executor/nodeNestloop.c,v 1.8 1998/02/13 03:26:51 vadim Exp $
+ * $Header: /cvsroot/pgsql/src/backend/executor/nodeNestloop.c,v 1.9 1998/02/26 04:31:31 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -380,18 +380,18 @@ ExecEndNestLoop(NestLoop *node)
void
ExecReScanNestLoop(NestLoop *node, ExprContext *exprCtxt, Plan *parent)
{
- NestLoopState *nlstate = node->nlstate;
- Plan *outerPlan = outerPlan((Plan*) node);
+ NestLoopState *nlstate = node->nlstate;
+ Plan *outerPlan = outerPlan((Plan *) node);
/*
- * If outerPlan->chgParam is not null then plan will be
- * automatically re-scanned by first ExecProcNode.
- * innerPlan is re-scanned for each new outer tuple and MUST NOT
- * be re-scanned from here or you'll get troubles from inner
- * index scans when outer Vars are used as run-time keys...
+ * If outerPlan->chgParam is not null then plan will be automatically
+ * re-scanned by first ExecProcNode. innerPlan is re-scanned for each
+ * new outer tuple and MUST NOT be re-scanned from here or you'll get
+ * troubles from inner index scans when outer Vars are used as
+ * run-time keys...
*/
if (outerPlan->chgParam == NULL)
- ExecReScan (outerPlan, exprCtxt, (Plan *) node);
+ ExecReScan(outerPlan, exprCtxt, (Plan *) node);
/* let outerPlan to free its result typle ... */
nlstate->jstate.cs_OuterTupleSlot = NULL;
diff --git a/src/backend/executor/nodeResult.c b/src/backend/executor/nodeResult.c
index 8c2edfd44a2..9bc6342b668 100644
--- a/src/backend/executor/nodeResult.c
+++ b/src/backend/executor/nodeResult.c
@@ -27,7 +27,7 @@
* SeqScan (emp.all)
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/executor/nodeResult.c,v 1.7 1998/02/18 07:19:34 thomas Exp $
+ * $Header: /cvsroot/pgsql/src/backend/executor/nodeResult.c,v 1.8 1998/02/26 04:31:31 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -79,8 +79,8 @@ ExecResult(Result *node)
*/
if (resstate->rs_checkqual)
{
- bool qualResult = ExecQual((List *) node->resconstantqual, econtext);
-
+ bool qualResult = ExecQual((List *) node->resconstantqual, econtext);
+
resstate->rs_checkqual = false;
if (qualResult == false)
{
@@ -195,7 +195,7 @@ ExecInitResult(Result *node, EState *estate, Plan *parent)
resstate->rs_done = false;
resstate->rs_checkqual = (node->resconstantqual == NULL) ? false : true;
node->resstate = resstate;
-
+
/* ----------------
* Miscellanious initialization
*
@@ -281,18 +281,18 @@ ExecEndResult(Result *node)
void
ExecReScanResult(Result *node, ExprContext *exprCtxt, Plan *parent)
{
- ResultState *resstate = node->resstate;
+ ResultState *resstate = node->resstate;
resstate->rs_done = false;
resstate->cstate.cs_TupFromTlist = false;
resstate->rs_checkqual = (node->resconstantqual == NULL) ? false : true;
-
- /*
- * if chgParam of subnode is not null then plan
- * will be re-scanned by first ExecProcNode.
+
+ /*
+ * if chgParam of subnode is not null then plan will be re-scanned by
+ * first ExecProcNode.
*/
- if (((Plan*) node)->lefttree &&
- ((Plan*) node)->lefttree->chgParam == NULL)
- ExecReScan (((Plan*) node)->lefttree, exprCtxt, (Plan *) node);
-
+ if (((Plan *) node)->lefttree &&
+ ((Plan *) node)->lefttree->chgParam == NULL)
+ ExecReScan(((Plan *) node)->lefttree, exprCtxt, (Plan *) node);
+
}
diff --git a/src/backend/executor/nodeSort.c b/src/backend/executor/nodeSort.c
index 77d43f928a9..665555fa456 100644
--- a/src/backend/executor/nodeSort.c
+++ b/src/backend/executor/nodeSort.c
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/executor/nodeSort.c,v 1.13 1998/02/23 06:26:56 vadim Exp $
+ * $Header: /cvsroot/pgsql/src/backend/executor/nodeSort.c,v 1.14 1998/02/26 04:31:32 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -112,7 +112,7 @@ ExecSort(Sort *node)
ScanKey sortkeys;
HeapTuple heapTuple;
TupleTableSlot *slot;
- bool should_free;
+ bool should_free;
/* ----------------
* get state info from node
@@ -395,21 +395,21 @@ ExecReScanSort(Sort *node, ExprContext *exprCtxt, Plan *parent)
SortState *sortstate = node->sortstate;
/*
- * If we haven't sorted yet, just return. If outerplan'
- * chgParam is not NULL then it will be re-scanned by
- * ExecProcNode, else - no reason to re-scan it at all.
+ * If we haven't sorted yet, just return. If outerplan' chgParam is
+ * not NULL then it will be re-scanned by ExecProcNode, else - no
+ * reason to re-scan it at all.
*/
if (sortstate->sort_Flag == false)
return;
-
+
ExecClearTuple(sortstate->csstate.cstate.cs_ResultTupleSlot);
-
- psort_rescan (node);
-
+
+ psort_rescan(node);
+
/*
* If subnode is to be rescanned then we aren't sorted
*/
- if (((Plan*) node)->lefttree->chgParam != NULL)
+ if (((Plan *) node)->lefttree->chgParam != NULL)
sortstate->sort_Flag = false;
}
diff --git a/src/backend/executor/nodeSubplan.c b/src/backend/executor/nodeSubplan.c
index 3c5560d13bd..edd1908fc37 100644
--- a/src/backend/executor/nodeSubplan.c
+++ b/src/backend/executor/nodeSubplan.c
@@ -7,9 +7,9 @@
*/
/*
* INTERFACE ROUTINES
- * ExecSubPlan - process a subselect
+ * ExecSubPlan - process a subselect
* ExecInitSubPlan - initialize a subselect
- * ExecEndSubPlan - shut down a subselect
+ * ExecEndSubPlan - shut down a subselect
*/
#include "postgres.h"
@@ -27,77 +27,77 @@
Datum
ExecSubPlan(SubPlan *node, List *pvar, ExprContext *econtext)
{
- Plan *plan = node->plan;
- SubLink *sublink = node->sublink;
+ Plan *plan = node->plan;
+ SubLink *sublink = node->sublink;
TupleTableSlot *slot;
- List *lst;
- bool result = false;
- bool found = false;
-
- if ( node->setParam != NULL )
- elog (ERROR, "ExecSubPlan: can't set parent params from subquery");
-
+ List *lst;
+ bool result = false;
+ bool found = false;
+
+ if (node->setParam != NULL)
+ elog(ERROR, "ExecSubPlan: can't set parent params from subquery");
+
/*
* Set Params of this plan from parent plan correlation Vars
*/
- if ( node->parParam != NULL )
+ if (node->parParam != NULL)
{
- foreach (lst, node->parParam)
+ foreach(lst, node->parParam)
{
- ParamExecData *prm = &(econtext->ecxt_param_exec_vals[lfirsti(lst)]);
-
- prm->value = ExecEvalExpr ((Node*) lfirst(pvar),
- econtext,
- &(prm->isnull), NULL);
- pvar = lnext (pvar);
+ ParamExecData *prm = &(econtext->ecxt_param_exec_vals[lfirsti(lst)]);
+
+ prm->value = ExecEvalExpr((Node *) lfirst(pvar),
+ econtext,
+ &(prm->isnull), NULL);
+ pvar = lnext(pvar);
}
- plan->chgParam = nconc (plan->chgParam, listCopy(node->parParam));
+ plan->chgParam = nconc(plan->chgParam, listCopy(node->parParam));
}
-
- ExecReScan (plan, (ExprContext*) NULL, plan);
-
- for (slot = ExecProcNode (plan, plan);
- !TupIsNull(slot);
- slot = ExecProcNode (plan, plan))
+
+ ExecReScan(plan, (ExprContext *) NULL, plan);
+
+ for (slot = ExecProcNode(plan, plan);
+ !TupIsNull(slot);
+ slot = ExecProcNode(plan, plan))
{
HeapTuple tup = slot->val;
TupleDesc tdesc = slot->ttc_tupleDescriptor;
int i = 1;
-
- if ( sublink->subLinkType == EXPR_SUBLINK && found )
+
+ if (sublink->subLinkType == EXPR_SUBLINK && found)
{
- elog (ERROR, "ExecSubPlan: more than one tuple returned by expression subselect");
+ elog(ERROR, "ExecSubPlan: more than one tuple returned by expression subselect");
return ((Datum) false);
}
-
- if ( sublink->subLinkType == EXISTS_SUBLINK )
+
+ if (sublink->subLinkType == EXISTS_SUBLINK)
return ((Datum) true);
-
+
found = true;
-
- foreach (lst, sublink->oper)
+
+ foreach(lst, sublink->oper)
{
- Expr *expr = (Expr*) lfirst(lst);
- Const *con = lsecond(expr->args);
- bool isnull;
-
- con->constvalue = heap_getattr (tup, i, tdesc, &(con->constisnull));
- result = (bool) ExecEvalExpr ((Node*) expr, econtext, &isnull, (bool*) NULL);
- if ( isnull )
+ Expr *expr = (Expr *) lfirst(lst);
+ Const *con = lsecond(expr->args);
+ bool isnull;
+
+ con->constvalue = heap_getattr(tup, i, tdesc, &(con->constisnull));
+ result = (bool) ExecEvalExpr((Node *) expr, econtext, &isnull, (bool *) NULL);
+ if (isnull)
result = false;
- if ( (!result && !(sublink->useor)) || (result && sublink->useor) )
+ if ((!result && !(sublink->useor)) || (result && sublink->useor))
break;
i++;
}
-
- if ( (!result && sublink->subLinkType == ALL_SUBLINK) ||
- (result && sublink->subLinkType == ANY_SUBLINK) )
+
+ if ((!result && sublink->subLinkType == ALL_SUBLINK) ||
+ (result && sublink->subLinkType == ANY_SUBLINK))
break;
}
-
- if ( !found && sublink->subLinkType == ALL_SUBLINK )
+
+ if (!found && sublink->subLinkType == ALL_SUBLINK)
return ((Datum) true);
-
+
return ((Datum) result);
}
@@ -109,42 +109,43 @@ ExecSubPlan(SubPlan *node, List *pvar, ExprContext *econtext)
bool
ExecInitSubPlan(SubPlan *node, EState *estate, Plan *parent)
{
- EState *sp_estate = CreateExecutorState ();
-
+ EState *sp_estate = CreateExecutorState();
+
sp_estate->es_range_table = node->rtable;
sp_estate->es_param_list_info = estate->es_param_list_info;
sp_estate->es_param_exec_vals = estate->es_param_exec_vals;
- sp_estate->es_tupleTable =
- ExecCreateTupleTable (ExecCountSlotsNode(node->plan) + 10);
- pfree (sp_estate->es_refcount);
+ sp_estate->es_tupleTable =
+ ExecCreateTupleTable(ExecCountSlotsNode(node->plan) + 10);
+ pfree(sp_estate->es_refcount);
sp_estate->es_refcount = estate->es_refcount;
-
- if ( !ExecInitNode (node->plan, sp_estate, NULL) )
+
+ if (!ExecInitNode(node->plan, sp_estate, NULL))
return (false);
-
+
node->shutdown = true;
-
+
/*
- * If this plan is un-correlated or undirect correlated one and
- * want to set params for parent plan then prepare parameters.
+ * If this plan is un-correlated or undirect correlated one and want
+ * to set params for parent plan then prepare parameters.
*/
- if ( node->setParam != NULL )
+ if (node->setParam != NULL)
{
- List *lst;
-
- foreach (lst, node->setParam)
+ List *lst;
+
+ foreach(lst, node->setParam)
{
- ParamExecData *prm = &(estate->es_param_exec_vals[lfirsti(lst)]);
-
+ ParamExecData *prm = &(estate->es_param_exec_vals[lfirsti(lst)]);
+
prm->execPlan = node;
}
+
/*
* Note that in the case of un-correlated subqueries we don't care
- * about setting parent->chgParam here: indices take care about it,
- * for others - it doesn't matter...
+ * about setting parent->chgParam here: indices take care about
+ * it, for others - it doesn't matter...
*/
}
-
+
return (true);
}
@@ -155,92 +156,92 @@ ExecInitSubPlan(SubPlan *node, EState *estate, Plan *parent)
* ----------------------------------------------------------------
*/
void
-ExecSetParamPlan (SubPlan *node)
+ExecSetParamPlan(SubPlan *node)
{
- Plan *plan = node->plan;
- SubLink *sublink = node->sublink;
+ Plan *plan = node->plan;
+ SubLink *sublink = node->sublink;
TupleTableSlot *slot;
- List *lst;
- bool found = false;
-
- if ( sublink->subLinkType == ANY_SUBLINK ||
- sublink->subLinkType == ALL_SUBLINK )
- elog (ERROR, "ExecSetParamPlan: ANY/ALL subselect unsupported");
-
- if ( plan->chgParam != NULL )
- ExecReScan (plan, (ExprContext*) NULL, plan);
-
- for (slot = ExecProcNode (plan, plan);
- !TupIsNull(slot);
- slot = ExecProcNode (plan, plan))
+ List *lst;
+ bool found = false;
+
+ if (sublink->subLinkType == ANY_SUBLINK ||
+ sublink->subLinkType == ALL_SUBLINK)
+ elog(ERROR, "ExecSetParamPlan: ANY/ALL subselect unsupported");
+
+ if (plan->chgParam != NULL)
+ ExecReScan(plan, (ExprContext *) NULL, plan);
+
+ for (slot = ExecProcNode(plan, plan);
+ !TupIsNull(slot);
+ slot = ExecProcNode(plan, plan))
{
HeapTuple tup = slot->val;
TupleDesc tdesc = slot->ttc_tupleDescriptor;
int i = 1;
-
- if ( sublink->subLinkType == EXPR_SUBLINK && found )
+
+ if (sublink->subLinkType == EXPR_SUBLINK && found)
{
- elog (ERROR, "ExecSetParamPlan: more than one tuple returned by expression subselect");
+ elog(ERROR, "ExecSetParamPlan: more than one tuple returned by expression subselect");
return;
}
-
+
found = true;
-
- if ( sublink->subLinkType == EXISTS_SUBLINK )
+
+ if (sublink->subLinkType == EXISTS_SUBLINK)
{
- ParamExecData *prm = &(plan->state->es_param_exec_vals[lfirsti(node->setParam)]);
-
+ ParamExecData *prm = &(plan->state->es_param_exec_vals[lfirsti(node->setParam)]);
+
prm->execPlan = NULL;
prm->value = (Datum) true;
prm->isnull = false;
break;
}
-
- /*
+
+ /*
* If this is uncorrelated subquery then its plan will be closed
* (see below) and this tuple will be free-ed - bad for not byval
* types... But is free-ing possible in the next ExecProcNode in
- * this loop ? Who knows... Someday we'll keep track of saved
+ * this loop ? Who knows... Someday we'll keep track of saved
* tuples...
*/
- tup = heap_copytuple (tup);
-
- foreach (lst, node->setParam)
+ tup = heap_copytuple(tup);
+
+ foreach(lst, node->setParam)
{
- ParamExecData *prm = &(plan->state->es_param_exec_vals[lfirsti(lst)]);
-
+ ParamExecData *prm = &(plan->state->es_param_exec_vals[lfirsti(lst)]);
+
prm->execPlan = NULL;
- prm->value = heap_getattr (tup, i, tdesc, &(prm->isnull));
+ prm->value = heap_getattr(tup, i, tdesc, &(prm->isnull));
i++;
}
}
-
- if ( !found )
+
+ if (!found)
{
- if ( sublink->subLinkType == EXISTS_SUBLINK )
+ if (sublink->subLinkType == EXISTS_SUBLINK)
{
- ParamExecData *prm = &(plan->state->es_param_exec_vals[lfirsti(node->setParam)]);
-
+ ParamExecData *prm = &(plan->state->es_param_exec_vals[lfirsti(node->setParam)]);
+
prm->execPlan = NULL;
prm->value = (Datum) false;
prm->isnull = false;
}
else
{
- foreach (lst, node->setParam)
+ foreach(lst, node->setParam)
{
- ParamExecData *prm = &(plan->state->es_param_exec_vals[lfirsti(lst)]);
-
+ ParamExecData *prm = &(plan->state->es_param_exec_vals[lfirsti(lst)]);
+
prm->execPlan = NULL;
prm->value = (Datum) NULL;
prm->isnull = true;
}
}
}
-
- if ( plan->extParam == NULL ) /* un-correlated ... */
+
+ if (plan->extParam == NULL) /* un-correlated ... */
{
- ExecEndNode (plan, plan);
+ ExecEndNode(plan, plan);
node->shutdown = false;
}
}
@@ -252,41 +253,40 @@ ExecSetParamPlan (SubPlan *node)
void
ExecEndSubPlan(SubPlan *node)
{
-
- if ( node->shutdown )
+
+ if (node->shutdown)
{
- ExecEndNode (node->plan, node->plan);
+ ExecEndNode(node->plan, node->plan);
node->shutdown = false;
}
-
+
}
-void
-ExecReScanSetParamPlan (SubPlan *node, Plan *parent)
+void
+ExecReScanSetParamPlan(SubPlan *node, Plan *parent)
{
- Plan *plan = node->plan;
- List *lst;
-
- if ( node->parParam != NULL )
- elog (ERROR, "ExecReScanSetParamPlan: direct correlated subquery unsupported, yet");
- if ( node->setParam == NULL )
- elog (ERROR, "ExecReScanSetParamPlan: setParam list is NULL");
- if ( plan->extParam == NULL )
- elog (ERROR, "ExecReScanSetParamPlan: extParam list of plan is NULL");
-
- /*
- * Don't actual re-scan: ExecSetParamPlan does re-scan if
- * node->plan->chgParam is not NULL...
- ExecReScan (plan, NULL, plan);
+ Plan *plan = node->plan;
+ List *lst;
+
+ if (node->parParam != NULL)
+ elog(ERROR, "ExecReScanSetParamPlan: direct correlated subquery unsupported, yet");
+ if (node->setParam == NULL)
+ elog(ERROR, "ExecReScanSetParamPlan: setParam list is NULL");
+ if (plan->extParam == NULL)
+ elog(ERROR, "ExecReScanSetParamPlan: extParam list of plan is NULL");
+
+ /*
+ * Don't actual re-scan: ExecSetParamPlan does re-scan if
+ * node->plan->chgParam is not NULL... ExecReScan (plan, NULL, plan);
*/
-
- foreach (lst, node->setParam)
+
+ foreach(lst, node->setParam)
{
- ParamExecData *prm = &(plan->state->es_param_exec_vals[lfirsti(lst)]);
-
+ ParamExecData *prm = &(plan->state->es_param_exec_vals[lfirsti(lst)]);
+
prm->execPlan = node;
}
-
- parent->chgParam = nconc (parent->chgParam, listCopy(node->setParam));
+
+ parent->chgParam = nconc(parent->chgParam, listCopy(node->setParam));
}
diff --git a/src/backend/executor/nodeTee.c b/src/backend/executor/nodeTee.c
index f059ef8d6e3..23e09682ea9 100644
--- a/src/backend/executor/nodeTee.c
+++ b/src/backend/executor/nodeTee.c
@@ -15,7 +15,7 @@
* ExecEndTee
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/executor/Attic/nodeTee.c,v 1.15 1998/01/07 21:02:58 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/executor/Attic/nodeTee.c,v 1.16 1998/02/26 04:31:33 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -168,7 +168,7 @@ ExecInitTee(Tee *node, EState *currentEstate, Plan *parent)
bufferRel = heap_openr(teeState->tee_bufferRelname);
else
bufferRel = heap_open(
- heap_create_with_catalog(teeState->tee_bufferRelname, tupType));
+ heap_create_with_catalog(teeState->tee_bufferRelname, tupType));
}
else
{
@@ -177,7 +177,7 @@ ExecInitTee(Tee *node, EState *currentEstate, Plan *parent)
newoid());
/* bufferRel = ExecCreatR(len, tupType, _TEMP_RELATION_ID); */
bufferRel = heap_open(
- heap_create_with_catalog(teeState->tee_bufferRelname, tupType));
+ heap_create_with_catalog(teeState->tee_bufferRelname, tupType));
}
teeState->tee_bufferRel = bufferRel;
@@ -246,7 +246,7 @@ initTeeScanDescs(Tee *node)
{
teeState->tee_leftScanDesc = heap_beginscan(bufferRel,
ScanDirectionIsBackward(dir),
- false, /* seeself */
+ false, /* seeself */
0, /* num scan keys */
NULL /* scan keys */
);
@@ -255,7 +255,7 @@ initTeeScanDescs(Tee *node)
{
teeState->tee_rightScanDesc = heap_beginscan(bufferRel,
ScanDirectionIsBackward(dir),
- false, /* seeself */
+ false, /* seeself */
0, /* num scan keys */
NULL /* scan keys */
);
diff --git a/src/backend/executor/nodeUnique.c b/src/backend/executor/nodeUnique.c
index 31c80e759a7..66b11a66600 100644
--- a/src/backend/executor/nodeUnique.c
+++ b/src/backend/executor/nodeUnique.c
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/executor/nodeUnique.c,v 1.16 1998/02/23 06:26:58 vadim Exp $
+ * $Header: /cvsroot/pgsql/src/backend/executor/nodeUnique.c,v 1.17 1998/02/26 04:31:34 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -187,7 +187,7 @@ ExecUnique(Unique *node)
char *val1,
*val2;
- attr1 = heap_getattr(slot->val,
+ attr1 = heap_getattr(slot->val,
uniqueAttrNum, tupDesc, &isNull1);
attr2 = heap_getattr(resultTupleSlot->val,
uniqueAttrNum, tupDesc, &isNull2);
@@ -197,11 +197,11 @@ ExecUnique(Unique *node)
if (isNull1) /* both are null, they are equal */
continue;
val1 = fmgr(typoutput, attr1,
- gettypelem(tupDesc->attrs[uniqueAttrNum - 1]->atttypid),
- tupDesc->attrs[uniqueAttrNum - 1]->atttypmod);
+ gettypelem(tupDesc->attrs[uniqueAttrNum - 1]->atttypid),
+ tupDesc->attrs[uniqueAttrNum - 1]->atttypmod);
val2 = fmgr(typoutput, attr2,
- gettypelem(tupDesc->attrs[uniqueAttrNum - 1]->atttypid),
- tupDesc->attrs[uniqueAttrNum - 1]->atttypmod);
+ gettypelem(tupDesc->attrs[uniqueAttrNum - 1]->atttypid),
+ tupDesc->attrs[uniqueAttrNum - 1]->atttypmod);
/*
* now, val1 and val2 are ascii representations so we can
@@ -209,12 +209,12 @@ ExecUnique(Unique *node)
*/
if (strcmp(val1, val2) == 0) /* they are equal */
{
- pfree (val1);
- pfree (val2);
+ pfree(val1);
+ pfree(val2);
continue;
}
- pfree (val1);
- pfree (val2);
+ pfree(val1);
+ pfree(val2);
break;
}
else
@@ -361,13 +361,14 @@ void
ExecReScanUnique(Unique *node, ExprContext *exprCtxt, Plan *parent)
{
UniqueState *uniquestate = node->uniquestate;
-
+
ExecClearTuple(uniquestate->cs_ResultTupleSlot);
- /*
- * if chgParam of subnode is not null then plan
- * will be re-scanned by first ExecProcNode.
+
+ /*
+ * if chgParam of subnode is not null then plan will be re-scanned by
+ * first ExecProcNode.
*/
- if (((Plan*) node)->lefttree->chgParam == NULL)
- ExecReScan (((Plan*) node)->lefttree, exprCtxt, (Plan *) node);
-
+ if (((Plan *) node)->lefttree->chgParam == NULL)
+ ExecReScan(((Plan *) node)->lefttree, exprCtxt, (Plan *) node);
+
}
diff --git a/src/backend/executor/spi.c b/src/backend/executor/spi.c
index f1dfe837e24..040baa7d42e 100644
--- a/src/backend/executor/spi.c
+++ b/src/backend/executor/spi.c
@@ -18,7 +18,7 @@ typedef struct
Portal portal; /* portal per procedure */
MemoryContext savedcxt;
CommandId savedId;
-} _SPI_connection;
+} _SPI_connection;
static Portal _SPI_portal = (Portal) NULL;
static _SPI_connection *_SPI_stack = NULL;
@@ -38,24 +38,24 @@ typedef struct
List *ptlist;
int nargs;
Oid *argtypes;
-} _SPI_plan;
+} _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
-_SPI_execute_plan(_SPI_plan * plan,
- Datum * Values, char *Nulls, int tcount);
+_SPI_execute_plan(_SPI_plan *plan,
+ Datum *Values, char *Nulls, int tcount);
#define _SPI_CPLAN_CURCXT 0
#define _SPI_CPLAN_PROCXT 1
#define _SPI_CPLAN_TOPCXT 2
-static _SPI_plan *_SPI_copy_plan(_SPI_plan * plan, int location);
+static _SPI_plan *_SPI_copy_plan(_SPI_plan *plan, int location);
static int _SPI_begin_call(bool execmem);
static int _SPI_end_call(bool procmem);
@@ -202,7 +202,7 @@ SPI_exec(char *src, int tcount)
}
int
-SPI_execp(void *plan, Datum * Values, char *Nulls, int tcount)
+SPI_execp(void *plan, Datum *Values, char *Nulls, int tcount)
{
int res;
@@ -225,8 +225,8 @@ SPI_execp(void *plan, Datum * Values, char *Nulls, int tcount)
return (res);
}
-void *
-SPI_prepare(char *src, int nargs, Oid * argtypes)
+void *
+SPI_prepare(char *src, int nargs, Oid *argtypes)
{
_SPI_plan *plan;
@@ -257,7 +257,7 @@ SPI_prepare(char *src, int nargs, Oid * argtypes)
}
-void *
+void *
SPI_saveplan(void *plan)
{
_SPI_plan *newplan;
@@ -310,7 +310,7 @@ SPI_copytuple(HeapTuple tuple)
HeapTuple
SPI_modifytuple(Relation rel, HeapTuple tuple, int natts, int *attnum,
- Datum * Values, char *Nulls)
+ Datum *Values, char *Nulls)
{
MemoryContext oldcxt = NULL;
HeapTuple mtuple;
@@ -392,7 +392,7 @@ SPI_fnumber(TupleDesc tupdesc, char *fname)
return (SPI_ERROR_NOATTRIBUTE);
}
-char *
+char *
SPI_fname(TupleDesc tupdesc, int fnumber)
{
@@ -406,7 +406,7 @@ SPI_fname(TupleDesc tupdesc, int fnumber)
return (nameout(&(tupdesc->attrs[fnumber - 1]->attname)));
}
-char *
+char *
SPI_getvalue(HeapTuple tuple, TupleDesc tupdesc, int fnumber)
{
Datum val;
@@ -431,12 +431,12 @@ SPI_getvalue(HeapTuple tuple, TupleDesc tupdesc, int fnumber)
}
return (fmgr(foutoid, val,
- gettypelem(tupdesc->attrs[fnumber - 1]->atttypid),
- tupdesc->attrs[fnumber - 1]->atttypmod));
+ gettypelem(tupdesc->attrs[fnumber - 1]->atttypid),
+ tupdesc->attrs[fnumber - 1]->atttypmod));
}
Datum
-SPI_getbinval(HeapTuple tuple, TupleDesc tupdesc, int fnumber, bool * isnull)
+SPI_getbinval(HeapTuple tuple, TupleDesc tupdesc, int fnumber, bool *isnull)
{
Datum val;
@@ -453,7 +453,7 @@ SPI_getbinval(HeapTuple tuple, TupleDesc tupdesc, int fnumber, bool * isnull)
return (val);
}
-char *
+char *
SPI_gettype(TupleDesc tupdesc, int fnumber)
{
HeapTuple typeTuple;
@@ -492,70 +492,70 @@ SPI_gettypeid(TupleDesc tupdesc, int fnumber)
return (tupdesc->attrs[fnumber - 1]->atttypid);
}
-char *
+char *
SPI_getrelname(Relation rel)
{
return (pstrdup(rel->rd_rel->relname.data));
}
void *
-SPI_palloc (Size size)
+SPI_palloc(Size size)
{
- MemoryContext oldcxt = NULL;
- void *pointer;
-
+ MemoryContext oldcxt = NULL;
+ void *pointer;
+
if (_SPI_curid + 1 == _SPI_connected) /* connected */
{
if (_SPI_current != &(_SPI_stack[_SPI_curid + 1]))
elog(FATAL, "SPI: stack corrupted");
oldcxt = MemoryContextSwitchTo(_SPI_current->savedcxt);
}
-
- pointer = palloc (size);
-
+
+ pointer = palloc(size);
+
if (oldcxt)
MemoryContextSwitchTo(oldcxt);
-
+
return (pointer);
}
void *
-SPI_repalloc (void *pointer, Size size)
+SPI_repalloc(void *pointer, Size size)
{
- MemoryContext oldcxt = NULL;
-
+ MemoryContext oldcxt = NULL;
+
if (_SPI_curid + 1 == _SPI_connected) /* connected */
{
if (_SPI_current != &(_SPI_stack[_SPI_curid + 1]))
elog(FATAL, "SPI: stack corrupted");
oldcxt = MemoryContextSwitchTo(_SPI_current->savedcxt);
}
-
- pointer = repalloc (pointer, size);
-
+
+ pointer = repalloc(pointer, size);
+
if (oldcxt)
MemoryContextSwitchTo(oldcxt);
-
+
return (pointer);
}
-void
-SPI_pfree (void *pointer)
+void
+SPI_pfree(void *pointer)
{
- MemoryContext oldcxt = NULL;
-
+ MemoryContext oldcxt = NULL;
+
if (_SPI_curid + 1 == _SPI_connected) /* connected */
{
if (_SPI_current != &(_SPI_stack[_SPI_curid + 1]))
elog(FATAL, "SPI: stack corrupted");
oldcxt = MemoryContextSwitchTo(_SPI_current->savedcxt);
}
-
- pfree (pointer);
-
+
+ pfree(pointer);
+
if (oldcxt)
MemoryContextSwitchTo(oldcxt);
-
+
return;
}
@@ -613,7 +613,7 @@ spi_printtup(HeapTuple tuple, TupleDesc tupdesc)
*/
static int
-_SPI_execute(char *src, int tcount, _SPI_plan * plan)
+_SPI_execute(char *src, int tcount, _SPI_plan *plan)
{
QueryTreeList *queryTree_list;
List *planTree_list;
@@ -710,7 +710,7 @@ _SPI_execute(char *src, int tcount, _SPI_plan * plan)
}
static int
-_SPI_execute_plan(_SPI_plan * plan, Datum * Values, char *Nulls, int tcount)
+_SPI_execute_plan(_SPI_plan *plan, Datum *Values, char *Nulls, int tcount)
{
QueryTreeList *queryTree_list = plan->qtlist;
List *planTree_list = plan->ptlist;
@@ -781,12 +781,12 @@ _SPI_execute_plan(_SPI_plan * plan, Datum * Values, char *Nulls, int tcount)
}
static int
-_SPI_pquery(QueryDesc * queryDesc, EState * state, int tcount)
+_SPI_pquery(QueryDesc *queryDesc, EState *state, int tcount)
{
Query *parseTree = queryDesc->parsetree;
Plan *plan = queryDesc->plantree;
int operation = queryDesc->operation;
- CommandDest dest = queryDesc->dest;
+ CommandDest dest = queryDesc->dest;
TupleDesc tupdesc;
bool isRetrieveIntoPortal = false;
bool isRetrieveIntoRelation = false;
@@ -810,7 +810,7 @@ _SPI_pquery(QueryDesc * queryDesc, EState * state, int tcount)
{
res = SPI_OK_SELINTO;
isRetrieveIntoRelation = true;
- queryDesc->dest = None; /* */
+ queryDesc->dest = None; /* */
}
break;
case CMD_INSERT:
@@ -878,7 +878,7 @@ _SPI_pquery(QueryDesc * queryDesc, EState * state, int tcount)
#if 0
static void
-_SPI_fetch(FetchStmt * stmt)
+_SPI_fetch(FetchStmt *stmt)
{
char *name = stmt->portalname;
int feature = (stmt->direction == FORWARD) ? EXEC_FOR : EXEC_BACK;
@@ -1001,7 +1001,8 @@ _SPI_checktuples()
if (tuptable != NULL)
failed = true;
}
- else /* some tuples were processed */
+ else
+/* some tuples were processed */
{
if (tuptable == NULL) /* spi_printtup was not called */
failed = true;
@@ -1013,7 +1014,7 @@ _SPI_checktuples()
}
static _SPI_plan *
-_SPI_copy_plan(_SPI_plan * plan, int location)
+_SPI_copy_plan(_SPI_plan *plan, int location)
{
_SPI_plan *newplan;
MemoryContext oldcxt = NULL;