mirror of
https://github.com/postgres/postgres.git
synced 2025-07-28 23:42:10 +03:00
pgindent run.
This commit is contained in:
@ -8,7 +8,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/executor/execJunk.c,v 1.31 2002/07/20 05:16:57 momjian Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/executor/execJunk.c,v 1.32 2002/09/04 20:31:17 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -383,8 +383,8 @@ ExecRemoveJunk(JunkFilter *junkfilter, TupleTableSlot *slot)
|
||||
* information for the new "clean" tuple.
|
||||
*
|
||||
* Note: we use memory on the stack to optimize things when we are
|
||||
* dealing with a small number of attributes. for large tuples we
|
||||
* just use palloc.
|
||||
* dealing with a small number of attributes. for large tuples we just
|
||||
* use palloc.
|
||||
*/
|
||||
if (cleanLength > 64)
|
||||
{
|
||||
|
@ -27,7 +27,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/executor/execMain.c,v 1.177 2002/09/02 01:05:05 tgl Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/executor/execMain.c,v 1.178 2002/09/04 20:31:17 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -63,14 +63,14 @@ static TupleTableSlot *ExecutePlan(EState *estate, Plan *plan,
|
||||
ScanDirection direction,
|
||||
DestReceiver *destfunc);
|
||||
static void ExecSelect(TupleTableSlot *slot,
|
||||
DestReceiver *destfunc,
|
||||
EState *estate);
|
||||
DestReceiver *destfunc,
|
||||
EState *estate);
|
||||
static void ExecInsert(TupleTableSlot *slot, ItemPointer tupleid,
|
||||
EState *estate);
|
||||
static void ExecDelete(TupleTableSlot *slot, ItemPointer tupleid,
|
||||
EState *estate);
|
||||
static void ExecUpdate(TupleTableSlot *slot, ItemPointer tupleid,
|
||||
EState *estate);
|
||||
EState *estate);
|
||||
static TupleTableSlot *EvalPlanQualNext(EState *estate);
|
||||
static void EndEvalPlanQual(EState *estate);
|
||||
static void ExecCheckQueryPerms(CmdType operation, Query *parseTree,
|
||||
@ -116,9 +116,9 @@ ExecutorStart(QueryDesc *queryDesc, EState *estate)
|
||||
/*
|
||||
* Make our own private copy of the current query snapshot data.
|
||||
*
|
||||
* This "freezes" our idea of which tuples are good and which are not
|
||||
* for the life of this query, even if it outlives the current command
|
||||
* and current snapshot.
|
||||
* This "freezes" our idea of which tuples are good and which are not for
|
||||
* the life of this query, even if it outlives the current command and
|
||||
* current snapshot.
|
||||
*/
|
||||
estate->es_snapshot = CopyQuerySnapshot();
|
||||
|
||||
@ -353,12 +353,13 @@ ExecCheckRTEPerms(RangeTblEntry *rte, CmdType operation)
|
||||
Oid userid;
|
||||
AclResult aclcheck_result;
|
||||
|
||||
/*
|
||||
/*
|
||||
* Only plain-relation RTEs need to be checked here. Subquery RTEs
|
||||
* will be checked when ExecCheckPlanPerms finds the SubqueryScan node,
|
||||
* and function RTEs are checked by init_fcache when the function is
|
||||
* prepared for execution. Join and special RTEs need no checks.
|
||||
*/
|
||||
* will be checked when ExecCheckPlanPerms finds the SubqueryScan
|
||||
* node, and function RTEs are checked by init_fcache when the
|
||||
* function is prepared for execution. Join and special RTEs need no
|
||||
* checks.
|
||||
*/
|
||||
if (rte->rtekind != RTE_RELATION)
|
||||
return;
|
||||
|
||||
@ -1071,7 +1072,8 @@ lnext: ;
|
||||
|
||||
slot = ExecStoreTuple(newTuple, /* tuple to store */
|
||||
junkfilter->jf_resultSlot, /* dest slot */
|
||||
InvalidBuffer, /* this tuple has no buffer */
|
||||
InvalidBuffer, /* this tuple has no
|
||||
* buffer */
|
||||
true); /* tuple should be pfreed */
|
||||
}
|
||||
|
||||
@ -1083,8 +1085,9 @@ lnext: ;
|
||||
switch (operation)
|
||||
{
|
||||
case CMD_SELECT:
|
||||
ExecSelect(slot, /* slot containing tuple */
|
||||
destfunc, /* destination's tuple-receiver obj */
|
||||
ExecSelect(slot, /* slot containing tuple */
|
||||
destfunc, /* destination's tuple-receiver
|
||||
* obj */
|
||||
estate);
|
||||
result = slot;
|
||||
break;
|
||||
@ -1357,8 +1360,8 @@ ldelete:;
|
||||
*/
|
||||
static void
|
||||
ExecUpdate(TupleTableSlot *slot,
|
||||
ItemPointer tupleid,
|
||||
EState *estate)
|
||||
ItemPointer tupleid,
|
||||
EState *estate)
|
||||
{
|
||||
HeapTuple tuple;
|
||||
ResultRelInfo *resultRelInfo;
|
||||
|
@ -8,7 +8,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/executor/execQual.c,v 1.107 2002/09/02 01:05:05 tgl Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/executor/execQual.c,v 1.108 2002/09/04 20:31:17 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -55,7 +55,7 @@ static Datum ExecEvalVar(Var *variable, ExprContext *econtext, bool *isNull);
|
||||
static Datum ExecEvalOper(Expr *opClause, ExprContext *econtext,
|
||||
bool *isNull, ExprDoneCond *isDone);
|
||||
static Datum ExecEvalDistinct(Expr *opClause, ExprContext *econtext,
|
||||
bool *isNull, ExprDoneCond *isDone);
|
||||
bool *isNull, ExprDoneCond *isDone);
|
||||
static Datum ExecEvalFunc(Expr *funcClause, ExprContext *econtext,
|
||||
bool *isNull, ExprDoneCond *isDone);
|
||||
static ExprDoneCond ExecEvalFuncArgs(FunctionCallInfo fcinfo,
|
||||
@ -70,8 +70,8 @@ static Datum ExecEvalNullTest(NullTest *ntest, ExprContext *econtext,
|
||||
static Datum ExecEvalBooleanTest(BooleanTest *btest, ExprContext *econtext,
|
||||
bool *isNull, ExprDoneCond *isDone);
|
||||
static Datum ExecEvalConstraintTest(ConstraintTest *constraint,
|
||||
ExprContext *econtext,
|
||||
bool *isNull, ExprDoneCond *isDone);
|
||||
ExprContext *econtext,
|
||||
bool *isNull, ExprDoneCond *isDone);
|
||||
|
||||
|
||||
/*----------
|
||||
@ -848,7 +848,7 @@ ExecMakeFunctionResult(FunctionCachePtr fcache,
|
||||
* ExecMakeTableFunctionResult
|
||||
*
|
||||
* Evaluate a table function, producing a materialized result in a Tuplestore
|
||||
* object. (If function returns an empty set, we just return NULL instead.)
|
||||
* object. (If function returns an empty set, we just return NULL instead.)
|
||||
*/
|
||||
Tuplestorestate *
|
||||
ExecMakeTableFunctionResult(Expr *funcexpr,
|
||||
@ -871,13 +871,14 @@ ExecMakeTableFunctionResult(Expr *funcexpr,
|
||||
bool returnsTuple = false;
|
||||
|
||||
/* Extract data from function-call expression node */
|
||||
if (!funcexpr || !IsA(funcexpr, Expr) || funcexpr->opType != FUNC_EXPR)
|
||||
if (!funcexpr || !IsA(funcexpr, Expr) ||funcexpr->opType != FUNC_EXPR)
|
||||
elog(ERROR, "ExecMakeTableFunctionResult: expression is not a function call");
|
||||
func = (Func *) funcexpr->oper;
|
||||
argList = funcexpr->args;
|
||||
|
||||
/*
|
||||
* get the fcache from the Func node. If it is NULL, then initialize it
|
||||
* get the fcache from the Func node. If it is NULL, then initialize
|
||||
* it
|
||||
*/
|
||||
fcache = func->func_fcache;
|
||||
if (fcache == NULL)
|
||||
@ -892,7 +893,7 @@ ExecMakeTableFunctionResult(Expr *funcexpr,
|
||||
*
|
||||
* Note: ideally, we'd do this in the per-tuple context, but then the
|
||||
* argument values would disappear when we reset the context in the
|
||||
* inner loop. So do it in caller context. Perhaps we should make a
|
||||
* inner loop. So do it in caller context. Perhaps we should make a
|
||||
* separate context just to hold the evaluated arguments?
|
||||
*/
|
||||
MemSet(&fcinfo, 0, sizeof(fcinfo));
|
||||
@ -921,8 +922,9 @@ ExecMakeTableFunctionResult(Expr *funcexpr,
|
||||
}
|
||||
|
||||
/*
|
||||
* Prepare a resultinfo node for communication. We always do this even
|
||||
* if not expecting a set result, so that we can pass expectedDesc.
|
||||
* Prepare a resultinfo node for communication. We always do this
|
||||
* even if not expecting a set result, so that we can pass
|
||||
* expectedDesc.
|
||||
*/
|
||||
fcinfo.resultinfo = (Node *) &rsinfo;
|
||||
rsinfo.type = T_ReturnSetInfo;
|
||||
@ -948,8 +950,9 @@ ExecMakeTableFunctionResult(Expr *funcexpr,
|
||||
HeapTuple tuple;
|
||||
|
||||
/*
|
||||
* reset per-tuple memory context before each call of the function.
|
||||
* This cleans up any local memory the function may leak when called.
|
||||
* reset per-tuple memory context before each call of the
|
||||
* function. This cleans up any local memory the function may leak
|
||||
* when called.
|
||||
*/
|
||||
ResetExprContext(econtext);
|
||||
|
||||
@ -964,18 +967,20 @@ ExecMakeTableFunctionResult(Expr *funcexpr,
|
||||
/*
|
||||
* Check for end of result set.
|
||||
*
|
||||
* Note: if function returns an empty set, we don't build a
|
||||
* Note: if function returns an empty set, we don't build a
|
||||
* tupdesc or tuplestore (since we can't get a tupdesc in the
|
||||
* function-returning-tuple case)
|
||||
*/
|
||||
if (rsinfo.isDone == ExprEndResult)
|
||||
break;
|
||||
|
||||
/*
|
||||
* If first time through, build tupdesc and tuplestore for result
|
||||
* If first time through, build tupdesc and tuplestore for
|
||||
* result
|
||||
*/
|
||||
if (first_time)
|
||||
{
|
||||
Oid funcrettype = funcexpr->typeOid;
|
||||
Oid funcrettype = funcexpr->typeOid;
|
||||
|
||||
oldcontext = MemoryContextSwitchTo(econtext->ecxt_per_query_memory);
|
||||
if (funcrettype == RECORDOID ||
|
||||
@ -1006,7 +1011,7 @@ ExecMakeTableFunctionResult(Expr *funcexpr,
|
||||
0,
|
||||
false);
|
||||
}
|
||||
tupstore = tuplestore_begin_heap(true, /* randomAccess */
|
||||
tupstore = tuplestore_begin_heap(true, /* randomAccess */
|
||||
SortMem);
|
||||
MemoryContextSwitchTo(oldcontext);
|
||||
rsinfo.setResult = tupstore;
|
||||
@ -1026,7 +1031,7 @@ ExecMakeTableFunctionResult(Expr *funcexpr,
|
||||
}
|
||||
else
|
||||
{
|
||||
char nullflag;
|
||||
char nullflag;
|
||||
|
||||
nullflag = fcinfo.isnull ? 'n' : ' ';
|
||||
tuple = heap_formtuple(tupdesc, &result, &nullflag);
|
||||
@ -1180,7 +1185,7 @@ ExecEvalDistinct(Expr *opClause,
|
||||
bool *isNull,
|
||||
ExprDoneCond *isDone)
|
||||
{
|
||||
bool result;
|
||||
bool result;
|
||||
FunctionCachePtr fcache;
|
||||
FunctionCallInfoData fcinfo;
|
||||
ExprDoneCond argDone;
|
||||
|
@ -15,7 +15,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/executor/execTuples.c,v 1.58 2002/09/02 01:05:05 tgl Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/executor/execTuples.c,v 1.59 2002/09/04 20:31:17 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -681,7 +681,7 @@ ExecTypeFromTL(List *targetList, bool hasoid)
|
||||
TupleTableSlot *
|
||||
TupleDescGetSlot(TupleDesc tupdesc)
|
||||
{
|
||||
TupleTableSlot *slot;
|
||||
TupleTableSlot *slot;
|
||||
|
||||
/* Make a standalone slot */
|
||||
slot = MakeTupleTableSlot();
|
||||
@ -701,19 +701,20 @@ TupleDescGetSlot(TupleDesc tupdesc)
|
||||
AttInMetadata *
|
||||
TupleDescGetAttInMetadata(TupleDesc tupdesc)
|
||||
{
|
||||
int natts = tupdesc->natts;
|
||||
int i;
|
||||
Oid atttypeid;
|
||||
Oid attinfuncid;
|
||||
FmgrInfo *attinfuncinfo;
|
||||
Oid *attelems;
|
||||
int32 *atttypmods;
|
||||
AttInMetadata *attinmeta;
|
||||
int natts = tupdesc->natts;
|
||||
int i;
|
||||
Oid atttypeid;
|
||||
Oid attinfuncid;
|
||||
FmgrInfo *attinfuncinfo;
|
||||
Oid *attelems;
|
||||
int32 *atttypmods;
|
||||
AttInMetadata *attinmeta;
|
||||
|
||||
attinmeta = (AttInMetadata *) palloc(sizeof(AttInMetadata));
|
||||
|
||||
/*
|
||||
* Gather info needed later to call the "in" function for each attribute
|
||||
* Gather info needed later to call the "in" function for each
|
||||
* attribute
|
||||
*/
|
||||
attinfuncinfo = (FmgrInfo *) palloc(natts * sizeof(FmgrInfo));
|
||||
attelems = (Oid *) palloc(natts * sizeof(Oid));
|
||||
@ -741,14 +742,14 @@ TupleDescGetAttInMetadata(TupleDesc tupdesc)
|
||||
HeapTuple
|
||||
BuildTupleFromCStrings(AttInMetadata *attinmeta, char **values)
|
||||
{
|
||||
TupleDesc tupdesc = attinmeta->tupdesc;
|
||||
int natts = tupdesc->natts;
|
||||
Datum *dvalues;
|
||||
char *nulls;
|
||||
int i;
|
||||
Oid attelem;
|
||||
int32 atttypmod;
|
||||
HeapTuple tuple;
|
||||
TupleDesc tupdesc = attinmeta->tupdesc;
|
||||
int natts = tupdesc->natts;
|
||||
Datum *dvalues;
|
||||
char *nulls;
|
||||
int i;
|
||||
Oid attelem;
|
||||
int32 atttypmod;
|
||||
HeapTuple tuple;
|
||||
|
||||
dvalues = (Datum *) palloc(natts * sizeof(Datum));
|
||||
nulls = (char *) palloc(natts * sizeof(char));
|
||||
@ -843,13 +844,14 @@ do_text_output_multiline(TupOutputState *tstate, char *text)
|
||||
{
|
||||
while (*text)
|
||||
{
|
||||
char *eol;
|
||||
char *eol;
|
||||
|
||||
eol = strchr(text, '\n');
|
||||
if (eol)
|
||||
*eol++ = '\0';
|
||||
else
|
||||
eol = text + strlen(text);
|
||||
eol = text +strlen(text);
|
||||
|
||||
do_tup_output(tstate, &text);
|
||||
text = eol;
|
||||
}
|
||||
|
@ -8,7 +8,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/executor/execUtils.c,v 1.89 2002/09/02 01:05:05 tgl Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/executor/execUtils.c,v 1.90 2002/09/04 20:31:18 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -297,19 +297,19 @@ ExecAssignResultTypeFromTL(Plan *node, CommonState *commonstate)
|
||||
/*
|
||||
* This is pretty grotty: we need to ensure that result tuples have
|
||||
* space for an OID iff they are going to be stored into a relation
|
||||
* that has OIDs. We assume that estate->es_result_relation_info
|
||||
* is already set up to describe the target relation. One reason
|
||||
* this is ugly is that all plan nodes in the plan tree will emit
|
||||
* tuples with space for an OID, though we really only need the topmost
|
||||
* plan to do so.
|
||||
* that has OIDs. We assume that estate->es_result_relation_info is
|
||||
* already set up to describe the target relation. One reason this is
|
||||
* ugly is that all plan nodes in the plan tree will emit tuples with
|
||||
* space for an OID, though we really only need the topmost plan to do
|
||||
* so.
|
||||
*
|
||||
* It would be better to have InitPlan adjust the topmost plan node's
|
||||
* output descriptor after plan tree initialization. However, that
|
||||
* doesn't quite work because in an UPDATE that spans an inheritance
|
||||
* tree, some of the target relations may have OIDs and some not.
|
||||
* We have to make the decision on a per-relation basis as we initialize
|
||||
* each of the child plans of the topmost Append plan. So, this is ugly
|
||||
* but it works, for now ...
|
||||
* tree, some of the target relations may have OIDs and some not. We
|
||||
* have to make the decision on a per-relation basis as we initialize
|
||||
* each of the child plans of the topmost Append plan. So, this is
|
||||
* ugly but it works, for now ...
|
||||
*/
|
||||
ri = node->state->es_result_relation_info;
|
||||
if (ri != NULL)
|
||||
@ -319,7 +319,7 @@ ExecAssignResultTypeFromTL(Plan *node, CommonState *commonstate)
|
||||
if (rel != NULL)
|
||||
hasoid = rel->rd_rel->relhasoids;
|
||||
}
|
||||
|
||||
|
||||
tupDesc = ExecTypeFromTL(node->targetlist, hasoid);
|
||||
ExecAssignResultType(commonstate, tupDesc, true);
|
||||
}
|
||||
@ -696,7 +696,7 @@ ExecInsertIndexTuples(TupleTableSlot *slot,
|
||||
nullv);
|
||||
|
||||
/*
|
||||
* The index AM does the rest. Note we suppress unique-index
|
||||
* The index AM does the rest. Note we suppress unique-index
|
||||
* checks if we are being called from VACUUM, since VACUUM may
|
||||
* need to move dead tuples that have the same keys as live ones.
|
||||
*/
|
||||
@ -705,7 +705,7 @@ ExecInsertIndexTuples(TupleTableSlot *slot,
|
||||
nullv, /* info on nulls */
|
||||
&(heapTuple->t_self), /* tid of heap tuple */
|
||||
heapRelation,
|
||||
relationDescs[i]->rd_index->indisunique && !is_vacuum);
|
||||
relationDescs[i]->rd_index->indisunique && !is_vacuum);
|
||||
|
||||
/*
|
||||
* keep track of index inserts for debugging
|
||||
@ -753,7 +753,7 @@ RegisterExprContextCallback(ExprContext *econtext,
|
||||
ExprContextCallbackFunction function,
|
||||
Datum arg)
|
||||
{
|
||||
ExprContext_CB *ecxt_callback;
|
||||
ExprContext_CB *ecxt_callback;
|
||||
|
||||
/* Save the info in appropriate memory context */
|
||||
ecxt_callback = (ExprContext_CB *)
|
||||
@ -779,8 +779,8 @@ UnregisterExprContextCallback(ExprContext *econtext,
|
||||
ExprContextCallbackFunction function,
|
||||
Datum arg)
|
||||
{
|
||||
ExprContext_CB **prev_callback;
|
||||
ExprContext_CB *ecxt_callback;
|
||||
ExprContext_CB **prev_callback;
|
||||
ExprContext_CB *ecxt_callback;
|
||||
|
||||
prev_callback = &econtext->ecxt_callbacks;
|
||||
|
||||
@ -792,9 +792,7 @@ UnregisterExprContextCallback(ExprContext *econtext,
|
||||
pfree(ecxt_callback);
|
||||
}
|
||||
else
|
||||
{
|
||||
prev_callback = &ecxt_callback->next;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -807,7 +805,7 @@ UnregisterExprContextCallback(ExprContext *econtext,
|
||||
static void
|
||||
ShutdownExprContext(ExprContext *econtext)
|
||||
{
|
||||
ExprContext_CB *ecxt_callback;
|
||||
ExprContext_CB *ecxt_callback;
|
||||
|
||||
/*
|
||||
* Call each callback function in reverse registration order.
|
||||
|
@ -8,7 +8,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/executor/functions.c,v 1.56 2002/08/29 00:17:04 tgl Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/executor/functions.c,v 1.57 2002/09/04 20:31:18 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -269,7 +269,7 @@ postquel_start(execution_state *es)
|
||||
static TupleTableSlot *
|
||||
postquel_getnext(execution_state *es)
|
||||
{
|
||||
long count;
|
||||
long count;
|
||||
|
||||
if (es->qd->operation == CMD_UTILITY)
|
||||
{
|
||||
@ -566,8 +566,8 @@ fmgr_sql(PG_FUNCTION_ARGS)
|
||||
elog(ERROR, "Set-valued function called in context that cannot accept a set");
|
||||
|
||||
/*
|
||||
* Ensure we will get shut down cleanly if the exprcontext is
|
||||
* not run to completion.
|
||||
* Ensure we will get shut down cleanly if the exprcontext is not
|
||||
* run to completion.
|
||||
*/
|
||||
if (!fcache->shutdown_reg)
|
||||
{
|
||||
|
@ -46,7 +46,7 @@
|
||||
* Portions Copyright (c) 1994, Regents of the University of California
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/executor/nodeAgg.c,v 1.85 2002/06/20 20:29:28 momjian Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/executor/nodeAgg.c,v 1.86 2002/09/04 20:31:18 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -877,8 +877,8 @@ ExecInitAgg(Agg *node, EState *estate, Plan *parent)
|
||||
&peraggstate->transtypeByVal);
|
||||
|
||||
/*
|
||||
* initval is potentially null, so don't try to access it as a struct
|
||||
* field. Must do it the hard way with SysCacheGetAttr.
|
||||
* initval is potentially null, so don't try to access it as a
|
||||
* struct field. Must do it the hard way with SysCacheGetAttr.
|
||||
*/
|
||||
textInitVal = SysCacheGetAttr(AGGFNOID, aggTuple,
|
||||
Anum_pg_aggregate_agginitval,
|
||||
@ -907,8 +907,8 @@ ExecInitAgg(Agg *node, EState *estate, Plan *parent)
|
||||
if (peraggstate->transfn.fn_strict && peraggstate->initValueIsNull)
|
||||
{
|
||||
/*
|
||||
* Note: use the type from the input expression here, not
|
||||
* from pg_proc.proargtypes, because the latter might be 0.
|
||||
* Note: use the type from the input expression here, not from
|
||||
* pg_proc.proargtypes, because the latter might be 0.
|
||||
* (Consider COUNT(*).)
|
||||
*/
|
||||
Oid inputType = exprType(aggref->target);
|
||||
@ -921,8 +921,8 @@ ExecInitAgg(Agg *node, EState *estate, Plan *parent)
|
||||
if (aggref->aggdistinct)
|
||||
{
|
||||
/*
|
||||
* Note: use the type from the input expression here, not
|
||||
* from pg_proc.proargtypes, because the latter might be 0.
|
||||
* Note: use the type from the input expression here, not from
|
||||
* pg_proc.proargtypes, because the latter might be 0.
|
||||
* (Consider COUNT(*).)
|
||||
*/
|
||||
Oid inputType = exprType(aggref->target);
|
||||
|
@ -8,7 +8,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/executor/nodeFunctionscan.c,v 1.11 2002/09/02 01:05:05 tgl Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/executor/nodeFunctionscan.c,v 1.12 2002/09/04 20:31:18 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -50,13 +50,13 @@ static bool tupledesc_mismatch(TupleDesc tupdesc1, TupleDesc tupdesc2);
|
||||
static TupleTableSlot *
|
||||
FunctionNext(FunctionScan *node)
|
||||
{
|
||||
TupleTableSlot *slot;
|
||||
EState *estate;
|
||||
ScanDirection direction;
|
||||
Tuplestorestate *tuplestorestate;
|
||||
FunctionScanState *scanstate;
|
||||
bool should_free;
|
||||
HeapTuple heapTuple;
|
||||
TupleTableSlot *slot;
|
||||
EState *estate;
|
||||
ScanDirection direction;
|
||||
Tuplestorestate *tuplestorestate;
|
||||
FunctionScanState *scanstate;
|
||||
bool should_free;
|
||||
HeapTuple heapTuple;
|
||||
|
||||
/*
|
||||
* get information from the estate and scan state
|
||||
@ -69,12 +69,13 @@ FunctionNext(FunctionScan *node)
|
||||
|
||||
/*
|
||||
* If first time through, read all tuples from function and put them
|
||||
* in a tuplestore. Subsequent calls just fetch tuples from tuplestore.
|
||||
* in a tuplestore. Subsequent calls just fetch tuples from
|
||||
* tuplestore.
|
||||
*/
|
||||
if (tuplestorestate == NULL)
|
||||
{
|
||||
ExprContext *econtext = scanstate->csstate.cstate.cs_ExprContext;
|
||||
TupleDesc funcTupdesc;
|
||||
ExprContext *econtext = scanstate->csstate.cstate.cs_ExprContext;
|
||||
TupleDesc funcTupdesc;
|
||||
|
||||
scanstate->tuplestorestate = tuplestorestate =
|
||||
ExecMakeTableFunctionResult((Expr *) scanstate->funcexpr,
|
||||
@ -83,9 +84,9 @@ FunctionNext(FunctionScan *node)
|
||||
&funcTupdesc);
|
||||
|
||||
/*
|
||||
* If function provided a tupdesc, cross-check it. We only really
|
||||
* need to do this for functions returning RECORD, but might as well
|
||||
* do it always.
|
||||
* If function provided a tupdesc, cross-check it. We only really
|
||||
* need to do this for functions returning RECORD, but might as
|
||||
* well do it always.
|
||||
*/
|
||||
if (funcTupdesc &&
|
||||
tupledesc_mismatch(scanstate->tupdesc, funcTupdesc))
|
||||
@ -98,7 +99,7 @@ FunctionNext(FunctionScan *node)
|
||||
slot = scanstate->csstate.css_ScanTupleSlot;
|
||||
if (tuplestorestate)
|
||||
heapTuple = tuplestore_getheaptuple(tuplestorestate,
|
||||
ScanDirectionIsForward(direction),
|
||||
ScanDirectionIsForward(direction),
|
||||
&should_free);
|
||||
else
|
||||
{
|
||||
@ -135,11 +136,11 @@ ExecFunctionScan(FunctionScan *node)
|
||||
bool
|
||||
ExecInitFunctionScan(FunctionScan *node, EState *estate, Plan *parent)
|
||||
{
|
||||
FunctionScanState *scanstate;
|
||||
RangeTblEntry *rte;
|
||||
Oid funcrettype;
|
||||
char functyptype;
|
||||
TupleDesc tupdesc = NULL;
|
||||
FunctionScanState *scanstate;
|
||||
RangeTblEntry *rte;
|
||||
Oid funcrettype;
|
||||
char functyptype;
|
||||
TupleDesc tupdesc = NULL;
|
||||
|
||||
/*
|
||||
* FunctionScan should not have any children.
|
||||
@ -266,8 +267,8 @@ ExecCountSlotsFunctionScan(FunctionScan *node)
|
||||
void
|
||||
ExecEndFunctionScan(FunctionScan *node)
|
||||
{
|
||||
FunctionScanState *scanstate;
|
||||
EState *estate;
|
||||
FunctionScanState *scanstate;
|
||||
EState *estate;
|
||||
|
||||
/*
|
||||
* get information from node
|
||||
@ -308,7 +309,7 @@ ExecEndFunctionScan(FunctionScan *node)
|
||||
void
|
||||
ExecFunctionMarkPos(FunctionScan *node)
|
||||
{
|
||||
FunctionScanState *scanstate;
|
||||
FunctionScanState *scanstate;
|
||||
|
||||
scanstate = (FunctionScanState *) node->scan.scanstate;
|
||||
|
||||
@ -330,7 +331,7 @@ ExecFunctionMarkPos(FunctionScan *node)
|
||||
void
|
||||
ExecFunctionRestrPos(FunctionScan *node)
|
||||
{
|
||||
FunctionScanState *scanstate;
|
||||
FunctionScanState *scanstate;
|
||||
|
||||
scanstate = (FunctionScanState *) node->scan.scanstate;
|
||||
|
||||
@ -352,7 +353,7 @@ ExecFunctionRestrPos(FunctionScan *node)
|
||||
void
|
||||
ExecFunctionReScan(FunctionScan *node, ExprContext *exprCtxt, Plan *parent)
|
||||
{
|
||||
FunctionScanState *scanstate;
|
||||
FunctionScanState *scanstate;
|
||||
|
||||
/*
|
||||
* get information from node
|
||||
|
@ -7,7 +7,7 @@
|
||||
* Portions Copyright (c) 1994, Regents of the University of California
|
||||
*
|
||||
*
|
||||
* $Id: nodeHash.c,v 1.65 2002/09/02 02:47:02 momjian Exp $
|
||||
* $Id: nodeHash.c,v 1.66 2002/09/04 20:31:18 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -31,7 +31,7 @@
|
||||
#include "utils/lsyscache.h"
|
||||
|
||||
|
||||
static uint32 hashFunc(Datum key, int typLen, bool byVal);
|
||||
static uint32 hashFunc(Datum key, int typLen, bool byVal);
|
||||
|
||||
/* ----------------------------------------------------------------
|
||||
* ExecHash
|
||||
@ -639,11 +639,11 @@ hashFunc(Datum key, int typLen, bool byVal)
|
||||
{
|
||||
/*
|
||||
* If it's a by-value data type, just hash the whole Datum value.
|
||||
* This assumes that datatypes narrower than Datum are consistently
|
||||
* padded (either zero-extended or sign-extended, but not random
|
||||
* bits) to fill Datum; see the XXXGetDatum macros in postgres.h.
|
||||
* NOTE: it would not work to do hash_any(&key, len) since this
|
||||
* would get the wrong bytes on a big-endian machine.
|
||||
* This assumes that datatypes narrower than Datum are
|
||||
* consistently padded (either zero-extended or sign-extended, but
|
||||
* not random bits) to fill Datum; see the XXXGetDatum macros in
|
||||
* postgres.h. NOTE: it would not work to do hash_any(&key, len)
|
||||
* since this would get the wrong bytes on a big-endian machine.
|
||||
*/
|
||||
k = (unsigned char *) &key;
|
||||
typLen = sizeof(Datum);
|
||||
@ -658,14 +658,14 @@ hashFunc(Datum key, int typLen, bool byVal)
|
||||
else if (typLen == -1)
|
||||
{
|
||||
/*
|
||||
* It's a varlena type, so 'key' points to a
|
||||
* "struct varlena". NOTE: VARSIZE returns the
|
||||
* "real" data length plus the sizeof the "vl_len" attribute of
|
||||
* varlena (the length information). 'key' points to the beginning
|
||||
* of the varlena struct, so we have to use "VARDATA" to find the
|
||||
* beginning of the "real" data. Also, we have to be careful to
|
||||
* detoast the datum if it's toasted. (We don't worry about
|
||||
* freeing the detoasted copy; that happens for free when the
|
||||
* It's a varlena type, so 'key' points to a "struct varlena".
|
||||
* NOTE: VARSIZE returns the "real" data length plus the
|
||||
* sizeof the "vl_len" attribute of varlena (the length
|
||||
* information). 'key' points to the beginning of the varlena
|
||||
* struct, so we have to use "VARDATA" to find the beginning
|
||||
* of the "real" data. Also, we have to be careful to detoast
|
||||
* the datum if it's toasted. (We don't worry about freeing
|
||||
* the detoasted copy; that happens for free when the
|
||||
* per-tuple memory context is reset in ExecHashGetBucket.)
|
||||
*/
|
||||
struct varlena *vkey = PG_DETOAST_DATUM(key);
|
||||
|
@ -8,7 +8,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/executor/nodeIndexscan.c,v 1.70 2002/06/23 21:29:32 momjian Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/executor/nodeIndexscan.c,v 1.71 2002/09/04 20:31:18 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -165,22 +165,21 @@ IndexNext(IndexScan *node)
|
||||
while ((tuple = index_getnext(scandesc, direction)) != NULL)
|
||||
{
|
||||
/*
|
||||
* store the scanned tuple in the scan tuple slot of the
|
||||
* scan state. Note: we pass 'false' because tuples
|
||||
* returned by amgetnext are pointers onto disk pages and
|
||||
* must not be pfree()'d.
|
||||
* store the scanned tuple in the scan tuple slot of the scan
|
||||
* state. Note: we pass 'false' because tuples returned by
|
||||
* amgetnext are pointers onto disk pages and must not be
|
||||
* pfree()'d.
|
||||
*/
|
||||
ExecStoreTuple(tuple, /* tuple to store */
|
||||
ExecStoreTuple(tuple, /* tuple to store */
|
||||
slot, /* slot to store in */
|
||||
scandesc->xs_cbuf, /* buffer containing tuple */
|
||||
false); /* don't pfree */
|
||||
scandesc->xs_cbuf, /* buffer containing tuple */
|
||||
false); /* don't pfree */
|
||||
|
||||
/*
|
||||
* We must check to see if the current tuple was already
|
||||
* matched by an earlier index, so we don't double-report
|
||||
* it. We do this by passing the tuple through ExecQual
|
||||
* and checking for failure with all previous
|
||||
* qualifications.
|
||||
* matched by an earlier index, so we don't double-report it.
|
||||
* We do this by passing the tuple through ExecQual and
|
||||
* checking for failure with all previous qualifications.
|
||||
*/
|
||||
if (indexstate->iss_IndexPtr > 0)
|
||||
{
|
||||
@ -485,8 +484,9 @@ ExecEndIndexScan(IndexScan *node)
|
||||
* close the heap relation.
|
||||
*
|
||||
* Currently, we do not release the AccessShareLock acquired by
|
||||
* ExecInitIndexScan. This lock should be held till end of transaction.
|
||||
* (There is a faction that considers this too much locking, however.)
|
||||
* ExecInitIndexScan. This lock should be held till end of
|
||||
* transaction. (There is a faction that considers this too much
|
||||
* locking, however.)
|
||||
*/
|
||||
heap_close(relation, NoLock);
|
||||
|
||||
@ -1009,7 +1009,7 @@ ExecInitIndexScan(IndexScan *node, EState *estate, Plan *parent)
|
||||
elog(ERROR, "indexes of the relation %u was inactivated", reloid);
|
||||
|
||||
scanstate->css_currentRelation = currentRelation;
|
||||
scanstate->css_currentScanDesc = NULL; /* no heap scan here */
|
||||
scanstate->css_currentScanDesc = NULL; /* no heap scan here */
|
||||
|
||||
/*
|
||||
* get the scan type from the relation descriptor.
|
||||
|
@ -8,7 +8,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/executor/nodeMergejoin.c,v 1.50 2002/06/20 20:29:28 momjian Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/executor/nodeMergejoin.c,v 1.51 2002/09/04 20:31:18 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -93,7 +93,7 @@ static bool MergeCompare(List *eqQual, List *compareQual, ExprContext *econtext)
|
||||
* This takes the mergeclause which is a qualification of the
|
||||
* form ((= expr expr) (= expr expr) ...) and forms new lists
|
||||
* of the forms ((< expr expr) (< expr expr) ...) and
|
||||
* ((> expr expr) (> expr expr) ...). These lists will be used
|
||||
* ((> expr expr) (> expr expr) ...). These lists will be used
|
||||
* by ExecMergeJoin() to determine if we should skip tuples.
|
||||
* (We expect there to be suitable operators because the "=" operators
|
||||
* were marked mergejoinable; however, there might be a different
|
||||
|
@ -8,7 +8,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/executor/nodeSeqscan.c,v 1.36 2002/06/20 20:29:28 momjian Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/executor/nodeSeqscan.c,v 1.37 2002/09/04 20:31:18 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -284,8 +284,9 @@ ExecEndSeqScan(SeqScan *node)
|
||||
* close the heap relation.
|
||||
*
|
||||
* Currently, we do not release the AccessShareLock acquired by
|
||||
* InitScanRelation. This lock should be held till end of transaction.
|
||||
* (There is a faction that considers this too much locking, however.)
|
||||
* InitScanRelation. This lock should be held till end of
|
||||
* transaction. (There is a faction that considers this too much
|
||||
* locking, however.)
|
||||
*/
|
||||
heap_close(relation, NoLock);
|
||||
|
||||
|
@ -8,7 +8,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/executor/nodeTidscan.c,v 1.25 2002/06/20 20:29:28 momjian Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/executor/nodeTidscan.c,v 1.26 2002/09/04 20:31:18 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -109,8 +109,8 @@ TidNext(TidScan *node)
|
||||
return slot; /* return empty slot */
|
||||
|
||||
/*
|
||||
* XXX shouldn't we check here to make sure tuple matches TID list?
|
||||
* In runtime-key case this is not certain, is it?
|
||||
* XXX shouldn't we check here to make sure tuple matches TID
|
||||
* list? In runtime-key case this is not certain, is it?
|
||||
*/
|
||||
|
||||
ExecStoreTuple(estate->es_evTuple[node->scan.scanrelid - 1],
|
||||
@ -468,7 +468,7 @@ ExecInitTidScan(TidScan *node, EState *estate, Plan *parent)
|
||||
currentRelation = heap_open(reloid, AccessShareLock);
|
||||
|
||||
scanstate->css_currentRelation = currentRelation;
|
||||
scanstate->css_currentScanDesc = NULL; /* no heap scan here */
|
||||
scanstate->css_currentScanDesc = NULL; /* no heap scan here */
|
||||
|
||||
/*
|
||||
* get the scan type from the relation descriptor.
|
||||
|
@ -8,7 +8,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/executor/spi.c,v 1.73 2002/09/02 01:05:05 tgl Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/executor/spi.c,v 1.74 2002/09/04 20:31:18 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -433,6 +433,7 @@ SPI_modifytuple(Relation rel, HeapTuple tuple, int natts, int *attnum,
|
||||
if (i == natts) /* no errors in *attnum */
|
||||
{
|
||||
mtuple = heap_formtuple(rel->rd_att, v, n);
|
||||
|
||||
/*
|
||||
* copy the identification info of the old tuple: t_ctid, t_self,
|
||||
* and OID (if any)
|
||||
@ -1098,7 +1099,7 @@ _SPI_execute_plan(_SPI_plan *plan, Datum *Values, char *Nulls, int tcount)
|
||||
ParamListInfo paramLI;
|
||||
|
||||
paramLI = (ParamListInfo) palloc((nargs + 1) *
|
||||
sizeof(ParamListInfoData));
|
||||
sizeof(ParamListInfoData));
|
||||
MemSet(paramLI, 0, (nargs + 1) * sizeof(ParamListInfoData));
|
||||
|
||||
state->es_param_list_info = paramLI;
|
||||
@ -1266,9 +1267,9 @@ _SPI_cursor_operation(Portal portal, bool forward, int count,
|
||||
ExecutorRun(querydesc, estate, direction, (long) count);
|
||||
|
||||
if (estate->es_processed > 0)
|
||||
portal->atStart = false; /* OK to back up now */
|
||||
portal->atStart = false; /* OK to back up now */
|
||||
if (count <= 0 || (int) estate->es_processed < count)
|
||||
portal->atEnd = true; /* we retrieved 'em all */
|
||||
portal->atEnd = true; /* we retrieved 'em all */
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -1280,9 +1281,9 @@ _SPI_cursor_operation(Portal portal, bool forward, int count,
|
||||
ExecutorRun(querydesc, estate, direction, (long) count);
|
||||
|
||||
if (estate->es_processed > 0)
|
||||
portal->atEnd = false; /* OK to go forward now */
|
||||
portal->atEnd = false; /* OK to go forward now */
|
||||
if (count <= 0 || (int) estate->es_processed < count)
|
||||
portal->atStart = true; /* we retrieved 'em all */
|
||||
portal->atStart = true; /* we retrieved 'em all */
|
||||
}
|
||||
|
||||
_SPI_current->processed = estate->es_processed;
|
||||
|
Reference in New Issue
Block a user