mirror of
https://github.com/postgres/postgres.git
synced 2025-06-30 21:42:05 +03:00
pgindent run for 8.2.
This commit is contained in:
@ -26,7 +26,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $PostgreSQL: pgsql/src/backend/executor/execMain.c,v 1.279 2006/08/12 20:05:55 tgl Exp $
|
||||
* $PostgreSQL: pgsql/src/backend/executor/execMain.c,v 1.280 2006/10/04 00:29:52 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -76,17 +76,17 @@ static TupleTableSlot *ExecutePlan(EState *estate, PlanState *planstate,
|
||||
ScanDirection direction,
|
||||
DestReceiver *dest);
|
||||
static void ExecSelect(TupleTableSlot *slot,
|
||||
DestReceiver *dest, EState *estate);
|
||||
DestReceiver *dest, EState *estate);
|
||||
static void ExecInsert(TupleTableSlot *slot, ItemPointer tupleid,
|
||||
TupleTableSlot *planSlot,
|
||||
DestReceiver *dest, EState *estate);
|
||||
TupleTableSlot *planSlot,
|
||||
DestReceiver *dest, EState *estate);
|
||||
static void ExecDelete(ItemPointer tupleid,
|
||||
TupleTableSlot *planSlot,
|
||||
DestReceiver *dest, EState *estate);
|
||||
TupleTableSlot *planSlot,
|
||||
DestReceiver *dest, EState *estate);
|
||||
static void ExecUpdate(TupleTableSlot *slot, ItemPointer tupleid,
|
||||
TupleTableSlot *planSlot,
|
||||
DestReceiver *dest, EState *estate);
|
||||
static void ExecProcessReturning(ProjectionInfo *projectReturning,
|
||||
TupleTableSlot *planSlot,
|
||||
DestReceiver *dest, EState *estate);
|
||||
static void ExecProcessReturning(ProjectionInfo *projectReturning,
|
||||
TupleTableSlot *tupleSlot,
|
||||
TupleTableSlot *planSlot,
|
||||
DestReceiver *dest);
|
||||
@ -758,32 +758,33 @@ InitPlan(QueryDesc *queryDesc, int eflags)
|
||||
econtext = CreateExprContext(estate);
|
||||
|
||||
/*
|
||||
* Build a projection for each result rel. Note that any SubPlans
|
||||
* in the RETURNING lists get attached to the topmost plan node.
|
||||
* Build a projection for each result rel. Note that any SubPlans in
|
||||
* the RETURNING lists get attached to the topmost plan node.
|
||||
*/
|
||||
Assert(list_length(parseTree->returningLists) == estate->es_num_result_relations);
|
||||
resultRelInfo = estate->es_result_relations;
|
||||
foreach(l, parseTree->returningLists)
|
||||
{
|
||||
List *rlist = (List *) lfirst(l);
|
||||
List *rliststate;
|
||||
List *rlist = (List *) lfirst(l);
|
||||
List *rliststate;
|
||||
|
||||
rliststate = (List *) ExecInitExpr((Expr *) rlist, planstate);
|
||||
resultRelInfo->ri_projectReturning =
|
||||
ExecBuildProjectionInfo(rliststate, econtext, slot);
|
||||
resultRelInfo++;
|
||||
}
|
||||
|
||||
/*
|
||||
* Because we already ran ExecInitNode() for the top plan node,
|
||||
* any subplans we just attached to it won't have been initialized;
|
||||
* so we have to do it here. (Ugly, but the alternatives seem worse.)
|
||||
* Because we already ran ExecInitNode() for the top plan node, any
|
||||
* subplans we just attached to it won't have been initialized; so we
|
||||
* have to do it here. (Ugly, but the alternatives seem worse.)
|
||||
*/
|
||||
foreach(l, planstate->subPlan)
|
||||
{
|
||||
SubPlanState *sstate = (SubPlanState *) lfirst(l);
|
||||
|
||||
Assert(IsA(sstate, SubPlanState));
|
||||
if (sstate->planstate == NULL) /* already inited? */
|
||||
if (sstate->planstate == NULL) /* already inited? */
|
||||
ExecInitSubPlan(sstate, estate, eflags);
|
||||
}
|
||||
}
|
||||
@ -1191,7 +1192,7 @@ lnext: ;
|
||||
erm->rti,
|
||||
&update_ctid,
|
||||
update_xmax,
|
||||
estate->es_snapshot->curcid);
|
||||
estate->es_snapshot->curcid);
|
||||
if (!TupIsNull(newSlot))
|
||||
{
|
||||
slot = planSlot = newSlot;
|
||||
@ -1215,9 +1216,9 @@ lnext: ;
|
||||
}
|
||||
|
||||
/*
|
||||
* Create a new "clean" tuple with all junk attributes removed.
|
||||
* We don't need to do this for DELETE, however (there will
|
||||
* in fact be no non-junk attributes in a DELETE!)
|
||||
* Create a new "clean" tuple with all junk attributes removed. We
|
||||
* don't need to do this for DELETE, however (there will in fact
|
||||
* be no non-junk attributes in a DELETE!)
|
||||
*/
|
||||
if (operation != CMD_DELETE)
|
||||
slot = ExecFilterJunk(junkfilter, slot);
|
||||
@ -1515,8 +1516,8 @@ ldelete:;
|
||||
if (resultRelInfo->ri_projectReturning)
|
||||
{
|
||||
/*
|
||||
* We have to put the target tuple into a slot, which means
|
||||
* first we gotta fetch it. We can use the trigger tuple slot.
|
||||
* We have to put the target tuple into a slot, which means first we
|
||||
* gotta fetch it. We can use the trigger tuple slot.
|
||||
*/
|
||||
TupleTableSlot *slot = estate->es_trig_tuple_slot;
|
||||
HeapTupleData deltuple;
|
||||
@ -1815,13 +1816,13 @@ ExecConstraints(ResultRelInfo *resultRelInfo,
|
||||
* dest: where to send the output
|
||||
*/
|
||||
static void
|
||||
ExecProcessReturning(ProjectionInfo *projectReturning,
|
||||
ExecProcessReturning(ProjectionInfo *projectReturning,
|
||||
TupleTableSlot *tupleSlot,
|
||||
TupleTableSlot *planSlot,
|
||||
DestReceiver *dest)
|
||||
{
|
||||
ExprContext *econtext = projectReturning->pi_exprContext;
|
||||
TupleTableSlot *retSlot;
|
||||
ExprContext *econtext = projectReturning->pi_exprContext;
|
||||
TupleTableSlot *retSlot;
|
||||
|
||||
/*
|
||||
* Reset per-tuple memory context to free any expression evaluation
|
||||
@ -1942,12 +1943,12 @@ EvalPlanQual(EState *estate, Index rti,
|
||||
* If tuple was inserted by our own transaction, we have to check
|
||||
* cmin against curCid: cmin >= curCid means our command cannot
|
||||
* see the tuple, so we should ignore it. Without this we are
|
||||
* open to the "Halloween problem" of indefinitely re-updating
|
||||
* the same tuple. (We need not check cmax because
|
||||
* HeapTupleSatisfiesDirty will consider a tuple deleted by
|
||||
* our transaction dead, regardless of cmax.) We just checked
|
||||
* that priorXmax == xmin, so we can test that variable instead
|
||||
* of doing HeapTupleHeaderGetXmin again.
|
||||
* open to the "Halloween problem" of indefinitely re-updating the
|
||||
* same tuple. (We need not check cmax because
|
||||
* HeapTupleSatisfiesDirty will consider a tuple deleted by our
|
||||
* transaction dead, regardless of cmax.) We just checked that
|
||||
* priorXmax == xmin, so we can test that variable instead of
|
||||
* doing HeapTupleHeaderGetXmin again.
|
||||
*/
|
||||
if (TransactionIdIsCurrentTransactionId(priorXmax) &&
|
||||
HeapTupleHeaderGetCmin(tuple.t_data) >= curCid)
|
||||
@ -2379,7 +2380,8 @@ OpenIntoRel(QueryDesc *queryDesc)
|
||||
(errcode(ERRCODE_UNDEFINED_OBJECT),
|
||||
errmsg("tablespace \"%s\" does not exist",
|
||||
parseTree->intoTableSpaceName)));
|
||||
} else
|
||||
}
|
||||
else
|
||||
{
|
||||
tablespaceId = GetDefaultTablespace();
|
||||
/* note InvalidOid is OK in this case */
|
||||
@ -2426,15 +2428,15 @@ OpenIntoRel(QueryDesc *queryDesc)
|
||||
FreeTupleDesc(tupdesc);
|
||||
|
||||
/*
|
||||
* Advance command counter so that the newly-created relation's
|
||||
* catalog tuples will be visible to heap_open.
|
||||
* Advance command counter so that the newly-created relation's catalog
|
||||
* tuples will be visible to heap_open.
|
||||
*/
|
||||
CommandCounterIncrement();
|
||||
|
||||
/*
|
||||
* If necessary, create a TOAST table for the INTO relation. Note that
|
||||
* AlterTableCreateToastTable ends with CommandCounterIncrement(), so
|
||||
* that the TOAST table will be visible for insertion.
|
||||
* AlterTableCreateToastTable ends with CommandCounterIncrement(), so that
|
||||
* the TOAST table will be visible for insertion.
|
||||
*/
|
||||
AlterTableCreateToastTable(intoRelationId);
|
||||
|
||||
@ -2449,11 +2451,11 @@ OpenIntoRel(QueryDesc *queryDesc)
|
||||
/*
|
||||
* We can skip WAL-logging the insertions, unless PITR is in use.
|
||||
*
|
||||
* Note that for a non-temp INTO table, this is safe only because we
|
||||
* know that the catalog changes above will have been WAL-logged, and
|
||||
* so RecordTransactionCommit will think it needs to WAL-log the
|
||||
* eventual transaction commit. Else the commit might be lost, even
|
||||
* though all the data is safely fsync'd ...
|
||||
* Note that for a non-temp INTO table, this is safe only because we know
|
||||
* that the catalog changes above will have been WAL-logged, and so
|
||||
* RecordTransactionCommit will think it needs to WAL-log the eventual
|
||||
* transaction commit. Else the commit might be lost, even though all the
|
||||
* data is safely fsync'd ...
|
||||
*/
|
||||
estate->es_into_relation_use_wal = XLogArchivingActive();
|
||||
estate->es_into_relation_descriptor = intoRelationDesc;
|
||||
|
@ -12,7 +12,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $PostgreSQL: pgsql/src/backend/executor/execProcnode.c,v 1.58 2006/08/02 01:59:45 joe Exp $
|
||||
* $PostgreSQL: pgsql/src/backend/executor/execProcnode.c,v 1.59 2006/10/04 00:29:52 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -197,7 +197,7 @@ ExecInitNode(Plan *node, EState *estate, int eflags)
|
||||
|
||||
case T_ValuesScan:
|
||||
result = (PlanState *) ExecInitValuesScan((ValuesScan *) node,
|
||||
estate, eflags);
|
||||
estate, eflags);
|
||||
break;
|
||||
|
||||
/*
|
||||
|
@ -8,7 +8,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $PostgreSQL: pgsql/src/backend/executor/execQual.c,v 1.194 2006/09/28 20:51:41 tgl Exp $
|
||||
* $PostgreSQL: pgsql/src/backend/executor/execQual.c,v 1.195 2006/10/04 00:29:52 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -108,8 +108,8 @@ static Datum ExecEvalRow(RowExprState *rstate,
|
||||
ExprContext *econtext,
|
||||
bool *isNull, ExprDoneCond *isDone);
|
||||
static Datum ExecEvalRowCompare(RowCompareExprState *rstate,
|
||||
ExprContext *econtext,
|
||||
bool *isNull, ExprDoneCond *isDone);
|
||||
ExprContext *econtext,
|
||||
bool *isNull, ExprDoneCond *isDone);
|
||||
static Datum ExecEvalCoalesce(CoalesceExprState *coalesceExpr,
|
||||
ExprContext *econtext,
|
||||
bool *isNull, ExprDoneCond *isDone);
|
||||
@ -882,7 +882,7 @@ get_cached_rowtype(Oid type_id, int32 typmod,
|
||||
static void
|
||||
ShutdownTupleDescRef(Datum arg)
|
||||
{
|
||||
TupleDesc *cache_field = (TupleDesc *) DatumGetPointer(arg);
|
||||
TupleDesc *cache_field = (TupleDesc *) DatumGetPointer(arg);
|
||||
|
||||
if (*cache_field)
|
||||
ReleaseTupleDesc(*cache_field);
|
||||
@ -2015,8 +2015,8 @@ ExecEvalConvertRowtype(ConvertRowtypeExprState *cstate,
|
||||
/* if first time through, initialize */
|
||||
if (cstate->attrMap == NULL)
|
||||
{
|
||||
MemoryContext old_cxt;
|
||||
int n;
|
||||
MemoryContext old_cxt;
|
||||
int n;
|
||||
|
||||
/* allocate state in long-lived memory context */
|
||||
old_cxt = MemoryContextSwitchTo(econtext->ecxt_per_query_memory);
|
||||
@ -2502,7 +2502,7 @@ ExecEvalRowCompare(RowCompareExprState *rstate,
|
||||
|
||||
switch (rctype)
|
||||
{
|
||||
/* EQ and NE cases aren't allowed here */
|
||||
/* EQ and NE cases aren't allowed here */
|
||||
case ROWCOMPARE_LT:
|
||||
result = (cmpresult < 0);
|
||||
break;
|
||||
@ -2722,7 +2722,7 @@ ExecEvalNullTest(NullTestState *nstate,
|
||||
for (att = 1; att <= tupDesc->natts; att++)
|
||||
{
|
||||
/* ignore dropped columns */
|
||||
if (tupDesc->attrs[att-1]->attisdropped)
|
||||
if (tupDesc->attrs[att - 1]->attisdropped)
|
||||
continue;
|
||||
if (heap_attisnull(&tmptup, att))
|
||||
{
|
||||
@ -2764,7 +2764,7 @@ ExecEvalNullTest(NullTestState *nstate,
|
||||
default:
|
||||
elog(ERROR, "unrecognized nulltesttype: %d",
|
||||
(int) ntest->nulltesttype);
|
||||
return (Datum) 0; /* keep compiler quiet */
|
||||
return (Datum) 0; /* keep compiler quiet */
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -3564,16 +3564,17 @@ ExecInitExpr(Expr *node, PlanState *parent)
|
||||
i = 0;
|
||||
forboth(l, rcexpr->opnos, l2, rcexpr->opclasses)
|
||||
{
|
||||
Oid opno = lfirst_oid(l);
|
||||
Oid opclass = lfirst_oid(l2);
|
||||
int strategy;
|
||||
Oid subtype;
|
||||
bool recheck;
|
||||
Oid proc;
|
||||
Oid opno = lfirst_oid(l);
|
||||
Oid opclass = lfirst_oid(l2);
|
||||
int strategy;
|
||||
Oid subtype;
|
||||
bool recheck;
|
||||
Oid proc;
|
||||
|
||||
get_op_opclass_properties(opno, opclass,
|
||||
&strategy, &subtype, &recheck);
|
||||
proc = get_opclass_proc(opclass, subtype, BTORDER_PROC);
|
||||
|
||||
/*
|
||||
* If we enforced permissions checks on index support
|
||||
* functions, we'd need to make a check here. But the
|
||||
@ -3632,11 +3633,12 @@ ExecInitExpr(Expr *node, PlanState *parent)
|
||||
(errcode(ERRCODE_UNDEFINED_FUNCTION),
|
||||
errmsg("could not identify a comparison function for type %s",
|
||||
format_type_be(minmaxexpr->minmaxtype))));
|
||||
|
||||
/*
|
||||
* If we enforced permissions checks on index support
|
||||
* functions, we'd need to make a check here. But the
|
||||
* index support machinery doesn't do that, and neither
|
||||
* does this code.
|
||||
* functions, we'd need to make a check here. But the index
|
||||
* support machinery doesn't do that, and neither does this
|
||||
* code.
|
||||
*/
|
||||
fmgr_info(typentry->cmp_proc, &(mstate->cfunc));
|
||||
state = (ExprState *) mstate;
|
||||
|
@ -15,7 +15,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $PostgreSQL: pgsql/src/backend/executor/execTuples.c,v 1.97 2006/07/14 14:52:19 momjian Exp $
|
||||
* $PostgreSQL: pgsql/src/backend/executor/execTuples.c,v 1.98 2006/10/04 00:29:52 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -722,7 +722,7 @@ ExecFetchSlotTuple(TupleTableSlot *slot)
|
||||
* Fetch the slot's minimal physical tuple.
|
||||
*
|
||||
* If the slot contains a virtual tuple, we convert it to minimal
|
||||
* physical form. The slot retains ownership of the physical tuple.
|
||||
* physical form. The slot retains ownership of the physical tuple.
|
||||
* Likewise, if it contains a regular tuple we convert to minimal form.
|
||||
*
|
||||
* As above, the result must be treated as read-only.
|
||||
@ -792,8 +792,8 @@ ExecMaterializeSlot(TupleTableSlot *slot)
|
||||
Assert(!slot->tts_isempty);
|
||||
|
||||
/*
|
||||
* If we have a regular physical tuple, and it's locally palloc'd,
|
||||
* we have nothing to do.
|
||||
* If we have a regular physical tuple, and it's locally palloc'd, we have
|
||||
* nothing to do.
|
||||
*/
|
||||
if (slot->tts_tuple && slot->tts_shouldFree && slot->tts_mintuple == NULL)
|
||||
return slot->tts_tuple;
|
||||
|
@ -8,7 +8,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $PostgreSQL: pgsql/src/backend/executor/execUtils.c,v 1.139 2006/08/04 21:33:36 tgl Exp $
|
||||
* $PostgreSQL: pgsql/src/backend/executor/execUtils.c,v 1.140 2006/10/04 00:29:52 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -898,8 +898,8 @@ ExecOpenIndices(ResultRelInfo *resultRelInfo)
|
||||
resultRelInfo->ri_IndexRelationInfo = indexInfoArray;
|
||||
|
||||
/*
|
||||
* For each index, open the index relation and save pg_index info.
|
||||
* We acquire RowExclusiveLock, signifying we will update the index.
|
||||
* For each index, open the index relation and save pg_index info. We
|
||||
* acquire RowExclusiveLock, signifying we will update the index.
|
||||
*/
|
||||
i = 0;
|
||||
foreach(l, indexoidlist)
|
||||
|
@ -8,7 +8,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $PostgreSQL: pgsql/src/backend/executor/functions.c,v 1.106 2006/09/06 20:40:47 tgl Exp $
|
||||
* $PostgreSQL: pgsql/src/backend/executor/functions.c,v 1.107 2006/10/04 00:29:52 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -433,7 +433,7 @@ postquel_sub_params(SQLFunctionCachePtr fcache,
|
||||
|
||||
/* sizeof(ParamListInfoData) includes the first array element */
|
||||
paramLI = (ParamListInfo) palloc(sizeof(ParamListInfoData) +
|
||||
(nargs - 1) * sizeof(ParamExternData));
|
||||
(nargs - 1) *sizeof(ParamExternData));
|
||||
paramLI->numParams = nargs;
|
||||
|
||||
for (i = 0; i < nargs; i++)
|
||||
@ -897,8 +897,8 @@ check_sql_fn_retval(Oid func_id, Oid rettype, List *queryTreeList,
|
||||
parse = (Query *) lfirst(list_tail(queryTreeList));
|
||||
|
||||
/*
|
||||
* Note: eventually replace this with QueryReturnsTuples? We'd need
|
||||
* a more general method of determining the output type, though.
|
||||
* Note: eventually replace this with QueryReturnsTuples? We'd need a
|
||||
* more general method of determining the output type, though.
|
||||
*/
|
||||
isSelect = (parse->commandType == CMD_SELECT && parse->into == NULL);
|
||||
|
||||
|
@ -61,7 +61,7 @@
|
||||
* Portions Copyright (c) 1994, Regents of the University of California
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $PostgreSQL: pgsql/src/backend/executor/nodeAgg.c,v 1.145 2006/07/27 19:52:05 tgl Exp $
|
||||
* $PostgreSQL: pgsql/src/backend/executor/nodeAgg.c,v 1.146 2006/10/04 00:29:52 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -331,16 +331,16 @@ advance_transition_function(AggState *aggstate,
|
||||
AggStatePerGroup pergroupstate,
|
||||
FunctionCallInfoData *fcinfo)
|
||||
{
|
||||
int numArguments = peraggstate->numArguments;
|
||||
int numArguments = peraggstate->numArguments;
|
||||
MemoryContext oldContext;
|
||||
Datum newVal;
|
||||
int i;
|
||||
Datum newVal;
|
||||
int i;
|
||||
|
||||
if (peraggstate->transfn.fn_strict)
|
||||
{
|
||||
/*
|
||||
* For a strict transfn, nothing happens when there's a NULL input;
|
||||
* we just keep the prior transValue.
|
||||
* For a strict transfn, nothing happens when there's a NULL input; we
|
||||
* just keep the prior transValue.
|
||||
*/
|
||||
for (i = 1; i <= numArguments; i++)
|
||||
{
|
||||
@ -434,14 +434,14 @@ advance_aggregates(AggState *aggstate, AggStatePerGroup pergroup)
|
||||
|
||||
for (aggno = 0; aggno < aggstate->numaggs; aggno++)
|
||||
{
|
||||
AggStatePerAgg peraggstate = &aggstate->peragg[aggno];
|
||||
AggStatePerGroup pergroupstate = &pergroup[aggno];
|
||||
AggrefExprState *aggrefstate = peraggstate->aggrefstate;
|
||||
Aggref *aggref = peraggstate->aggref;
|
||||
AggStatePerAgg peraggstate = &aggstate->peragg[aggno];
|
||||
AggStatePerGroup pergroupstate = &pergroup[aggno];
|
||||
AggrefExprState *aggrefstate = peraggstate->aggrefstate;
|
||||
Aggref *aggref = peraggstate->aggref;
|
||||
FunctionCallInfoData fcinfo;
|
||||
int i;
|
||||
ListCell *arg;
|
||||
MemoryContext oldContext;
|
||||
int i;
|
||||
ListCell *arg;
|
||||
MemoryContext oldContext;
|
||||
|
||||
/* Switch memory context just once for all args */
|
||||
oldContext = MemoryContextSwitchTo(econtext->ecxt_per_tuple_memory);
|
||||
@ -495,8 +495,8 @@ process_sorted_aggregate(AggState *aggstate,
|
||||
bool haveOldVal = false;
|
||||
MemoryContext workcontext = aggstate->tmpcontext->ecxt_per_tuple_memory;
|
||||
MemoryContext oldContext;
|
||||
Datum *newVal;
|
||||
bool *isNull;
|
||||
Datum *newVal;
|
||||
bool *isNull;
|
||||
FunctionCallInfoData fcinfo;
|
||||
|
||||
tuplesort_performsort(peraggstate->sortstate);
|
||||
@ -624,7 +624,7 @@ static Bitmapset *
|
||||
find_unaggregated_cols(AggState *aggstate)
|
||||
{
|
||||
Agg *node = (Agg *) aggstate->ss.ps.plan;
|
||||
Bitmapset *colnos;
|
||||
Bitmapset *colnos;
|
||||
|
||||
colnos = NULL;
|
||||
(void) find_unaggregated_cols_walker((Node *) node->plan.targetlist,
|
||||
@ -686,20 +686,20 @@ build_hash_table(AggState *aggstate)
|
||||
tmpmem);
|
||||
|
||||
/*
|
||||
* Create a list of the tuple columns that actually need to be stored
|
||||
* in hashtable entries. The incoming tuples from the child plan node
|
||||
* will contain grouping columns, other columns referenced in our
|
||||
* targetlist and qual, columns used to compute the aggregate functions,
|
||||
* and perhaps just junk columns we don't use at all. Only columns of the
|
||||
* first two types need to be stored in the hashtable, and getting rid of
|
||||
* the others can make the table entries significantly smaller. To avoid
|
||||
* messing up Var numbering, we keep the same tuple descriptor for
|
||||
* hashtable entries as the incoming tuples have, but set unwanted columns
|
||||
* to NULL in the tuples that go into the table.
|
||||
* Create a list of the tuple columns that actually need to be stored in
|
||||
* hashtable entries. The incoming tuples from the child plan node will
|
||||
* contain grouping columns, other columns referenced in our targetlist
|
||||
* and qual, columns used to compute the aggregate functions, and perhaps
|
||||
* just junk columns we don't use at all. Only columns of the first two
|
||||
* types need to be stored in the hashtable, and getting rid of the others
|
||||
* can make the table entries significantly smaller. To avoid messing up
|
||||
* Var numbering, we keep the same tuple descriptor for hashtable entries
|
||||
* as the incoming tuples have, but set unwanted columns to NULL in the
|
||||
* tuples that go into the table.
|
||||
*
|
||||
* To eliminate duplicates, we build a bitmapset of the needed columns,
|
||||
* then convert it to an integer list (cheaper to scan at runtime).
|
||||
* The list is in decreasing order so that the first entry is the largest;
|
||||
* then convert it to an integer list (cheaper to scan at runtime). The
|
||||
* list is in decreasing order so that the first entry is the largest;
|
||||
* lookup_hash_entry depends on this to use slot_getsomeattrs correctly.
|
||||
*
|
||||
* Note: at present, searching the tlist/qual is not really necessary
|
||||
@ -767,7 +767,7 @@ lookup_hash_entry(AggState *aggstate, TupleTableSlot *inputslot)
|
||||
slot_getsomeattrs(inputslot, linitial_int(aggstate->hash_needed));
|
||||
foreach(l, aggstate->hash_needed)
|
||||
{
|
||||
int varNumber = lfirst_int(l) - 1;
|
||||
int varNumber = lfirst_int(l) - 1;
|
||||
|
||||
hashslot->tts_values[varNumber] = inputslot->tts_values[varNumber];
|
||||
hashslot->tts_isnull[varNumber] = inputslot->tts_isnull[varNumber];
|
||||
@ -968,10 +968,10 @@ agg_retrieve_direct(AggState *aggstate)
|
||||
|
||||
/*
|
||||
* Use the representative input tuple for any references to
|
||||
* non-aggregated input columns in the qual and tlist. (If we are
|
||||
* not grouping, and there are no input rows at all, we will come
|
||||
* here with an empty firstSlot ... but if not grouping, there can't
|
||||
* be any references to non-aggregated input columns, so no problem.)
|
||||
* non-aggregated input columns in the qual and tlist. (If we are not
|
||||
* grouping, and there are no input rows at all, we will come here
|
||||
* with an empty firstSlot ... but if not grouping, there can't be any
|
||||
* references to non-aggregated input columns, so no problem.)
|
||||
*/
|
||||
econtext->ecxt_scantuple = firstSlot;
|
||||
|
||||
@ -1226,8 +1226,8 @@ ExecInitAgg(Agg *node, EState *estate, int eflags)
|
||||
/*
|
||||
* initialize child nodes
|
||||
*
|
||||
* If we are doing a hashed aggregation then the child plan does not
|
||||
* need to handle REWIND efficiently; see ExecReScanAgg.
|
||||
* If we are doing a hashed aggregation then the child plan does not need
|
||||
* to handle REWIND efficiently; see ExecReScanAgg.
|
||||
*/
|
||||
if (node->aggstrategy == AGG_HASHED)
|
||||
eflags &= ~EXEC_FLAG_REWIND;
|
||||
@ -1321,7 +1321,7 @@ ExecInitAgg(Agg *node, EState *estate, int eflags)
|
||||
Aggref *aggref = (Aggref *) aggrefstate->xprstate.expr;
|
||||
AggStatePerAgg peraggstate;
|
||||
Oid inputTypes[FUNC_MAX_ARGS];
|
||||
int numArguments;
|
||||
int numArguments;
|
||||
HeapTuple aggTuple;
|
||||
Form_pg_aggregate aggform;
|
||||
Oid aggtranstype;
|
||||
@ -1332,7 +1332,7 @@ ExecInitAgg(Agg *node, EState *estate, int eflags)
|
||||
*finalfnexpr;
|
||||
Datum textInitVal;
|
||||
int i;
|
||||
ListCell *lc;
|
||||
ListCell *lc;
|
||||
|
||||
/* Planner should have assigned aggregate to correct level */
|
||||
Assert(aggref->agglevelsup == 0);
|
||||
@ -1364,9 +1364,9 @@ ExecInitAgg(Agg *node, EState *estate, int eflags)
|
||||
peraggstate->numArguments = numArguments;
|
||||
|
||||
/*
|
||||
* Get actual datatypes of the inputs. These could be different
|
||||
* from the agg's declared input types, when the agg accepts ANY,
|
||||
* ANYARRAY or ANYELEMENT.
|
||||
* Get actual datatypes of the inputs. These could be different from
|
||||
* the agg's declared input types, when the agg accepts ANY, ANYARRAY
|
||||
* or ANYELEMENT.
|
||||
*/
|
||||
i = 0;
|
||||
foreach(lc, aggref->args)
|
||||
@ -1481,8 +1481,8 @@ ExecInitAgg(Agg *node, EState *estate, int eflags)
|
||||
|
||||
/*
|
||||
* If the transfn is strict and the initval is NULL, make sure input
|
||||
* type and transtype are the same (or at least binary-compatible),
|
||||
* so that it's OK to use the first input value as the initial
|
||||
* type and transtype are the same (or at least binary-compatible), so
|
||||
* that it's OK to use the first input value as the initial
|
||||
* transValue. This should have been checked at agg definition time,
|
||||
* but just in case...
|
||||
*/
|
||||
@ -1504,9 +1504,9 @@ ExecInitAgg(Agg *node, EState *estate, int eflags)
|
||||
Assert(node->aggstrategy != AGG_HASHED);
|
||||
|
||||
/*
|
||||
* We don't currently implement DISTINCT aggs for aggs having
|
||||
* more than one argument. This isn't required for anything
|
||||
* in the SQL spec, but really it ought to be implemented for
|
||||
* We don't currently implement DISTINCT aggs for aggs having more
|
||||
* than one argument. This isn't required for anything in the SQL
|
||||
* spec, but really it ought to be implemented for
|
||||
* feature-completeness. FIXME someday.
|
||||
*/
|
||||
if (numArguments != 1)
|
||||
|
@ -8,7 +8,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $PostgreSQL: pgsql/src/backend/executor/nodeAppend.c,v 1.70 2006/07/14 14:52:19 momjian Exp $
|
||||
* $PostgreSQL: pgsql/src/backend/executor/nodeAppend.c,v 1.71 2006/10/04 00:29:52 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -345,9 +345,9 @@ ExecReScanAppend(AppendState *node, ExprContext *exprCtxt)
|
||||
|
||||
/*
|
||||
* If chgParam of subnode is not null then plan will be re-scanned by
|
||||
* first ExecProcNode. However, if caller is passing us an exprCtxt
|
||||
* then forcibly rescan all the subnodes now, so that we can pass
|
||||
* the exprCtxt down to the subnodes (needed for appendrel indexscan).
|
||||
* first ExecProcNode. However, if caller is passing us an exprCtxt
|
||||
* then forcibly rescan all the subnodes now, so that we can pass the
|
||||
* exprCtxt down to the subnodes (needed for appendrel indexscan).
|
||||
*/
|
||||
if (subnode->chgParam == NULL || exprCtxt != NULL)
|
||||
{
|
||||
|
@ -21,7 +21,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $PostgreSQL: pgsql/src/backend/executor/nodeBitmapHeapscan.c,v 1.13 2006/07/14 14:52:19 momjian Exp $
|
||||
* $PostgreSQL: pgsql/src/backend/executor/nodeBitmapHeapscan.c,v 1.14 2006/10/04 00:29:52 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -192,8 +192,8 @@ BitmapHeapNext(BitmapHeapScanState *node)
|
||||
pgstat_count_heap_fetch(&scan->rs_pgstat_info);
|
||||
|
||||
/*
|
||||
* Set up the result slot to point to this tuple. Note that the
|
||||
* slot acquires a pin on the buffer.
|
||||
* Set up the result slot to point to this tuple. Note that the slot
|
||||
* acquires a pin on the buffer.
|
||||
*/
|
||||
ExecStoreTuple(&scan->rs_ctup,
|
||||
slot,
|
||||
@ -201,8 +201,8 @@ BitmapHeapNext(BitmapHeapScanState *node)
|
||||
false);
|
||||
|
||||
/*
|
||||
* If we are using lossy info, we have to recheck the qual
|
||||
* conditions at every tuple.
|
||||
* If we are using lossy info, we have to recheck the qual conditions
|
||||
* at every tuple.
|
||||
*/
|
||||
if (tbmres->ntuples < 0)
|
||||
{
|
||||
@ -237,7 +237,7 @@ BitmapHeapNext(BitmapHeapScanState *node)
|
||||
static void
|
||||
bitgetpage(HeapScanDesc scan, TBMIterateResult *tbmres)
|
||||
{
|
||||
BlockNumber page = tbmres->blockno;
|
||||
BlockNumber page = tbmres->blockno;
|
||||
Buffer buffer;
|
||||
Snapshot snapshot;
|
||||
Page dp;
|
||||
@ -259,9 +259,9 @@ bitgetpage(HeapScanDesc scan, TBMIterateResult *tbmres)
|
||||
snapshot = scan->rs_snapshot;
|
||||
|
||||
/*
|
||||
* We must hold share lock on the buffer content while examining
|
||||
* tuple visibility. Afterwards, however, the tuples we have found
|
||||
* to be visible are guaranteed good as long as we hold the buffer pin.
|
||||
* We must hold share lock on the buffer content while examining tuple
|
||||
* visibility. Afterwards, however, the tuples we have found to be
|
||||
* visible are guaranteed good as long as we hold the buffer pin.
|
||||
*/
|
||||
LockBuffer(buffer, BUFFER_LOCK_SHARE);
|
||||
|
||||
@ -269,10 +269,9 @@ bitgetpage(HeapScanDesc scan, TBMIterateResult *tbmres)
|
||||
maxoff = PageGetMaxOffsetNumber(dp);
|
||||
|
||||
/*
|
||||
* Determine how many entries we need to look at on this page. If
|
||||
* the bitmap is lossy then we need to look at each physical item
|
||||
* pointer; otherwise we just look through the offsets listed in
|
||||
* tbmres.
|
||||
* Determine how many entries we need to look at on this page. If the
|
||||
* bitmap is lossy then we need to look at each physical item pointer;
|
||||
* otherwise we just look through the offsets listed in tbmres.
|
||||
*/
|
||||
if (tbmres->ntuples >= 0)
|
||||
{
|
||||
@ -467,8 +466,8 @@ ExecInitBitmapHeapScan(BitmapHeapScan *node, EState *estate, int eflags)
|
||||
Assert(!(eflags & (EXEC_FLAG_BACKWARD | EXEC_FLAG_MARK)));
|
||||
|
||||
/*
|
||||
* Assert caller didn't ask for an unsafe snapshot --- see comments
|
||||
* at head of file.
|
||||
* Assert caller didn't ask for an unsafe snapshot --- see comments at
|
||||
* head of file.
|
||||
*/
|
||||
Assert(IsMVCCSnapshot(estate->es_snapshot));
|
||||
|
||||
@ -549,8 +548,8 @@ ExecInitBitmapHeapScan(BitmapHeapScan *node, EState *estate, int eflags)
|
||||
* initialize child nodes
|
||||
*
|
||||
* We do this last because the child nodes will open indexscans on our
|
||||
* relation's indexes, and we want to be sure we have acquired a lock
|
||||
* on the relation first.
|
||||
* relation's indexes, and we want to be sure we have acquired a lock on
|
||||
* the relation first.
|
||||
*/
|
||||
outerPlanState(scanstate) = ExecInitNode(outerPlan(node), estate, eflags);
|
||||
|
||||
|
@ -8,7 +8,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $PostgreSQL: pgsql/src/backend/executor/nodeBitmapIndexscan.c,v 1.20 2006/07/31 20:09:04 tgl Exp $
|
||||
* $PostgreSQL: pgsql/src/backend/executor/nodeBitmapIndexscan.c,v 1.21 2006/10/04 00:29:52 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -57,8 +57,8 @@ MultiExecBitmapIndexScan(BitmapIndexScanState *node)
|
||||
/*
|
||||
* If we have runtime keys and they've not already been set up, do it now.
|
||||
* Array keys are also treated as runtime keys; note that if ExecReScan
|
||||
* returns with biss_RuntimeKeysReady still false, then there is an
|
||||
* empty array key so we should do nothing.
|
||||
* returns with biss_RuntimeKeysReady still false, then there is an empty
|
||||
* array key so we should do nothing.
|
||||
*/
|
||||
if (!node->biss_RuntimeKeysReady &&
|
||||
(node->biss_NumRuntimeKeys != 0 || node->biss_NumArrayKeys != 0))
|
||||
@ -152,9 +152,9 @@ ExecBitmapIndexReScan(BitmapIndexScanState *node, ExprContext *exprCtxt)
|
||||
* If we are doing runtime key calculations (ie, the index keys depend on
|
||||
* data from an outer scan), compute the new key values.
|
||||
*
|
||||
* Array keys are also treated as runtime keys; note that if we
|
||||
* return with biss_RuntimeKeysReady still false, then there is an
|
||||
* empty array key so no index scan is needed.
|
||||
* Array keys are also treated as runtime keys; note that if we return
|
||||
* with biss_RuntimeKeysReady still false, then there is an empty array
|
||||
* key so no index scan is needed.
|
||||
*/
|
||||
if (node->biss_NumRuntimeKeys != 0)
|
||||
ExecIndexEvalRuntimeKeys(econtext,
|
||||
@ -249,8 +249,8 @@ ExecInitBitmapIndexScan(BitmapIndexScan *node, EState *estate, int eflags)
|
||||
|
||||
/*
|
||||
* We do not open or lock the base relation here. We assume that an
|
||||
* ancestor BitmapHeapScan node is holding AccessShareLock (or better)
|
||||
* on the heap relation throughout the execution of the plan tree.
|
||||
* ancestor BitmapHeapScan node is holding AccessShareLock (or better) on
|
||||
* the heap relation throughout the execution of the plan tree.
|
||||
*/
|
||||
|
||||
indexstate->ss.ss_currentRelation = NULL;
|
||||
@ -265,7 +265,7 @@ ExecInitBitmapIndexScan(BitmapIndexScan *node, EState *estate, int eflags)
|
||||
*/
|
||||
relistarget = ExecRelationIsTargetRelation(estate, node->scan.scanrelid);
|
||||
indexstate->biss_RelationDesc = index_open(node->indexid,
|
||||
relistarget ? NoLock : AccessShareLock);
|
||||
relistarget ? NoLock : AccessShareLock);
|
||||
|
||||
/*
|
||||
* Initialize index-specific scan state
|
||||
|
@ -8,7 +8,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $PostgreSQL: pgsql/src/backend/executor/nodeHashjoin.c,v 1.84 2006/07/14 14:52:19 momjian Exp $
|
||||
* $PostgreSQL: pgsql/src/backend/executor/nodeHashjoin.c,v 1.85 2006/10/04 00:29:52 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -119,11 +119,11 @@ ExecHashJoin(HashJoinState *node)
|
||||
* since we aren't going to be able to skip the join on the strength
|
||||
* of an empty inner relation anyway.)
|
||||
*
|
||||
* If we are rescanning the join, we make use of information gained
|
||||
* on the previous scan: don't bother to try the prefetch if the
|
||||
* previous scan found the outer relation nonempty. This is not
|
||||
* 100% reliable since with new parameters the outer relation might
|
||||
* yield different results, but it's a good heuristic.
|
||||
* If we are rescanning the join, we make use of information gained on
|
||||
* the previous scan: don't bother to try the prefetch if the previous
|
||||
* scan found the outer relation nonempty. This is not 100% reliable
|
||||
* since with new parameters the outer relation might yield different
|
||||
* results, but it's a good heuristic.
|
||||
*
|
||||
* The only way to make the check is to try to fetch a tuple from the
|
||||
* outer plan node. If we succeed, we have to stash it away for later
|
||||
@ -173,8 +173,8 @@ ExecHashJoin(HashJoinState *node)
|
||||
|
||||
/*
|
||||
* Reset OuterNotEmpty for scan. (It's OK if we fetched a tuple
|
||||
* above, because ExecHashJoinOuterGetTuple will immediately
|
||||
* set it again.)
|
||||
* above, because ExecHashJoinOuterGetTuple will immediately set it
|
||||
* again.)
|
||||
*/
|
||||
node->hj_OuterNotEmpty = false;
|
||||
}
|
||||
@ -788,12 +788,12 @@ ExecHashJoinGetSavedTuple(HashJoinState *hjstate,
|
||||
MinimalTuple tuple;
|
||||
|
||||
/*
|
||||
* Since both the hash value and the MinimalTuple length word are
|
||||
* uint32, we can read them both in one BufFileRead() call without
|
||||
* any type cheating.
|
||||
* Since both the hash value and the MinimalTuple length word are uint32,
|
||||
* we can read them both in one BufFileRead() call without any type
|
||||
* cheating.
|
||||
*/
|
||||
nread = BufFileRead(file, (void *) header, sizeof(header));
|
||||
if (nread == 0) /* end of file */
|
||||
if (nread == 0) /* end of file */
|
||||
{
|
||||
ExecClearTuple(tupleSlot);
|
||||
return NULL;
|
||||
@ -834,8 +834,8 @@ ExecReScanHashJoin(HashJoinState *node, ExprContext *exprCtxt)
|
||||
/*
|
||||
* okay to reuse the hash table; needn't rescan inner, either.
|
||||
*
|
||||
* What we do need to do is reset our state about the emptiness
|
||||
* of the outer relation, so that the new scan of the outer will
|
||||
* What we do need to do is reset our state about the emptiness of
|
||||
* the outer relation, so that the new scan of the outer will
|
||||
* update it correctly if it turns out to be empty this time.
|
||||
* (There's no harm in clearing it now because ExecHashJoin won't
|
||||
* need the info. In the other cases, where the hash table
|
||||
|
@ -8,7 +8,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $PostgreSQL: pgsql/src/backend/executor/nodeIndexscan.c,v 1.116 2006/07/31 20:09:04 tgl Exp $
|
||||
* $PostgreSQL: pgsql/src/backend/executor/nodeIndexscan.c,v 1.117 2006/10/04 00:29:52 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -233,9 +233,9 @@ ExecIndexEvalRuntimeKeys(ExprContext *econtext,
|
||||
bool isNull;
|
||||
|
||||
/*
|
||||
* For each run-time key, extract the run-time expression and
|
||||
* evaluate it with respect to the current outer tuple. We then stick
|
||||
* the result into the proper scan key.
|
||||
* For each run-time key, extract the run-time expression and evaluate
|
||||
* it with respect to the current outer tuple. We then stick the
|
||||
* result into the proper scan key.
|
||||
*
|
||||
* Note: the result of the eval could be a pass-by-ref value that's
|
||||
* stored in the outer scan's tuple, not in
|
||||
@ -290,8 +290,8 @@ ExecIndexEvalArrayKeys(ExprContext *econtext,
|
||||
bool *elem_nulls;
|
||||
|
||||
/*
|
||||
* Compute and deconstruct the array expression.
|
||||
* (Notes in ExecIndexEvalRuntimeKeys() apply here too.)
|
||||
* Compute and deconstruct the array expression. (Notes in
|
||||
* ExecIndexEvalRuntimeKeys() apply here too.)
|
||||
*/
|
||||
arraydatum = ExecEvalExpr(array_expr,
|
||||
econtext,
|
||||
@ -317,8 +317,9 @@ ExecIndexEvalArrayKeys(ExprContext *econtext,
|
||||
}
|
||||
|
||||
/*
|
||||
* Note: we expect the previous array data, if any, to be automatically
|
||||
* freed by resetting the per-tuple context; hence no pfree's here.
|
||||
* Note: we expect the previous array data, if any, to be
|
||||
* automatically freed by resetting the per-tuple context; hence no
|
||||
* pfree's here.
|
||||
*/
|
||||
arrayKeys[j].elem_values = elem_values;
|
||||
arrayKeys[j].elem_nulls = elem_nulls;
|
||||
@ -524,7 +525,7 @@ ExecInitIndexScan(IndexScan *node, EState *estate, int eflags)
|
||||
*/
|
||||
relistarget = ExecRelationIsTargetRelation(estate, node->scan.scanrelid);
|
||||
indexstate->iss_RelationDesc = index_open(node->indexid,
|
||||
relistarget ? NoLock : AccessShareLock);
|
||||
relistarget ? NoLock : AccessShareLock);
|
||||
|
||||
/*
|
||||
* Initialize index-specific scan state
|
||||
@ -543,7 +544,7 @@ ExecInitIndexScan(IndexScan *node, EState *estate, int eflags)
|
||||
&indexstate->iss_NumScanKeys,
|
||||
&indexstate->iss_RuntimeKeys,
|
||||
&indexstate->iss_NumRuntimeKeys,
|
||||
NULL, /* no ArrayKeys */
|
||||
NULL, /* no ArrayKeys */
|
||||
NULL);
|
||||
|
||||
/*
|
||||
@ -661,7 +662,7 @@ ExecIndexBuildScanKeys(PlanState *planstate, Relation index,
|
||||
/*
|
||||
* If there are any RowCompareExpr quals, we need extra ScanKey entries
|
||||
* for them, and possibly extra runtime-key entries. Count up what's
|
||||
* needed. (The subsidiary ScanKey arrays for the RowCompareExprs could
|
||||
* needed. (The subsidiary ScanKey arrays for the RowCompareExprs could
|
||||
* be allocated as separate chunks, but we have to count anyway to make
|
||||
* runtime_keys large enough, so might as well just do one palloc.)
|
||||
*/
|
||||
@ -784,9 +785,9 @@ ExecIndexBuildScanKeys(PlanState *planstate, Relation index,
|
||||
{
|
||||
/* (indexkey, indexkey, ...) op (expression, expression, ...) */
|
||||
RowCompareExpr *rc = (RowCompareExpr *) clause;
|
||||
ListCell *largs_cell = list_head(rc->largs);
|
||||
ListCell *rargs_cell = list_head(rc->rargs);
|
||||
ListCell *opnos_cell = list_head(rc->opnos);
|
||||
ListCell *largs_cell = list_head(rc->largs);
|
||||
ListCell *rargs_cell = list_head(rc->rargs);
|
||||
ListCell *opnos_cell = list_head(rc->opnos);
|
||||
ScanKey first_sub_key = &scan_keys[extra_scan_keys];
|
||||
|
||||
/* Scan RowCompare columns and generate subsidiary ScanKey items */
|
||||
@ -859,7 +860,7 @@ ExecIndexBuildScanKeys(PlanState *planstate, Relation index,
|
||||
opclass = index->rd_indclass->values[varattno - 1];
|
||||
|
||||
get_op_opclass_properties(opno, opclass,
|
||||
&op_strategy, &op_subtype, &op_recheck);
|
||||
&op_strategy, &op_subtype, &op_recheck);
|
||||
|
||||
if (op_strategy != rc->rctype)
|
||||
elog(ERROR, "RowCompare index qualification contains wrong operator");
|
||||
@ -871,11 +872,11 @@ ExecIndexBuildScanKeys(PlanState *planstate, Relation index,
|
||||
*/
|
||||
ScanKeyEntryInitialize(this_sub_key,
|
||||
flags,
|
||||
varattno, /* attribute number */
|
||||
op_strategy, /* op's strategy */
|
||||
op_subtype, /* strategy subtype */
|
||||
opfuncid, /* reg proc to use */
|
||||
scanvalue); /* constant */
|
||||
varattno, /* attribute number */
|
||||
op_strategy, /* op's strategy */
|
||||
op_subtype, /* strategy subtype */
|
||||
opfuncid, /* reg proc to use */
|
||||
scanvalue); /* constant */
|
||||
extra_scan_keys++;
|
||||
}
|
||||
|
||||
@ -883,8 +884,8 @@ ExecIndexBuildScanKeys(PlanState *planstate, Relation index,
|
||||
scan_keys[extra_scan_keys - 1].sk_flags |= SK_ROW_END;
|
||||
|
||||
/*
|
||||
* We don't use ScanKeyEntryInitialize for the header because
|
||||
* it isn't going to contain a valid sk_func pointer.
|
||||
* We don't use ScanKeyEntryInitialize for the header because it
|
||||
* isn't going to contain a valid sk_func pointer.
|
||||
*/
|
||||
MemSet(this_scan_key, 0, sizeof(ScanKeyData));
|
||||
this_scan_key->sk_flags = SK_ROW_HEADER;
|
||||
@ -937,7 +938,7 @@ ExecIndexBuildScanKeys(PlanState *planstate, Relation index,
|
||||
* initialize the scan key's fields appropriately
|
||||
*/
|
||||
ScanKeyEntryInitialize(this_scan_key,
|
||||
0, /* flags */
|
||||
0, /* flags */
|
||||
varattno, /* attribute number to scan */
|
||||
strategy, /* op's strategy */
|
||||
subtype, /* strategy subtype */
|
||||
|
@ -8,7 +8,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $PostgreSQL: pgsql/src/backend/executor/nodeMaterial.c,v 1.56 2006/07/14 14:52:19 momjian Exp $
|
||||
* $PostgreSQL: pgsql/src/backend/executor/nodeMaterial.c,v 1.57 2006/10/04 00:29:52 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -124,16 +124,16 @@ ExecMaterial(MaterialState *node)
|
||||
}
|
||||
|
||||
/*
|
||||
* Append returned tuple to tuplestore. NOTE: because the
|
||||
* tuplestore is certainly in EOF state, its read position will move
|
||||
* forward over the added tuple. This is what we want.
|
||||
* Append returned tuple to tuplestore. NOTE: because the tuplestore
|
||||
* is certainly in EOF state, its read position will move forward over
|
||||
* the added tuple. This is what we want.
|
||||
*/
|
||||
if (tuplestorestate)
|
||||
tuplestore_puttupleslot(tuplestorestate, outerslot);
|
||||
|
||||
/*
|
||||
* And return a copy of the tuple. (XXX couldn't we just return
|
||||
* the outerslot?)
|
||||
* And return a copy of the tuple. (XXX couldn't we just return the
|
||||
* outerslot?)
|
||||
*/
|
||||
return ExecCopySlot(slot, outerslot);
|
||||
}
|
||||
@ -162,10 +162,10 @@ ExecInitMaterial(Material *node, EState *estate, int eflags)
|
||||
matstate->ss.ps.state = estate;
|
||||
|
||||
/*
|
||||
* We must have random access to the subplan output to do backward scan
|
||||
* or mark/restore. We also prefer to materialize the subplan output
|
||||
* if we might be called on to rewind and replay it many times.
|
||||
* However, if none of these cases apply, we can skip storing the data.
|
||||
* We must have random access to the subplan output to do backward scan or
|
||||
* mark/restore. We also prefer to materialize the subplan output if we
|
||||
* might be called on to rewind and replay it many times. However, if none
|
||||
* of these cases apply, we can skip storing the data.
|
||||
*/
|
||||
matstate->randomAccess = (eflags & (EXEC_FLAG_REWIND |
|
||||
EXEC_FLAG_BACKWARD |
|
||||
@ -194,8 +194,8 @@ ExecInitMaterial(Material *node, EState *estate, int eflags)
|
||||
/*
|
||||
* initialize child nodes
|
||||
*
|
||||
* We shield the child node from the need to support REWIND, BACKWARD,
|
||||
* or MARK/RESTORE.
|
||||
* We shield the child node from the need to support REWIND, BACKWARD, or
|
||||
* MARK/RESTORE.
|
||||
*/
|
||||
eflags &= ~(EXEC_FLAG_REWIND | EXEC_FLAG_BACKWARD | EXEC_FLAG_MARK);
|
||||
|
||||
|
@ -8,7 +8,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $PostgreSQL: pgsql/src/backend/executor/nodeMergejoin.c,v 1.81 2006/07/14 14:52:19 momjian Exp $
|
||||
* $PostgreSQL: pgsql/src/backend/executor/nodeMergejoin.c,v 1.82 2006/10/04 00:29:52 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -957,10 +957,10 @@ ExecMergeJoin(MergeJoinState *node)
|
||||
}
|
||||
|
||||
/*
|
||||
* Load up the new inner tuple's comparison values. If we
|
||||
* see that it contains a NULL and hence can't match any
|
||||
* outer tuple, we can skip the comparison and assume the
|
||||
* new tuple is greater than current outer.
|
||||
* Load up the new inner tuple's comparison values. If we see
|
||||
* that it contains a NULL and hence can't match any outer
|
||||
* tuple, we can skip the comparison and assume the new tuple
|
||||
* is greater than current outer.
|
||||
*/
|
||||
if (!MJEvalInnerValues(node, innerTupleSlot))
|
||||
{
|
||||
@ -1377,8 +1377,8 @@ ExecMergeJoin(MergeJoinState *node)
|
||||
else
|
||||
{
|
||||
/*
|
||||
* current inner can't possibly match any outer;
|
||||
* better to advance the inner scan than the outer.
|
||||
* current inner can't possibly match any outer; better to
|
||||
* advance the inner scan than the outer.
|
||||
*/
|
||||
node->mj_JoinState = EXEC_MJ_SKIPINNER_ADVANCE;
|
||||
}
|
||||
|
@ -8,7 +8,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $PostgreSQL: pgsql/src/backend/executor/nodeNestloop.c,v 1.42 2006/03/05 15:58:26 momjian Exp $
|
||||
* $PostgreSQL: pgsql/src/backend/executor/nodeNestloop.c,v 1.43 2006/10/04 00:29:52 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -314,10 +314,10 @@ ExecInitNestLoop(NestLoop *node, EState *estate, int eflags)
|
||||
* initialize child nodes
|
||||
*
|
||||
* Tell the inner child that cheap rescans would be good. (This is
|
||||
* unnecessary if we are doing nestloop with inner indexscan, because
|
||||
* the rescan will always be with a fresh parameter --- but since
|
||||
* nodeIndexscan doesn't actually care about REWIND, there's no point
|
||||
* in dealing with that refinement.)
|
||||
* unnecessary if we are doing nestloop with inner indexscan, because the
|
||||
* rescan will always be with a fresh parameter --- but since
|
||||
* nodeIndexscan doesn't actually care about REWIND, there's no point in
|
||||
* dealing with that refinement.)
|
||||
*/
|
||||
outerPlanState(nlstate) = ExecInitNode(outerPlan(node), estate, eflags);
|
||||
innerPlanState(nlstate) = ExecInitNode(innerPlan(node), estate,
|
||||
|
@ -8,7 +8,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $PostgreSQL: pgsql/src/backend/executor/nodeSeqscan.c,v 1.60 2006/07/14 14:52:19 momjian Exp $
|
||||
* $PostgreSQL: pgsql/src/backend/executor/nodeSeqscan.c,v 1.61 2006/10/04 00:29:52 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -148,7 +148,7 @@ InitScanRelation(SeqScanState *node, EState *estate)
|
||||
* open that relation and acquire appropriate lock on it.
|
||||
*/
|
||||
currentRelation = ExecOpenScanRelation(estate,
|
||||
((SeqScan *) node->ps.plan)->scanrelid);
|
||||
((SeqScan *) node->ps.plan)->scanrelid);
|
||||
|
||||
currentScanDesc = heap_beginscan(currentRelation,
|
||||
estate->es_snapshot,
|
||||
|
@ -8,7 +8,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $PostgreSQL: pgsql/src/backend/executor/nodeSort.c,v 1.57 2006/06/27 16:53:02 tgl Exp $
|
||||
* $PostgreSQL: pgsql/src/backend/executor/nodeSort.c,v 1.58 2006/10/04 00:29:52 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -158,9 +158,9 @@ ExecInitSort(Sort *node, EState *estate, int eflags)
|
||||
sortstate->ss.ps.state = estate;
|
||||
|
||||
/*
|
||||
* We must have random access to the sort output to do backward scan
|
||||
* or mark/restore. We also prefer to materialize the sort output
|
||||
* if we might be called on to rewind and replay it many times.
|
||||
* We must have random access to the sort output to do backward scan or
|
||||
* mark/restore. We also prefer to materialize the sort output if we
|
||||
* might be called on to rewind and replay it many times.
|
||||
*/
|
||||
sortstate->randomAccess = (eflags & (EXEC_FLAG_REWIND |
|
||||
EXEC_FLAG_BACKWARD |
|
||||
@ -189,8 +189,8 @@ ExecInitSort(Sort *node, EState *estate, int eflags)
|
||||
/*
|
||||
* initialize child nodes
|
||||
*
|
||||
* We shield the child node from the need to support REWIND, BACKWARD,
|
||||
* or MARK/RESTORE.
|
||||
* We shield the child node from the need to support REWIND, BACKWARD, or
|
||||
* MARK/RESTORE.
|
||||
*/
|
||||
eflags &= ~(EXEC_FLAG_REWIND | EXEC_FLAG_BACKWARD | EXEC_FLAG_MARK);
|
||||
|
||||
@ -316,6 +316,7 @@ ExecReScanSort(SortState *node, ExprContext *exprCtxt)
|
||||
node->sort_Done = false;
|
||||
tuplesort_end((Tuplesortstate *) node->tuplesortstate);
|
||||
node->tuplesortstate = NULL;
|
||||
|
||||
/*
|
||||
* if chgParam of subnode is not null then plan will be re-scanned by
|
||||
* first ExecProcNode.
|
||||
|
@ -7,7 +7,7 @@
|
||||
* Portions Copyright (c) 1994, Regents of the University of California
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $PostgreSQL: pgsql/src/backend/executor/nodeSubplan.c,v 1.79 2006/07/14 14:52:19 momjian Exp $
|
||||
* $PostgreSQL: pgsql/src/backend/executor/nodeSubplan.c,v 1.80 2006/10/04 00:29:53 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -332,8 +332,8 @@ ExecScanSubPlan(SubPlanState *node,
|
||||
|
||||
/*
|
||||
* For ALL, ANY, and ROWCOMPARE sublinks, load up the Params
|
||||
* representing the columns of the sub-select, and then evaluate
|
||||
* the combining expression.
|
||||
* representing the columns of the sub-select, and then evaluate the
|
||||
* combining expression.
|
||||
*/
|
||||
col = 1;
|
||||
foreach(plst, subplan->paramIds)
|
||||
@ -434,8 +434,8 @@ buildSubPlanHash(SubPlanState *node)
|
||||
* NULL) results of the IN operation, then we have to store subplan output
|
||||
* rows that are partly or wholly NULL. We store such rows in a separate
|
||||
* hash table that we expect will be much smaller than the main table. (We
|
||||
* can use hashing to eliminate partly-null rows that are not distinct.
|
||||
* We keep them separate to minimize the cost of the inevitable full-table
|
||||
* can use hashing to eliminate partly-null rows that are not distinct. We
|
||||
* keep them separate to minimize the cost of the inevitable full-table
|
||||
* searches; see findPartialMatch.)
|
||||
*
|
||||
* If it's not necessary to distinguish FALSE and UNKNOWN, then we don't
|
||||
@ -682,9 +682,9 @@ ExecInitSubPlan(SubPlanState *node, EState *estate, int eflags)
|
||||
/*
|
||||
* Start up the subplan (this is a very cut-down form of InitPlan())
|
||||
*
|
||||
* The subplan will never need to do BACKWARD scan or MARK/RESTORE.
|
||||
* If it is a parameterless subplan (not initplan), we suggest that it
|
||||
* be prepared to handle REWIND efficiently; otherwise there is no need.
|
||||
* The subplan will never need to do BACKWARD scan or MARK/RESTORE. If it
|
||||
* is a parameterless subplan (not initplan), we suggest that it be
|
||||
* prepared to handle REWIND efficiently; otherwise there is no need.
|
||||
*/
|
||||
eflags &= EXEC_FLAG_EXPLAIN_ONLY;
|
||||
if (subplan->parParam == NIL && subplan->setParam == NIL)
|
||||
|
@ -12,7 +12,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $PostgreSQL: pgsql/src/backend/executor/nodeSubqueryscan.c,v 1.31 2006/07/14 14:52:19 momjian Exp $
|
||||
* $PostgreSQL: pgsql/src/backend/executor/nodeSubqueryscan.c,v 1.32 2006/10/04 00:29:53 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -204,7 +204,7 @@ ExecInitSubqueryScan(SubqueryScan *node, EState *estate, int eflags)
|
||||
* too soon during shutdown.
|
||||
*/
|
||||
ExecAssignScanType(&subquerystate->ss,
|
||||
CreateTupleDescCopy(ExecGetResultType(subquerystate->subplan)));
|
||||
CreateTupleDescCopy(ExecGetResultType(subquerystate->subplan)));
|
||||
|
||||
/*
|
||||
* Initialize result tuple type and projection info.
|
||||
|
@ -8,7 +8,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $PostgreSQL: pgsql/src/backend/executor/nodeTidscan.c,v 1.50 2006/07/14 14:52:19 momjian Exp $
|
||||
* $PostgreSQL: pgsql/src/backend/executor/nodeTidscan.c,v 1.51 2006/10/04 00:29:53 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -60,9 +60,9 @@ TidListCreate(TidScanState *tidstate)
|
||||
ListCell *l;
|
||||
|
||||
/*
|
||||
* We initialize the array with enough slots for the case that all
|
||||
* quals are simple OpExprs. If there's any ScalarArrayOpExprs,
|
||||
* we may have to enlarge the array.
|
||||
* We initialize the array with enough slots for the case that all quals
|
||||
* are simple OpExprs. If there's any ScalarArrayOpExprs, we may have to
|
||||
* enlarge the array.
|
||||
*/
|
||||
numAllocTids = list_length(evalList);
|
||||
tidList = (ItemPointerData *)
|
||||
@ -78,9 +78,9 @@ TidListCreate(TidScanState *tidstate)
|
||||
|
||||
if (is_opclause(expr))
|
||||
{
|
||||
FuncExprState *fexstate = (FuncExprState *) exstate;
|
||||
Node *arg1;
|
||||
Node *arg2;
|
||||
FuncExprState *fexstate = (FuncExprState *) exstate;
|
||||
Node *arg1;
|
||||
Node *arg2;
|
||||
|
||||
arg1 = get_leftop(expr);
|
||||
arg2 = get_rightop(expr);
|
||||
@ -154,15 +154,14 @@ TidListCreate(TidScanState *tidstate)
|
||||
|
||||
/*
|
||||
* Sort the array of TIDs into order, and eliminate duplicates.
|
||||
* Eliminating duplicates is necessary since we want OR semantics
|
||||
* across the list. Sorting makes it easier to detect duplicates,
|
||||
* and as a bonus ensures that we will visit the heap in the most
|
||||
* efficient way.
|
||||
* Eliminating duplicates is necessary since we want OR semantics across
|
||||
* the list. Sorting makes it easier to detect duplicates, and as a bonus
|
||||
* ensures that we will visit the heap in the most efficient way.
|
||||
*/
|
||||
if (numTids > 1)
|
||||
{
|
||||
int lastTid;
|
||||
int i;
|
||||
int lastTid;
|
||||
int i;
|
||||
|
||||
qsort((void *) tidList, numTids, sizeof(ItemPointerData),
|
||||
itemptr_comparator);
|
||||
@ -188,8 +187,8 @@ itemptr_comparator(const void *a, const void *b)
|
||||
{
|
||||
const ItemPointerData *ipa = (const ItemPointerData *) a;
|
||||
const ItemPointerData *ipb = (const ItemPointerData *) b;
|
||||
BlockNumber ba = ItemPointerGetBlockNumber(ipa);
|
||||
BlockNumber bb = ItemPointerGetBlockNumber(ipb);
|
||||
BlockNumber ba = ItemPointerGetBlockNumber(ipa);
|
||||
BlockNumber bb = ItemPointerGetBlockNumber(ipb);
|
||||
OffsetNumber oa = ItemPointerGetOffsetNumber(ipa);
|
||||
OffsetNumber ob = ItemPointerGetOffsetNumber(ipb);
|
||||
|
||||
|
@ -2,14 +2,14 @@
|
||||
*
|
||||
* nodeValuesscan.c
|
||||
* Support routines for scanning Values lists
|
||||
* ("VALUES (...), (...), ..." in rangetable).
|
||||
* ("VALUES (...), (...), ..." in rangetable).
|
||||
*
|
||||
* Portions Copyright (c) 1996-2006, PostgreSQL Global Development Group
|
||||
* Portions Copyright (c) 1994, Regents of the University of California
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $PostgreSQL: pgsql/src/backend/executor/nodeValuesscan.c,v 1.2 2006/08/02 18:58:21 tgl Exp $
|
||||
* $PostgreSQL: pgsql/src/backend/executor/nodeValuesscan.c,v 1.3 2006/10/04 00:29:53 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -47,10 +47,10 @@ static TupleTableSlot *
|
||||
ValuesNext(ValuesScanState *node)
|
||||
{
|
||||
TupleTableSlot *slot;
|
||||
EState *estate;
|
||||
ExprContext *econtext;
|
||||
ScanDirection direction;
|
||||
List *exprlist;
|
||||
EState *estate;
|
||||
ExprContext *econtext;
|
||||
ScanDirection direction;
|
||||
List *exprlist;
|
||||
|
||||
/*
|
||||
* get information from the estate and scan state
|
||||
@ -83,9 +83,9 @@ ValuesNext(ValuesScanState *node)
|
||||
}
|
||||
|
||||
/*
|
||||
* Always clear the result slot; this is appropriate if we are at the
|
||||
* end of the data, and if we're not, we still need it as the first step
|
||||
* of the store-virtual-tuple protocol. It seems wise to clear the slot
|
||||
* Always clear the result slot; this is appropriate if we are at the end
|
||||
* of the data, and if we're not, we still need it as the first step of
|
||||
* the store-virtual-tuple protocol. It seems wise to clear the slot
|
||||
* before we reset the context it might have pointers into.
|
||||
*/
|
||||
ExecClearTuple(slot);
|
||||
@ -107,18 +107,18 @@ ValuesNext(ValuesScanState *node)
|
||||
ReScanExprContext(econtext);
|
||||
|
||||
/*
|
||||
* Build the expression eval state in the econtext's per-tuple
|
||||
* memory. This is a tad unusual, but we want to delete the eval
|
||||
* state again when we move to the next row, to avoid growth of
|
||||
* memory requirements over a long values list.
|
||||
* Build the expression eval state in the econtext's per-tuple memory.
|
||||
* This is a tad unusual, but we want to delete the eval state again
|
||||
* when we move to the next row, to avoid growth of memory
|
||||
* requirements over a long values list.
|
||||
*/
|
||||
oldContext = MemoryContextSwitchTo(econtext->ecxt_per_tuple_memory);
|
||||
|
||||
/*
|
||||
* Pass NULL, not my plan node, because we don't want anything
|
||||
* in this transient state linking into permanent state. The
|
||||
* only possibility is a SubPlan, and there shouldn't be any
|
||||
* (any subselects in the VALUES list should be InitPlans).
|
||||
* Pass NULL, not my plan node, because we don't want anything in this
|
||||
* transient state linking into permanent state. The only possibility
|
||||
* is a SubPlan, and there shouldn't be any (any subselects in the
|
||||
* VALUES list should be InitPlans).
|
||||
*/
|
||||
exprstatelist = (List *) ExecInitExpr((Expr *) exprlist, NULL);
|
||||
|
||||
@ -126,8 +126,8 @@ ValuesNext(ValuesScanState *node)
|
||||
Assert(list_length(exprstatelist) == slot->tts_tupleDescriptor->natts);
|
||||
|
||||
/*
|
||||
* Compute the expressions and build a virtual result tuple.
|
||||
* We already did ExecClearTuple(slot).
|
||||
* Compute the expressions and build a virtual result tuple. We
|
||||
* already did ExecClearTuple(slot).
|
||||
*/
|
||||
values = slot->tts_values;
|
||||
isnull = slot->tts_isnull;
|
||||
@ -135,7 +135,7 @@ ValuesNext(ValuesScanState *node)
|
||||
resind = 0;
|
||||
foreach(lc, exprstatelist)
|
||||
{
|
||||
ExprState *estate = (ExprState *) lfirst(lc);
|
||||
ExprState *estate = (ExprState *) lfirst(lc);
|
||||
|
||||
values[resind] = ExecEvalExpr(estate,
|
||||
econtext,
|
||||
@ -181,12 +181,12 @@ ExecValuesScan(ValuesScanState *node)
|
||||
ValuesScanState *
|
||||
ExecInitValuesScan(ValuesScan *node, EState *estate, int eflags)
|
||||
{
|
||||
ValuesScanState *scanstate;
|
||||
RangeTblEntry *rte;
|
||||
TupleDesc tupdesc;
|
||||
ListCell *vtl;
|
||||
int i;
|
||||
PlanState *planstate;
|
||||
ValuesScanState *scanstate;
|
||||
RangeTblEntry *rte;
|
||||
TupleDesc tupdesc;
|
||||
ListCell *vtl;
|
||||
int i;
|
||||
PlanState *planstate;
|
||||
|
||||
/*
|
||||
* ValuesScan should not have any children.
|
||||
@ -208,8 +208,8 @@ ExecInitValuesScan(ValuesScan *node, EState *estate, int eflags)
|
||||
|
||||
/*
|
||||
* Create expression contexts. We need two, one for per-sublist
|
||||
* processing and one for execScan.c to use for quals and projections.
|
||||
* We cheat a little by using ExecAssignExprContext() to build both.
|
||||
* processing and one for execScan.c to use for quals and projections. We
|
||||
* cheat a little by using ExecAssignExprContext() to build both.
|
||||
*/
|
||||
ExecAssignExprContext(estate, planstate);
|
||||
scanstate->rowcontext = planstate->ps_ExprContext;
|
||||
|
@ -8,7 +8,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $PostgreSQL: pgsql/src/backend/executor/spi.c,v 1.163 2006/09/07 22:52:00 tgl Exp $
|
||||
* $PostgreSQL: pgsql/src/backend/executor/spi.c,v 1.164 2006/10/04 00:29:53 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -827,8 +827,8 @@ SPI_cursor_open(const char *name, void *plan,
|
||||
int k;
|
||||
|
||||
/*
|
||||
* Check that the plan is something the Portal code will special-case
|
||||
* as returning one tupleset.
|
||||
* Check that the plan is something the Portal code will special-case as
|
||||
* returning one tupleset.
|
||||
*/
|
||||
if (!SPI_is_cursor_plan(spiplan))
|
||||
{
|
||||
@ -846,7 +846,7 @@ SPI_cursor_open(const char *name, void *plan,
|
||||
errmsg("cannot open empty query as cursor")));
|
||||
ereport(ERROR,
|
||||
(errcode(ERRCODE_INVALID_CURSOR_DEFINITION),
|
||||
/* translator: %s is name of a SQL command, eg INSERT */
|
||||
/* translator: %s is name of a SQL command, eg INSERT */
|
||||
errmsg("cannot open %s query as cursor",
|
||||
CreateQueryTag(queryTree))));
|
||||
}
|
||||
@ -885,7 +885,7 @@ SPI_cursor_open(const char *name, void *plan,
|
||||
{
|
||||
/* sizeof(ParamListInfoData) includes the first array element */
|
||||
paramLI = (ParamListInfo) palloc(sizeof(ParamListInfoData) +
|
||||
(spiplan->nargs - 1) * sizeof(ParamExternData));
|
||||
(spiplan->nargs - 1) *sizeof(ParamExternData));
|
||||
paramLI->numParams = spiplan->nargs;
|
||||
|
||||
for (k = 0; k < spiplan->nargs; k++)
|
||||
@ -1348,7 +1348,7 @@ _SPI_execute_plan(_SPI_plan *plan, Datum *Values, const char *Nulls,
|
||||
|
||||
/* sizeof(ParamListInfoData) includes the first array element */
|
||||
paramLI = (ParamListInfo) palloc(sizeof(ParamListInfoData) +
|
||||
(nargs - 1) * sizeof(ParamExternData));
|
||||
(nargs - 1) *sizeof(ParamExternData));
|
||||
paramLI->numParams = nargs;
|
||||
|
||||
for (k = 0; k < nargs; k++)
|
||||
@ -1482,9 +1482,9 @@ _SPI_execute_plan(_SPI_plan *plan, Datum *Values, const char *Nulls,
|
||||
ActiveSnapshot = NULL;
|
||||
|
||||
/*
|
||||
* The last canSetTag query sets the status values returned
|
||||
* to the caller. Be careful to free any tuptables not
|
||||
* returned, to avoid intratransaction memory leak.
|
||||
* The last canSetTag query sets the status values returned to
|
||||
* the caller. Be careful to free any tuptables not returned,
|
||||
* to avoid intratransaction memory leak.
|
||||
*/
|
||||
if (queryTree->canSetTag)
|
||||
{
|
||||
|
Reference in New Issue
Block a user