mirror of
https://github.com/postgres/postgres.git
synced 2025-07-03 20:02:46 +03:00
pgindent run for 8.3.
This commit is contained in:
@ -6,7 +6,7 @@
|
||||
* Portions Copyright (c) 1996-2007, PostgreSQL Global Development Group
|
||||
* Portions Copyright (c) 1994, Regents of the University of California
|
||||
*
|
||||
* $PostgreSQL: pgsql/src/backend/executor/execAmi.c,v 1.92 2007/02/19 02:23:11 tgl Exp $
|
||||
* $PostgreSQL: pgsql/src/backend/executor/execAmi.c,v 1.93 2007/11/15 21:14:34 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -337,12 +337,13 @@ ExecSupportsMarkRestore(NodeTag plantype)
|
||||
return true;
|
||||
|
||||
case T_Result:
|
||||
|
||||
/*
|
||||
* T_Result only supports mark/restore if it has a child plan
|
||||
* that does, so we do not have enough information to give a
|
||||
* really correct answer. However, for current uses it's
|
||||
* enough to always say "false", because this routine is not
|
||||
* asked about gating Result plans, only base-case Results.
|
||||
* T_Result only supports mark/restore if it has a child plan that
|
||||
* does, so we do not have enough information to give a really
|
||||
* correct answer. However, for current uses it's enough to
|
||||
* always say "false", because this routine is not asked about
|
||||
* gating Result plans, only base-case Results.
|
||||
*/
|
||||
return false;
|
||||
|
||||
|
@ -6,7 +6,7 @@
|
||||
* Portions Copyright (c) 1996-2007, PostgreSQL Global Development Group
|
||||
* Portions Copyright (c) 1994, Regents of the University of California
|
||||
*
|
||||
* $PostgreSQL: pgsql/src/backend/executor/execCurrent.c,v 1.2 2007/06/11 22:22:40 tgl Exp $
|
||||
* $PostgreSQL: pgsql/src/backend/executor/execCurrent.c,v 1.3 2007/11/15 21:14:34 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -36,7 +36,7 @@ static ScanState *search_plan_tree(PlanState *node, Oid table_oid);
|
||||
* valid updatable scan of the specified table.
|
||||
*/
|
||||
bool
|
||||
execCurrentOf(CurrentOfExpr *cexpr,
|
||||
execCurrentOf(CurrentOfExpr * cexpr,
|
||||
ExprContext *econtext,
|
||||
Oid table_oid,
|
||||
ItemPointer current_tid)
|
||||
@ -44,10 +44,10 @@ execCurrentOf(CurrentOfExpr *cexpr,
|
||||
char *cursor_name;
|
||||
char *table_name;
|
||||
Portal portal;
|
||||
QueryDesc *queryDesc;
|
||||
QueryDesc *queryDesc;
|
||||
ScanState *scanstate;
|
||||
bool lisnull;
|
||||
Oid tuple_tableoid;
|
||||
bool lisnull;
|
||||
Oid tuple_tableoid;
|
||||
ItemPointer tuple_tid;
|
||||
|
||||
/* Get the cursor name --- may have to look up a parameter reference */
|
||||
@ -85,24 +85,23 @@ execCurrentOf(CurrentOfExpr *cexpr,
|
||||
cursor_name)));
|
||||
|
||||
/*
|
||||
* Dig through the cursor's plan to find the scan node. Fail if it's
|
||||
* not there or buried underneath aggregation.
|
||||
* Dig through the cursor's plan to find the scan node. Fail if it's not
|
||||
* there or buried underneath aggregation.
|
||||
*/
|
||||
scanstate = search_plan_tree(ExecGetActivePlanTree(queryDesc),
|
||||
table_oid);
|
||||
if (!scanstate)
|
||||
ereport(ERROR,
|
||||
(errcode(ERRCODE_INVALID_CURSOR_STATE),
|
||||
errmsg("cursor \"%s\" is not a simply updatable scan of table \"%s\"",
|
||||
cursor_name, table_name)));
|
||||
errmsg("cursor \"%s\" is not a simply updatable scan of table \"%s\"",
|
||||
cursor_name, table_name)));
|
||||
|
||||
/*
|
||||
* The cursor must have a current result row: per the SQL spec, it's
|
||||
* an error if not. We test this at the top level, rather than at
|
||||
* the scan node level, because in inheritance cases any one table
|
||||
* scan could easily not be on a row. We want to return false, not
|
||||
* raise error, if the passed-in table OID is for one of the inactive
|
||||
* scans.
|
||||
* The cursor must have a current result row: per the SQL spec, it's an
|
||||
* error if not. We test this at the top level, rather than at the scan
|
||||
* node level, because in inheritance cases any one table scan could
|
||||
* easily not be on a row. We want to return false, not raise error, if
|
||||
* the passed-in table OID is for one of the inactive scans.
|
||||
*/
|
||||
if (portal->atStart || portal->atEnd)
|
||||
ereport(ERROR,
|
||||
@ -182,37 +181,37 @@ search_plan_tree(PlanState *node, Oid table_oid)
|
||||
case T_IndexScanState:
|
||||
case T_BitmapHeapScanState:
|
||||
case T_TidScanState:
|
||||
{
|
||||
ScanState *sstate = (ScanState *) node;
|
||||
{
|
||||
ScanState *sstate = (ScanState *) node;
|
||||
|
||||
if (RelationGetRelid(sstate->ss_currentRelation) == table_oid)
|
||||
return sstate;
|
||||
break;
|
||||
}
|
||||
if (RelationGetRelid(sstate->ss_currentRelation) == table_oid)
|
||||
return sstate;
|
||||
break;
|
||||
}
|
||||
|
||||
/*
|
||||
* For Append, we must look through the members; watch out for
|
||||
* multiple matches (possible if it was from UNION ALL)
|
||||
*/
|
||||
case T_AppendState:
|
||||
{
|
||||
AppendState *astate = (AppendState *) node;
|
||||
ScanState *result = NULL;
|
||||
int i;
|
||||
|
||||
for (i = 0; i < astate->as_nplans; i++)
|
||||
{
|
||||
ScanState *elem = search_plan_tree(astate->appendplans[i],
|
||||
table_oid);
|
||||
AppendState *astate = (AppendState *) node;
|
||||
ScanState *result = NULL;
|
||||
int i;
|
||||
|
||||
if (!elem)
|
||||
continue;
|
||||
if (result)
|
||||
return NULL; /* multiple matches */
|
||||
result = elem;
|
||||
for (i = 0; i < astate->as_nplans; i++)
|
||||
{
|
||||
ScanState *elem = search_plan_tree(astate->appendplans[i],
|
||||
table_oid);
|
||||
|
||||
if (!elem)
|
||||
continue;
|
||||
if (result)
|
||||
return NULL; /* multiple matches */
|
||||
result = elem;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/*
|
||||
* Result and Limit can be descended through (these are safe
|
||||
|
@ -26,7 +26,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $PostgreSQL: pgsql/src/backend/executor/execMain.c,v 1.298 2007/09/20 17:56:31 tgl Exp $
|
||||
* $PostgreSQL: pgsql/src/backend/executor/execMain.c,v 1.299 2007/11/15 21:14:34 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -95,7 +95,7 @@ static TupleTableSlot *EvalPlanQualNext(EState *estate);
|
||||
static void EndEvalPlanQual(EState *estate);
|
||||
static void ExecCheckRTPerms(List *rangeTable);
|
||||
static void ExecCheckRTEPerms(RangeTblEntry *rte);
|
||||
static void ExecCheckXactReadOnly(PlannedStmt *plannedstmt);
|
||||
static void ExecCheckXactReadOnly(PlannedStmt * plannedstmt);
|
||||
static void EvalPlanQualStart(evalPlanQual *epq, EState *estate,
|
||||
evalPlanQual *priorepq);
|
||||
static void EvalPlanQualStop(evalPlanQual *epq);
|
||||
@ -411,7 +411,7 @@ ExecCheckRTEPerms(RangeTblEntry *rte)
|
||||
* Check that the query does not imply any writes to non-temp tables.
|
||||
*/
|
||||
static void
|
||||
ExecCheckXactReadOnly(PlannedStmt *plannedstmt)
|
||||
ExecCheckXactReadOnly(PlannedStmt * plannedstmt)
|
||||
{
|
||||
ListCell *l;
|
||||
|
||||
@ -536,8 +536,8 @@ InitPlan(QueryDesc *queryDesc, int eflags)
|
||||
|
||||
/*
|
||||
* Have to lock relations selected FOR UPDATE/FOR SHARE before we
|
||||
* initialize the plan tree, else we'd be doing a lock upgrade.
|
||||
* While we are at it, build the ExecRowMark list.
|
||||
* initialize the plan tree, else we'd be doing a lock upgrade. While we
|
||||
* are at it, build the ExecRowMark list.
|
||||
*/
|
||||
estate->es_rowMarks = NIL;
|
||||
foreach(l, plannedstmt->rowMarks)
|
||||
@ -573,7 +573,7 @@ InitPlan(QueryDesc *queryDesc, int eflags)
|
||||
/* Add slots for subplans and initplans */
|
||||
foreach(l, plannedstmt->subplans)
|
||||
{
|
||||
Plan *subplan = (Plan *) lfirst(l);
|
||||
Plan *subplan = (Plan *) lfirst(l);
|
||||
|
||||
nSlots += ExecCountSlotsNode(subplan);
|
||||
}
|
||||
@ -602,23 +602,22 @@ InitPlan(QueryDesc *queryDesc, int eflags)
|
||||
estate->es_useEvalPlan = false;
|
||||
|
||||
/*
|
||||
* Initialize private state information for each SubPlan. We must do
|
||||
* this before running ExecInitNode on the main query tree, since
|
||||
* Initialize private state information for each SubPlan. We must do this
|
||||
* before running ExecInitNode on the main query tree, since
|
||||
* ExecInitSubPlan expects to be able to find these entries.
|
||||
*/
|
||||
Assert(estate->es_subplanstates == NIL);
|
||||
i = 1; /* subplan indices count from 1 */
|
||||
foreach(l, plannedstmt->subplans)
|
||||
{
|
||||
Plan *subplan = (Plan *) lfirst(l);
|
||||
PlanState *subplanstate;
|
||||
int sp_eflags;
|
||||
Plan *subplan = (Plan *) lfirst(l);
|
||||
PlanState *subplanstate;
|
||||
int sp_eflags;
|
||||
|
||||
/*
|
||||
* A subplan will never need to do BACKWARD scan nor 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.
|
||||
* A subplan will never need to do BACKWARD scan nor 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.
|
||||
*/
|
||||
sp_eflags = eflags & EXEC_FLAG_EXPLAIN_ONLY;
|
||||
if (bms_is_member(i, plannedstmt->rewindPlanIDs))
|
||||
@ -714,11 +713,12 @@ InitPlan(QueryDesc *queryDesc, int eflags)
|
||||
j = ExecInitJunkFilter(subplan->plan->targetlist,
|
||||
resultRelInfo->ri_RelationDesc->rd_att->tdhasoid,
|
||||
ExecAllocTableSlot(estate->es_tupleTable));
|
||||
|
||||
/*
|
||||
* Since it must be UPDATE/DELETE, there had better be
|
||||
* a "ctid" junk attribute in the tlist ... but ctid could
|
||||
* be at a different resno for each result relation.
|
||||
* We look up the ctid resnos now and save them in the
|
||||
* Since it must be UPDATE/DELETE, there had better be a
|
||||
* "ctid" junk attribute in the tlist ... but ctid could
|
||||
* be at a different resno for each result relation. We
|
||||
* look up the ctid resnos now and save them in the
|
||||
* junkfilters.
|
||||
*/
|
||||
j->jf_junkAttNo = ExecFindJunkAttribute(j, "ctid");
|
||||
@ -813,7 +813,7 @@ InitPlan(QueryDesc *queryDesc, int eflags)
|
||||
rliststate = (List *) ExecInitExpr((Expr *) rlist, planstate);
|
||||
resultRelInfo->ri_projectReturning =
|
||||
ExecBuildProjectionInfo(rliststate, econtext, slot,
|
||||
resultRelInfo->ri_RelationDesc->rd_att);
|
||||
resultRelInfo->ri_RelationDesc->rd_att);
|
||||
resultRelInfo++;
|
||||
}
|
||||
}
|
||||
@ -843,8 +843,8 @@ initResultRelInfo(ResultRelInfo *resultRelInfo,
|
||||
bool doInstrument)
|
||||
{
|
||||
/*
|
||||
* Check valid relkind ... parser and/or planner should have noticed
|
||||
* this already, but let's make sure.
|
||||
* Check valid relkind ... parser and/or planner should have noticed this
|
||||
* already, but let's make sure.
|
||||
*/
|
||||
switch (resultRelationDesc->rd_rel->relkind)
|
||||
{
|
||||
@ -928,7 +928,7 @@ initResultRelInfo(ResultRelInfo *resultRelInfo,
|
||||
* if so it doesn't matter which one we pick.) However, it is sometimes
|
||||
* necessary to fire triggers on other relations; this happens mainly when an
|
||||
* RI update trigger queues additional triggers on other relations, which will
|
||||
* be processed in the context of the outer query. For efficiency's sake,
|
||||
* be processed in the context of the outer query. For efficiency's sake,
|
||||
* we want to have a ResultRelInfo for those triggers too; that can avoid
|
||||
* repeated re-opening of the relation. (It also provides a way for EXPLAIN
|
||||
* ANALYZE to report the runtimes of such triggers.) So we make additional
|
||||
@ -964,15 +964,15 @@ ExecGetTriggerResultRel(EState *estate, Oid relid)
|
||||
|
||||
/*
|
||||
* Open the target relation's relcache entry. We assume that an
|
||||
* appropriate lock is still held by the backend from whenever the
|
||||
* trigger event got queued, so we need take no new lock here.
|
||||
* appropriate lock is still held by the backend from whenever the trigger
|
||||
* event got queued, so we need take no new lock here.
|
||||
*/
|
||||
rel = heap_open(relid, NoLock);
|
||||
|
||||
/*
|
||||
* Make the new entry in the right context. Currently, we don't need
|
||||
* any index information in ResultRelInfos used only for triggers,
|
||||
* so tell initResultRelInfo it's a DELETE.
|
||||
* Make the new entry in the right context. Currently, we don't need any
|
||||
* index information in ResultRelInfos used only for triggers, so tell
|
||||
* initResultRelInfo it's a DELETE.
|
||||
*/
|
||||
oldcontext = MemoryContextSwitchTo(estate->es_query_cxt);
|
||||
rInfo = makeNode(ResultRelInfo);
|
||||
@ -1080,7 +1080,7 @@ ExecEndPlan(PlanState *planstate, EState *estate)
|
||||
*/
|
||||
foreach(l, estate->es_subplanstates)
|
||||
{
|
||||
PlanState *subplanstate = (PlanState *) lfirst(l);
|
||||
PlanState *subplanstate = (PlanState *) lfirst(l);
|
||||
|
||||
ExecEndNode(subplanstate);
|
||||
}
|
||||
@ -2398,15 +2398,15 @@ EvalPlanQualStart(evalPlanQual *epq, EState *estate, evalPlanQual *priorepq)
|
||||
ExecCreateTupleTable(estate->es_tupleTable->size);
|
||||
|
||||
/*
|
||||
* Initialize private state information for each SubPlan. We must do
|
||||
* this before running ExecInitNode on the main query tree, since
|
||||
* Initialize private state information for each SubPlan. We must do this
|
||||
* before running ExecInitNode on the main query tree, since
|
||||
* ExecInitSubPlan expects to be able to find these entries.
|
||||
*/
|
||||
Assert(epqstate->es_subplanstates == NIL);
|
||||
foreach(l, estate->es_plannedstmt->subplans)
|
||||
{
|
||||
Plan *subplan = (Plan *) lfirst(l);
|
||||
PlanState *subplanstate;
|
||||
Plan *subplan = (Plan *) lfirst(l);
|
||||
PlanState *subplanstate;
|
||||
|
||||
subplanstate = ExecInitNode(subplan, epqstate, 0);
|
||||
|
||||
@ -2429,7 +2429,7 @@ EvalPlanQualStart(evalPlanQual *epq, EState *estate, evalPlanQual *priorepq)
|
||||
*
|
||||
* This is a cut-down version of ExecutorEnd(); basically we want to do most
|
||||
* of the normal cleanup, but *not* close result relations (which we are
|
||||
* just sharing from the outer query). We do, however, have to close any
|
||||
* just sharing from the outer query). We do, however, have to close any
|
||||
* trigger target relations that got opened, since those are not shared.
|
||||
*/
|
||||
static void
|
||||
@ -2445,7 +2445,7 @@ EvalPlanQualStop(evalPlanQual *epq)
|
||||
|
||||
foreach(l, epqstate->es_subplanstates)
|
||||
{
|
||||
PlanState *subplanstate = (PlanState *) lfirst(l);
|
||||
PlanState *subplanstate = (PlanState *) lfirst(l);
|
||||
|
||||
ExecEndNode(subplanstate);
|
||||
}
|
||||
|
@ -8,7 +8,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $PostgreSQL: pgsql/src/backend/executor/execQual.c,v 1.223 2007/10/24 18:37:08 tgl Exp $
|
||||
* $PostgreSQL: pgsql/src/backend/executor/execQual.c,v 1.224 2007/11/15 21:14:34 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -65,11 +65,11 @@ static Datum ExecEvalAggref(AggrefExprState *aggref,
|
||||
static Datum ExecEvalVar(ExprState *exprstate, ExprContext *econtext,
|
||||
bool *isNull, ExprDoneCond *isDone);
|
||||
static Datum ExecEvalScalarVar(ExprState *exprstate, ExprContext *econtext,
|
||||
bool *isNull, ExprDoneCond *isDone);
|
||||
bool *isNull, ExprDoneCond *isDone);
|
||||
static Datum ExecEvalWholeRowVar(ExprState *exprstate, ExprContext *econtext,
|
||||
bool *isNull, ExprDoneCond *isDone);
|
||||
static Datum ExecEvalWholeRowSlow(ExprState *exprstate, ExprContext *econtext,
|
||||
bool *isNull, ExprDoneCond *isDone);
|
||||
bool *isNull, ExprDoneCond *isDone);
|
||||
static Datum ExecEvalConst(ExprState *exprstate, ExprContext *econtext,
|
||||
bool *isNull, ExprDoneCond *isDone);
|
||||
static Datum ExecEvalParam(ExprState *exprstate, ExprContext *econtext,
|
||||
@ -121,8 +121,8 @@ static Datum ExecEvalCoalesce(CoalesceExprState *coalesceExpr,
|
||||
static Datum ExecEvalMinMax(MinMaxExprState *minmaxExpr,
|
||||
ExprContext *econtext,
|
||||
bool *isNull, ExprDoneCond *isDone);
|
||||
static Datum ExecEvalXml(XmlExprState *xmlExpr, ExprContext *econtext,
|
||||
bool *isNull, ExprDoneCond *isDone);
|
||||
static Datum ExecEvalXml(XmlExprState * xmlExpr, ExprContext *econtext,
|
||||
bool *isNull, ExprDoneCond *isDone);
|
||||
static Datum ExecEvalNullIf(FuncExprState *nullIfExpr,
|
||||
ExprContext *econtext,
|
||||
bool *isNull, ExprDoneCond *isDone);
|
||||
@ -147,14 +147,14 @@ static Datum ExecEvalFieldStore(FieldStoreState *fstate,
|
||||
static Datum ExecEvalRelabelType(GenericExprState *exprstate,
|
||||
ExprContext *econtext,
|
||||
bool *isNull, ExprDoneCond *isDone);
|
||||
static Datum ExecEvalCoerceViaIO(CoerceViaIOState *iostate,
|
||||
ExprContext *econtext,
|
||||
bool *isNull, ExprDoneCond *isDone);
|
||||
static Datum ExecEvalArrayCoerceExpr(ArrayCoerceExprState *astate,
|
||||
ExprContext *econtext,
|
||||
bool *isNull, ExprDoneCond *isDone);
|
||||
static Datum ExecEvalCoerceViaIO(CoerceViaIOState * iostate,
|
||||
ExprContext *econtext,
|
||||
bool *isNull, ExprDoneCond *isDone);
|
||||
static Datum ExecEvalArrayCoerceExpr(ArrayCoerceExprState * astate,
|
||||
ExprContext *econtext,
|
||||
bool *isNull, ExprDoneCond *isDone);
|
||||
static Datum ExecEvalCurrentOfExpr(ExprState *exprstate, ExprContext *econtext,
|
||||
bool *isNull, ExprDoneCond *isDone);
|
||||
bool *isNull, ExprDoneCond *isDone);
|
||||
|
||||
|
||||
/* ----------------------------------------------------------------
|
||||
@ -489,21 +489,21 @@ ExecEvalVar(ExprState *exprstate, ExprContext *econtext,
|
||||
* Scalar variable case.
|
||||
*
|
||||
* If it's a user attribute, check validity (bogus system attnums will
|
||||
* be caught inside slot_getattr). What we have to check for here
|
||||
* is the possibility of an attribute having been changed in type
|
||||
* since the plan tree was created. Ideally the plan would get
|
||||
* invalidated and not re-used, but until that day arrives, we need
|
||||
* defenses. Fortunately it's sufficient to check once on the first
|
||||
* time through.
|
||||
* be caught inside slot_getattr). What we have to check for here is
|
||||
* the possibility of an attribute having been changed in type since
|
||||
* the plan tree was created. Ideally the plan would get invalidated
|
||||
* and not re-used, but until that day arrives, we need defenses.
|
||||
* Fortunately it's sufficient to check once on the first time
|
||||
* through.
|
||||
*
|
||||
* Note: we allow a reference to a dropped attribute. slot_getattr
|
||||
* will force a NULL result in such cases.
|
||||
*
|
||||
* Note: ideally we'd check typmod as well as typid, but that seems
|
||||
* impractical at the moment: in many cases the tupdesc will have
|
||||
* been generated by ExecTypeFromTL(), and that can't guarantee to
|
||||
* generate an accurate typmod in all cases, because some expression
|
||||
* node types don't carry typmod.
|
||||
* impractical at the moment: in many cases the tupdesc will have been
|
||||
* generated by ExecTypeFromTL(), and that can't guarantee to generate
|
||||
* an accurate typmod in all cases, because some expression node types
|
||||
* don't carry typmod.
|
||||
*/
|
||||
if (attnum > 0)
|
||||
{
|
||||
@ -522,9 +522,9 @@ ExecEvalVar(ExprState *exprstate, ExprContext *econtext,
|
||||
if (variable->vartype != attr->atttypid)
|
||||
ereport(ERROR,
|
||||
(errmsg("attribute %d has wrong type", attnum),
|
||||
errdetail("Table has type %s, but query expects %s.",
|
||||
format_type_be(attr->atttypid),
|
||||
format_type_be(variable->vartype))));
|
||||
errdetail("Table has type %s, but query expects %s.",
|
||||
format_type_be(attr->atttypid),
|
||||
format_type_be(variable->vartype))));
|
||||
}
|
||||
}
|
||||
|
||||
@ -570,10 +570,10 @@ ExecEvalVar(ExprState *exprstate, ExprContext *econtext,
|
||||
* looking at the output of a subplan that includes resjunk
|
||||
* columns. (XXX it would be nice to verify that the extra
|
||||
* columns are all marked resjunk, but we haven't got access to
|
||||
* the subplan targetlist here...) Resjunk columns should always
|
||||
* the subplan targetlist here...) Resjunk columns should always
|
||||
* be at the end of a targetlist, so it's sufficient to ignore
|
||||
* them here; but we need to use ExecEvalWholeRowSlow to get
|
||||
* rid of them in the eventual output tuples.
|
||||
* them here; but we need to use ExecEvalWholeRowSlow to get rid
|
||||
* of them in the eventual output tuples.
|
||||
*/
|
||||
var_tupdesc = lookup_rowtype_tupdesc(variable->vartype, -1);
|
||||
|
||||
@ -592,7 +592,7 @@ ExecEvalVar(ExprState *exprstate, ExprContext *econtext,
|
||||
Form_pg_attribute sattr = slot_tupdesc->attrs[i];
|
||||
|
||||
if (vattr->atttypid == sattr->atttypid)
|
||||
continue; /* no worries */
|
||||
continue; /* no worries */
|
||||
if (!vattr->attisdropped)
|
||||
ereport(ERROR,
|
||||
(errcode(ERRCODE_DATATYPE_MISMATCH),
|
||||
@ -737,12 +737,12 @@ ExecEvalWholeRowSlow(ExprState *exprstate, ExprContext *econtext,
|
||||
*isNull = false;
|
||||
|
||||
/*
|
||||
* Currently, the only case handled here is stripping of trailing
|
||||
* resjunk fields, which we do in a slightly chintzy way by just
|
||||
* adjusting the tuple's natts header field. Possibly there will someday
|
||||
* be a need for more-extensive rearrangements, in which case it'd
|
||||
* be worth disassembling and reassembling the tuple (perhaps use a
|
||||
* JunkFilter for that?)
|
||||
* Currently, the only case handled here is stripping of trailing resjunk
|
||||
* fields, which we do in a slightly chintzy way by just adjusting the
|
||||
* tuple's natts header field. Possibly there will someday be a need for
|
||||
* more-extensive rearrangements, in which case it'd be worth
|
||||
* disassembling and reassembling the tuple (perhaps use a JunkFilter for
|
||||
* that?)
|
||||
*/
|
||||
Assert(variable->vartype != RECORDOID);
|
||||
var_tupdesc = lookup_rowtype_tupdesc(variable->vartype, -1);
|
||||
@ -2577,9 +2577,9 @@ ExecEvalArray(ArrayExprState *astate, ExprContext *econtext,
|
||||
|
||||
/*
|
||||
* If all items were null or empty arrays, return an empty array;
|
||||
* otherwise, if some were and some weren't, raise error. (Note:
|
||||
* we must special-case this somehow to avoid trying to generate
|
||||
* a 1-D array formed from empty arrays. It's not ideal...)
|
||||
* otherwise, if some were and some weren't, raise error. (Note: we
|
||||
* must special-case this somehow to avoid trying to generate a 1-D
|
||||
* array formed from empty arrays. It's not ideal...)
|
||||
*/
|
||||
if (haveempty)
|
||||
{
|
||||
@ -2844,17 +2844,17 @@ ExecEvalMinMax(MinMaxExprState *minmaxExpr, ExprContext *econtext,
|
||||
* ----------------------------------------------------------------
|
||||
*/
|
||||
static Datum
|
||||
ExecEvalXml(XmlExprState *xmlExpr, ExprContext *econtext,
|
||||
ExecEvalXml(XmlExprState * xmlExpr, ExprContext *econtext,
|
||||
bool *isNull, ExprDoneCond *isDone)
|
||||
{
|
||||
XmlExpr *xexpr = (XmlExpr *) xmlExpr->xprstate.expr;
|
||||
text *result;
|
||||
StringInfoData buf;
|
||||
Datum value;
|
||||
bool isnull;
|
||||
ListCell *arg;
|
||||
XmlExpr *xexpr = (XmlExpr *) xmlExpr->xprstate.expr;
|
||||
text *result;
|
||||
StringInfoData buf;
|
||||
Datum value;
|
||||
bool isnull;
|
||||
ListCell *arg;
|
||||
ListCell *narg;
|
||||
int i;
|
||||
int i;
|
||||
|
||||
if (isDone)
|
||||
*isDone = ExprSingleResult;
|
||||
@ -2864,11 +2864,11 @@ ExecEvalXml(XmlExprState *xmlExpr, ExprContext *econtext,
|
||||
{
|
||||
case IS_XMLCONCAT:
|
||||
{
|
||||
List *values = NIL;
|
||||
List *values = NIL;
|
||||
|
||||
foreach(arg, xmlExpr->args)
|
||||
{
|
||||
ExprState *e = (ExprState *) lfirst(arg);
|
||||
ExprState *e = (ExprState *) lfirst(arg);
|
||||
|
||||
value = ExecEvalExpr(e, econtext, &isnull, NULL);
|
||||
if (!isnull)
|
||||
@ -2888,8 +2888,8 @@ ExecEvalXml(XmlExprState *xmlExpr, ExprContext *econtext,
|
||||
i = 0;
|
||||
forboth(arg, xmlExpr->named_args, narg, xexpr->arg_names)
|
||||
{
|
||||
ExprState *e = (ExprState *) lfirst(arg);
|
||||
char *argname = strVal(lfirst(narg));
|
||||
ExprState *e = (ExprState *) lfirst(arg);
|
||||
char *argname = strVal(lfirst(narg));
|
||||
|
||||
value = ExecEvalExpr(e, econtext, &isnull, NULL);
|
||||
if (!isnull)
|
||||
@ -2912,8 +2912,8 @@ ExecEvalXml(XmlExprState *xmlExpr, ExprContext *econtext,
|
||||
|
||||
case IS_XMLPARSE:
|
||||
{
|
||||
ExprState *e;
|
||||
text *data;
|
||||
ExprState *e;
|
||||
text *data;
|
||||
bool preserve_whitespace;
|
||||
|
||||
/* arguments are known to be text, bool */
|
||||
@ -2941,8 +2941,8 @@ ExecEvalXml(XmlExprState *xmlExpr, ExprContext *econtext,
|
||||
|
||||
case IS_XMLPI:
|
||||
{
|
||||
ExprState *e;
|
||||
text *arg;
|
||||
ExprState *e;
|
||||
text *arg;
|
||||
|
||||
/* optional argument is known to be text */
|
||||
Assert(list_length(xmlExpr->args) <= 1);
|
||||
@ -2968,9 +2968,9 @@ ExecEvalXml(XmlExprState *xmlExpr, ExprContext *econtext,
|
||||
|
||||
case IS_XMLROOT:
|
||||
{
|
||||
ExprState *e;
|
||||
xmltype *data;
|
||||
text *version;
|
||||
ExprState *e;
|
||||
xmltype *data;
|
||||
text *version;
|
||||
int standalone;
|
||||
|
||||
/* arguments are known to be xml, text, int */
|
||||
@ -3003,7 +3003,7 @@ ExecEvalXml(XmlExprState *xmlExpr, ExprContext *econtext,
|
||||
|
||||
case IS_XMLSERIALIZE:
|
||||
{
|
||||
ExprState *e;
|
||||
ExprState *e;
|
||||
|
||||
/* argument type is known to be xml */
|
||||
Assert(list_length(xmlExpr->args) == 1);
|
||||
@ -3021,7 +3021,7 @@ ExecEvalXml(XmlExprState *xmlExpr, ExprContext *econtext,
|
||||
|
||||
case IS_DOCUMENT:
|
||||
{
|
||||
ExprState *e;
|
||||
ExprState *e;
|
||||
|
||||
/* optional argument is known to be xml */
|
||||
Assert(list_length(xmlExpr->args) == 1);
|
||||
@ -3043,7 +3043,7 @@ ExecEvalXml(XmlExprState *xmlExpr, ExprContext *econtext,
|
||||
result = NULL;
|
||||
else
|
||||
{
|
||||
int len = buf.len + VARHDRSZ;
|
||||
int len = buf.len + VARHDRSZ;
|
||||
|
||||
result = palloc(len);
|
||||
SET_VARSIZE(result, len);
|
||||
@ -3431,9 +3431,9 @@ ExecEvalFieldSelect(FieldSelectState *fstate,
|
||||
|
||||
/* Check for dropped column, and force a NULL result if so */
|
||||
if (fieldnum <= 0 ||
|
||||
fieldnum > tupDesc->natts) /* should never happen */
|
||||
elog(ERROR, "attribute number %d exceeds number of columns %d",
|
||||
fieldnum, tupDesc->natts);
|
||||
fieldnum > tupDesc->natts) /* should never happen */
|
||||
elog(ERROR, "attribute number %d exceeds number of columns %d",
|
||||
fieldnum, tupDesc->natts);
|
||||
attr = tupDesc->attrs[fieldnum - 1];
|
||||
if (attr->attisdropped)
|
||||
{
|
||||
@ -3587,7 +3587,7 @@ ExecEvalRelabelType(GenericExprState *exprstate,
|
||||
* ----------------------------------------------------------------
|
||||
*/
|
||||
static Datum
|
||||
ExecEvalCoerceViaIO(CoerceViaIOState *iostate,
|
||||
ExecEvalCoerceViaIO(CoerceViaIOState * iostate,
|
||||
ExprContext *econtext,
|
||||
bool *isNull, ExprDoneCond *isDone)
|
||||
{
|
||||
@ -3621,7 +3621,7 @@ ExecEvalCoerceViaIO(CoerceViaIOState *iostate,
|
||||
* ----------------------------------------------------------------
|
||||
*/
|
||||
static Datum
|
||||
ExecEvalArrayCoerceExpr(ArrayCoerceExprState *astate,
|
||||
ExecEvalArrayCoerceExpr(ArrayCoerceExprState * astate,
|
||||
ExprContext *econtext,
|
||||
bool *isNull, ExprDoneCond *isDone)
|
||||
{
|
||||
@ -3820,7 +3820,7 @@ ExecInitExpr(Expr *node, PlanState *parent)
|
||||
if (naggs != aggstate->numaggs)
|
||||
ereport(ERROR,
|
||||
(errcode(ERRCODE_GROUPING_ERROR),
|
||||
errmsg("aggregate function calls cannot be nested")));
|
||||
errmsg("aggregate function calls cannot be nested")));
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -3980,8 +3980,8 @@ ExecInitExpr(Expr *node, PlanState *parent)
|
||||
{
|
||||
CoerceViaIO *iocoerce = (CoerceViaIO *) node;
|
||||
CoerceViaIOState *iostate = makeNode(CoerceViaIOState);
|
||||
Oid iofunc;
|
||||
bool typisvarlena;
|
||||
Oid iofunc;
|
||||
bool typisvarlena;
|
||||
|
||||
iostate->xprstate.evalfunc = (ExprStateEvalFunc) ExecEvalCoerceViaIO;
|
||||
iostate->arg = ExecInitExpr(iocoerce->arg, parent);
|
||||
@ -4268,11 +4268,11 @@ ExecInitExpr(Expr *node, PlanState *parent)
|
||||
break;
|
||||
case T_XmlExpr:
|
||||
{
|
||||
XmlExpr *xexpr = (XmlExpr *) node;
|
||||
XmlExprState *xstate = makeNode(XmlExprState);
|
||||
List *outlist;
|
||||
ListCell *arg;
|
||||
int i;
|
||||
XmlExpr *xexpr = (XmlExpr *) node;
|
||||
XmlExprState *xstate = makeNode(XmlExprState);
|
||||
List *outlist;
|
||||
ListCell *arg;
|
||||
int i;
|
||||
|
||||
xstate->xprstate.evalfunc = (ExprStateEvalFunc) ExecEvalXml;
|
||||
xstate->named_outfuncs = (FmgrInfo *)
|
||||
@ -4281,8 +4281,8 @@ ExecInitExpr(Expr *node, PlanState *parent)
|
||||
i = 0;
|
||||
foreach(arg, xexpr->named_args)
|
||||
{
|
||||
Expr *e = (Expr *) lfirst(arg);
|
||||
ExprState *estate;
|
||||
Expr *e = (Expr *) lfirst(arg);
|
||||
ExprState *estate;
|
||||
Oid typOutFunc;
|
||||
bool typIsVarlena;
|
||||
|
||||
@ -4299,8 +4299,8 @@ ExecInitExpr(Expr *node, PlanState *parent)
|
||||
outlist = NIL;
|
||||
foreach(arg, xexpr->args)
|
||||
{
|
||||
Expr *e = (Expr *) lfirst(arg);
|
||||
ExprState *estate;
|
||||
Expr *e = (Expr *) lfirst(arg);
|
||||
ExprState *estate;
|
||||
|
||||
estate = ExecInitExpr(e, parent);
|
||||
outlist = lappend(outlist, estate);
|
||||
|
@ -12,7 +12,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $PostgreSQL: pgsql/src/backend/executor/execScan.c,v 1.41 2007/02/02 00:07:03 tgl Exp $
|
||||
* $PostgreSQL: pgsql/src/backend/executor/execScan.c,v 1.42 2007/11/15 21:14:34 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -217,13 +217,14 @@ tlist_matches_tupdesc(PlanState *ps, List *tlist, Index varno, TupleDesc tupdesc
|
||||
return false; /* out of order */
|
||||
if (att_tup->attisdropped)
|
||||
return false; /* table contains dropped columns */
|
||||
|
||||
/*
|
||||
* Note: usually the Var's type should match the tupdesc exactly,
|
||||
* but in situations involving unions of columns that have different
|
||||
* Note: usually the Var's type should match the tupdesc exactly, but
|
||||
* in situations involving unions of columns that have different
|
||||
* typmods, the Var may have come from above the union and hence have
|
||||
* typmod -1. This is a legitimate situation since the Var still
|
||||
* describes the column, just not as exactly as the tupdesc does.
|
||||
* We could change the planner to prevent it, but it'd then insert
|
||||
* describes the column, just not as exactly as the tupdesc does. We
|
||||
* could change the planner to prevent it, but it'd then insert
|
||||
* projection steps just to convert from specific typmod to typmod -1,
|
||||
* which is pretty silly.
|
||||
*/
|
||||
|
@ -8,7 +8,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $PostgreSQL: pgsql/src/backend/executor/execUtils.c,v 1.151 2007/09/20 17:56:31 tgl Exp $
|
||||
* $PostgreSQL: pgsql/src/backend/executor/execUtils.c,v 1.152 2007/11/15 21:14:34 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -546,7 +546,7 @@ ExecGetResultType(PlanState *planstate)
|
||||
* the given tlist should be a list of ExprState nodes, not Expr nodes.
|
||||
*
|
||||
* inputDesc can be NULL, but if it is not, we check to see whether simple
|
||||
* Vars in the tlist match the descriptor. It is important to provide
|
||||
* Vars in the tlist match the descriptor. It is important to provide
|
||||
* inputDesc for relation-scan plan nodes, as a cross check that the relation
|
||||
* hasn't been changed since the plan was made. At higher levels of a plan,
|
||||
* there is no need to recheck.
|
||||
@ -573,7 +573,7 @@ ExecBuildProjectionInfo(List *targetList,
|
||||
* Determine whether the target list consists entirely of simple Var
|
||||
* references (ie, references to non-system attributes) that match the
|
||||
* input. If so, we can use the simpler ExecVariableList instead of
|
||||
* ExecTargetList. (Note: if there is a type mismatch then ExecEvalVar
|
||||
* ExecTargetList. (Note: if there is a type mismatch then ExecEvalVar
|
||||
* will probably throw an error at runtime, but we leave that to it.)
|
||||
*/
|
||||
isVarList = true;
|
||||
|
@ -8,7 +8,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $PostgreSQL: pgsql/src/backend/executor/functions.c,v 1.118 2007/06/17 18:57:29 tgl Exp $
|
||||
* $PostgreSQL: pgsql/src/backend/executor/functions.c,v 1.119 2007/11/15 21:14:34 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -85,7 +85,7 @@ static execution_state *init_execution_state(List *queryTree_list,
|
||||
static void init_sql_fcache(FmgrInfo *finfo);
|
||||
static void postquel_start(execution_state *es, SQLFunctionCachePtr fcache);
|
||||
static TupleTableSlot *postquel_getnext(execution_state *es,
|
||||
SQLFunctionCachePtr fcache);
|
||||
SQLFunctionCachePtr fcache);
|
||||
static void postquel_end(execution_state *es);
|
||||
static void postquel_sub_params(SQLFunctionCachePtr fcache,
|
||||
FunctionCallInfo fcinfo);
|
||||
@ -251,16 +251,16 @@ init_sql_fcache(FmgrInfo *finfo)
|
||||
queryTree_list = pg_parse_and_rewrite(fcache->src, argOidVect, nargs);
|
||||
|
||||
/*
|
||||
* Check that the function returns the type it claims to. Although
|
||||
* in simple cases this was already done when the function was defined,
|
||||
* we have to recheck because database objects used in the function's
|
||||
* queries might have changed type. We'd have to do it anyway if the
|
||||
* function had any polymorphic arguments.
|
||||
* Check that the function returns the type it claims to. Although in
|
||||
* simple cases this was already done when the function was defined, we
|
||||
* have to recheck because database objects used in the function's queries
|
||||
* might have changed type. We'd have to do it anyway if the function had
|
||||
* any polymorphic arguments.
|
||||
*
|
||||
* Note: we set fcache->returnsTuple according to whether we are
|
||||
* returning the whole tuple result or just a single column. In the
|
||||
* latter case we clear returnsTuple because we need not act different
|
||||
* from the scalar result case, even if it's a rowtype column.
|
||||
* Note: we set fcache->returnsTuple according to whether we are returning
|
||||
* the whole tuple result or just a single column. In the latter case we
|
||||
* clear returnsTuple because we need not act different from the scalar
|
||||
* result case, even if it's a rowtype column.
|
||||
*
|
||||
* In the returnsTuple case, check_sql_fn_retval will also construct a
|
||||
* JunkFilter we can use to coerce the returned rowtype to the desired
|
||||
@ -320,8 +320,8 @@ postquel_start(execution_state *es, SQLFunctionCachePtr fcache)
|
||||
if (es->qd->utilitystmt == NULL)
|
||||
{
|
||||
/*
|
||||
* Only set up to collect queued triggers if it's not a SELECT.
|
||||
* This isn't just an optimization, but is necessary in case a SELECT
|
||||
* Only set up to collect queued triggers if it's not a SELECT. This
|
||||
* isn't just an optimization, but is necessary in case a SELECT
|
||||
* returns multiple rows to caller --- we mustn't exit from the
|
||||
* function execution with a stacked AfterTrigger level still active.
|
||||
*/
|
||||
@ -354,7 +354,7 @@ postquel_getnext(execution_state *es, SQLFunctionCachePtr fcache)
|
||||
es->qd->utilitystmt),
|
||||
fcache->src,
|
||||
es->qd->params,
|
||||
false, /* not top level */
|
||||
false, /* not top level */
|
||||
es->qd->dest,
|
||||
NULL);
|
||||
result = NULL;
|
||||
@ -907,7 +907,7 @@ check_sql_fn_retval(Oid func_id, Oid rettype, List *queryTreeList,
|
||||
/*
|
||||
* If the last query isn't a SELECT, the return type must be VOID.
|
||||
*
|
||||
* Note: eventually replace this test with QueryReturnsTuples? We'd need
|
||||
* Note: eventually replace this test with QueryReturnsTuples? We'd need
|
||||
* a more general method of determining the output type, though.
|
||||
*/
|
||||
if (!(parse->commandType == CMD_SELECT &&
|
||||
@ -926,10 +926,9 @@ check_sql_fn_retval(Oid func_id, Oid rettype, List *queryTreeList,
|
||||
/*
|
||||
* OK, it's a SELECT, so it must return something matching the declared
|
||||
* type. (We used to insist that the declared type not be VOID in this
|
||||
* case, but that makes it hard to write a void function that exits
|
||||
* after calling another void function. Instead, we insist that the
|
||||
* SELECT return void ... so void is treated as if it were a scalar type
|
||||
* below.)
|
||||
* case, but that makes it hard to write a void function that exits after
|
||||
* calling another void function. Instead, we insist that the SELECT
|
||||
* return void ... so void is treated as if it were a scalar type below.)
|
||||
*/
|
||||
|
||||
/*
|
||||
|
@ -61,7 +61,7 @@
|
||||
* Portions Copyright (c) 1994, Regents of the University of California
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $PostgreSQL: pgsql/src/backend/executor/nodeAgg.c,v 1.153 2007/08/08 18:07:05 neilc Exp $
|
||||
* $PostgreSQL: pgsql/src/backend/executor/nodeAgg.c,v 1.154 2007/11/15 21:14:34 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -1363,8 +1363,8 @@ ExecInitAgg(Agg *node, EState *estate, int eflags)
|
||||
|
||||
/*
|
||||
* Get actual datatypes of the inputs. These could be different from
|
||||
* the agg's declared input types, when the agg accepts ANY or
|
||||
* a polymorphic type.
|
||||
* the agg's declared input types, when the agg accepts ANY or a
|
||||
* polymorphic type.
|
||||
*/
|
||||
i = 0;
|
||||
foreach(lc, aggref->args)
|
||||
@ -1647,9 +1647,9 @@ ExecReScanAgg(AggState *node, ExprContext *exprCtxt)
|
||||
MemSet(econtext->ecxt_aggnulls, 0, sizeof(bool) * node->numaggs);
|
||||
|
||||
/*
|
||||
* Release all temp storage. Note that with AGG_HASHED, the hash table
|
||||
* is allocated in a sub-context of the aggcontext. We're going to
|
||||
* rebuild the hash table from scratch, so we need to use
|
||||
* Release all temp storage. Note that with AGG_HASHED, the hash table is
|
||||
* allocated in a sub-context of the aggcontext. We're going to rebuild
|
||||
* the hash table from scratch, so we need to use
|
||||
* MemoryContextResetAndDeleteChildren() to avoid leaking the old hash
|
||||
* table's memory context header.
|
||||
*/
|
||||
|
@ -21,7 +21,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $PostgreSQL: pgsql/src/backend/executor/nodeBitmapHeapscan.c,v 1.20 2007/09/20 17:56:31 tgl Exp $
|
||||
* $PostgreSQL: pgsql/src/backend/executor/nodeBitmapHeapscan.c,v 1.21 2007/11/15 21:14:34 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -277,7 +277,7 @@ bitgetpage(HeapScanDesc scan, TBMIterateResult *tbmres)
|
||||
* tbmres; but we have to follow any HOT chain starting at each such
|
||||
* offset.
|
||||
*/
|
||||
int curslot;
|
||||
int curslot;
|
||||
|
||||
for (curslot = 0; curslot < tbmres->ntuples; curslot++)
|
||||
{
|
||||
|
@ -8,7 +8,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $PostgreSQL: pgsql/src/backend/executor/nodeBitmapIndexscan.c,v 1.23 2007/05/25 17:54:25 tgl Exp $
|
||||
* $PostgreSQL: pgsql/src/backend/executor/nodeBitmapIndexscan.c,v 1.24 2007/11/15 21:14:34 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -259,9 +259,9 @@ ExecInitBitmapIndexScan(BitmapIndexScan *node, EState *estate, int eflags)
|
||||
indexstate->ss.ss_currentScanDesc = NULL;
|
||||
|
||||
/*
|
||||
* If we are just doing EXPLAIN (ie, aren't going to run the plan),
|
||||
* stop here. This allows an index-advisor plugin to EXPLAIN a plan
|
||||
* containing references to nonexistent indexes.
|
||||
* If we are just doing EXPLAIN (ie, aren't going to run the plan), stop
|
||||
* here. This allows an index-advisor plugin to EXPLAIN a plan containing
|
||||
* references to nonexistent indexes.
|
||||
*/
|
||||
if (eflags & EXEC_FLAG_EXPLAIN_ONLY)
|
||||
return indexstate;
|
||||
|
@ -8,7 +8,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $PostgreSQL: pgsql/src/backend/executor/nodeHash.c,v 1.114 2007/06/07 19:19:57 tgl Exp $
|
||||
* $PostgreSQL: pgsql/src/backend/executor/nodeHash.c,v 1.115 2007/11/15 21:14:34 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -271,8 +271,8 @@ ExecHashTableCreate(Hash *node, List *hashOperators)
|
||||
hashtable->spaceAllowed = work_mem * 1024L;
|
||||
|
||||
/*
|
||||
* Get info about the hash functions to be used for each hash key.
|
||||
* Also remember whether the join operators are strict.
|
||||
* Get info about the hash functions to be used for each hash key. Also
|
||||
* remember whether the join operators are strict.
|
||||
*/
|
||||
nkeys = list_length(hashOperators);
|
||||
hashtable->outer_hashfunctions =
|
||||
@ -423,8 +423,8 @@ ExecChooseHashTableSize(double ntuples, int tupwidth,
|
||||
|
||||
/*
|
||||
* Both nbuckets and nbatch must be powers of 2 to make
|
||||
* ExecHashGetBucketAndBatch fast. We already fixed nbatch; now inflate
|
||||
* nbuckets to the next larger power of 2. We also force nbuckets to not
|
||||
* ExecHashGetBucketAndBatch fast. We already fixed nbatch; now inflate
|
||||
* nbuckets to the next larger power of 2. We also force nbuckets to not
|
||||
* be real small, by starting the search at 2^10.
|
||||
*/
|
||||
i = 10;
|
||||
@ -718,22 +718,22 @@ ExecHashGetHashValue(HashJoinTable hashtable,
|
||||
/*
|
||||
* If the attribute is NULL, and the join operator is strict, then
|
||||
* this tuple cannot pass the join qual so we can reject it
|
||||
* immediately (unless we're scanning the outside of an outer join,
|
||||
* in which case we must not reject it). Otherwise we act like the
|
||||
* immediately (unless we're scanning the outside of an outer join, in
|
||||
* which case we must not reject it). Otherwise we act like the
|
||||
* hashcode of NULL is zero (this will support operators that act like
|
||||
* IS NOT DISTINCT, though not any more-random behavior). We treat
|
||||
* the hash support function as strict even if the operator is not.
|
||||
*
|
||||
* Note: currently, all hashjoinable operators must be strict since
|
||||
* the hash index AM assumes that. However, it takes so little
|
||||
* extra code here to allow non-strict that we may as well do it.
|
||||
* the hash index AM assumes that. However, it takes so little extra
|
||||
* code here to allow non-strict that we may as well do it.
|
||||
*/
|
||||
if (isNull)
|
||||
{
|
||||
if (hashtable->hashStrict[i] && !keep_nulls)
|
||||
{
|
||||
MemoryContextSwitchTo(oldContext);
|
||||
return false; /* cannot match */
|
||||
return false; /* cannot match */
|
||||
}
|
||||
/* else, leave hashkey unmodified, equivalent to hashcode 0 */
|
||||
}
|
||||
|
@ -8,7 +8,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $PostgreSQL: pgsql/src/backend/executor/nodeHashjoin.c,v 1.91 2007/06/07 19:19:57 tgl Exp $
|
||||
* $PostgreSQL: pgsql/src/backend/executor/nodeHashjoin.c,v 1.92 2007/11/15 21:14:34 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -569,7 +569,7 @@ ExecHashJoinOuterGetTuple(PlanState *outerNode,
|
||||
econtext->ecxt_outertuple = slot;
|
||||
if (ExecHashGetHashValue(hashtable, econtext,
|
||||
hjstate->hj_OuterHashKeys,
|
||||
true, /* outer tuple */
|
||||
true, /* outer tuple */
|
||||
(hjstate->js.jointype == JOIN_LEFT),
|
||||
hashvalue))
|
||||
{
|
||||
@ -580,8 +580,8 @@ ExecHashJoinOuterGetTuple(PlanState *outerNode,
|
||||
}
|
||||
|
||||
/*
|
||||
* That tuple couldn't match because of a NULL, so discard it
|
||||
* and continue with the next one.
|
||||
* That tuple couldn't match because of a NULL, so discard it and
|
||||
* continue with the next one.
|
||||
*/
|
||||
slot = ExecProcNode(outerNode);
|
||||
}
|
||||
|
@ -8,7 +8,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $PostgreSQL: pgsql/src/backend/executor/nodeIndexscan.c,v 1.123 2007/05/31 20:45:26 tgl Exp $
|
||||
* $PostgreSQL: pgsql/src/backend/executor/nodeIndexscan.c,v 1.124 2007/11/15 21:14:34 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -529,9 +529,9 @@ ExecInitIndexScan(IndexScan *node, EState *estate, int eflags)
|
||||
ExecAssignScanProjectionInfo(&indexstate->ss);
|
||||
|
||||
/*
|
||||
* If we are just doing EXPLAIN (ie, aren't going to run the plan),
|
||||
* stop here. This allows an index-advisor plugin to EXPLAIN a plan
|
||||
* containing references to nonexistent indexes.
|
||||
* If we are just doing EXPLAIN (ie, aren't going to run the plan), stop
|
||||
* here. This allows an index-advisor plugin to EXPLAIN a plan containing
|
||||
* references to nonexistent indexes.
|
||||
*/
|
||||
if (eflags & EXEC_FLAG_EXPLAIN_ONLY)
|
||||
return indexstate;
|
||||
@ -981,7 +981,7 @@ ExecIndexBuildScanKeys(PlanState *planstate, Relation index,
|
||||
if (leftop && IsA(leftop, RelabelType))
|
||||
leftop = ((RelabelType *) leftop)->arg;
|
||||
|
||||
Assert(leftop != NULL);
|
||||
Assert(leftop != NULL);
|
||||
|
||||
if (!(IsA(leftop, Var) &&
|
||||
var_is_rel((Var *) leftop)))
|
||||
@ -994,8 +994,8 @@ ExecIndexBuildScanKeys(PlanState *planstate, Relation index,
|
||||
*/
|
||||
ScanKeyEntryInitialize(this_scan_key,
|
||||
SK_ISNULL | SK_SEARCHNULL,
|
||||
varattno, /* attribute number to scan */
|
||||
strategy, /* op's strategy */
|
||||
varattno, /* attribute number to scan */
|
||||
strategy, /* op's strategy */
|
||||
subtype, /* strategy subtype */
|
||||
InvalidOid, /* no reg proc for this */
|
||||
(Datum) 0); /* constant */
|
||||
|
@ -8,7 +8,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $PostgreSQL: pgsql/src/backend/executor/nodeLimit.c,v 1.31 2007/05/17 19:35:08 tgl Exp $
|
||||
* $PostgreSQL: pgsql/src/backend/executor/nodeLimit.c,v 1.32 2007/11/15 21:14:34 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -57,8 +57,8 @@ ExecLimit(LimitState *node)
|
||||
/*
|
||||
* First call for this node, so compute limit/offset. (We can't do
|
||||
* this any earlier, because parameters from upper nodes will not
|
||||
* be set during ExecInitLimit.) This also sets position = 0
|
||||
* and changes the state to LIMIT_RESCAN.
|
||||
* be set during ExecInitLimit.) This also sets position = 0 and
|
||||
* changes the state to LIMIT_RESCAN.
|
||||
*/
|
||||
recompute_limits(node);
|
||||
|
||||
@ -295,17 +295,18 @@ recompute_limits(LimitState *node)
|
||||
*
|
||||
* This is a bit of a kluge, but we don't have any more-abstract way of
|
||||
* communicating between the two nodes; and it doesn't seem worth trying
|
||||
* to invent one without some more examples of special communication needs.
|
||||
* to invent one without some more examples of special communication
|
||||
* needs.
|
||||
*
|
||||
* Note: it is the responsibility of nodeSort.c to react properly to
|
||||
* changes of these parameters. If we ever do redesign this, it'd be
|
||||
* a good idea to integrate this signaling with the parameter-change
|
||||
* changes of these parameters. If we ever do redesign this, it'd be a
|
||||
* good idea to integrate this signaling with the parameter-change
|
||||
* mechanism.
|
||||
*/
|
||||
if (IsA(outerPlanState(node), SortState))
|
||||
{
|
||||
SortState *sortState = (SortState *) outerPlanState(node);
|
||||
int64 tuples_needed = node->count + node->offset;
|
||||
SortState *sortState = (SortState *) outerPlanState(node);
|
||||
int64 tuples_needed = node->count + node->offset;
|
||||
|
||||
/* negative test checks for overflow */
|
||||
if (node->noCount || tuples_needed < 0)
|
||||
@ -412,9 +413,9 @@ void
|
||||
ExecReScanLimit(LimitState *node, ExprContext *exprCtxt)
|
||||
{
|
||||
/*
|
||||
* Recompute limit/offset in case parameters changed, and reset the
|
||||
* state machine. We must do this before rescanning our child node,
|
||||
* in case it's a Sort that we are passing the parameters down to.
|
||||
* Recompute limit/offset in case parameters changed, and reset the state
|
||||
* machine. We must do this before rescanning our child node, in case
|
||||
* it's a Sort that we are passing the parameters down to.
|
||||
*/
|
||||
recompute_limits(node);
|
||||
|
||||
|
@ -8,7 +8,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $PostgreSQL: pgsql/src/backend/executor/nodeMaterial.c,v 1.59 2007/05/21 17:57:33 tgl Exp $
|
||||
* $PostgreSQL: pgsql/src/backend/executor/nodeMaterial.c,v 1.60 2007/11/15 21:14:34 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -312,10 +312,10 @@ ExecMaterialReScan(MaterialState *node, ExprContext *exprCtxt)
|
||||
|
||||
/*
|
||||
* If subnode is to be rescanned then we forget previous stored
|
||||
* results; we have to re-read the subplan and re-store. Also,
|
||||
* if we told tuplestore it needn't support rescan, we lose and
|
||||
* must re-read. (This last should not happen in common cases;
|
||||
* else our caller lied by not passing EXEC_FLAG_REWIND to us.)
|
||||
* results; we have to re-read the subplan and re-store. Also, if we
|
||||
* told tuplestore it needn't support rescan, we lose and must
|
||||
* re-read. (This last should not happen in common cases; else our
|
||||
* caller lied by not passing EXEC_FLAG_REWIND to us.)
|
||||
*
|
||||
* Otherwise we can just rewind and rescan the stored output. The
|
||||
* state of the subnode does not change.
|
||||
|
@ -8,7 +8,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $PostgreSQL: pgsql/src/backend/executor/nodeMergejoin.c,v 1.88 2007/05/21 17:57:33 tgl Exp $
|
||||
* $PostgreSQL: pgsql/src/backend/executor/nodeMergejoin.c,v 1.89 2007/11/15 21:14:34 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -41,7 +41,7 @@
|
||||
*
|
||||
* Therefore, rather than directly executing the merge join clauses,
|
||||
* we evaluate the left and right key expressions separately and then
|
||||
* compare the columns one at a time (see MJCompare). The planner
|
||||
* compare the columns one at a time (see MJCompare). The planner
|
||||
* passes us enough information about the sort ordering of the inputs
|
||||
* to allow us to determine how to make the comparison. We may use the
|
||||
* appropriate btree comparison function, since Postgres' only notion
|
||||
@ -152,7 +152,7 @@ typedef struct MergeJoinClauseData
|
||||
* sort ordering for each merge key. The mergejoinable operator is an
|
||||
* equality operator in this opfamily, and the two inputs are guaranteed to be
|
||||
* ordered in either increasing or decreasing (respectively) order according
|
||||
* to this opfamily, with nulls at the indicated end of the range. This
|
||||
* to this opfamily, with nulls at the indicated end of the range. This
|
||||
* allows us to obtain the needed comparison function from the opfamily.
|
||||
*/
|
||||
static MergeJoinClause
|
||||
@ -199,7 +199,7 @@ MJExamineQuals(List *mergeclauses,
|
||||
&op_lefttype,
|
||||
&op_righttype,
|
||||
&op_recheck);
|
||||
if (op_strategy != BTEqualStrategyNumber) /* should not happen */
|
||||
if (op_strategy != BTEqualStrategyNumber) /* should not happen */
|
||||
elog(ERROR, "cannot merge using non-equality operator %u",
|
||||
qual->opno);
|
||||
Assert(!op_recheck); /* never true for btree */
|
||||
@ -209,7 +209,7 @@ MJExamineQuals(List *mergeclauses,
|
||||
op_lefttype,
|
||||
op_righttype,
|
||||
BTORDER_PROC);
|
||||
if (!RegProcedureIsValid(cmpproc)) /* should not happen */
|
||||
if (!RegProcedureIsValid(cmpproc)) /* should not happen */
|
||||
elog(ERROR, "missing support function %d(%u,%u) in opfamily %u",
|
||||
BTORDER_PROC, op_lefttype, op_righttype, opfamily);
|
||||
|
||||
@ -227,7 +227,7 @@ MJExamineQuals(List *mergeclauses,
|
||||
clause->reverse = false;
|
||||
else if (opstrategy == BTGreaterStrategyNumber)
|
||||
clause->reverse = true;
|
||||
else /* planner screwed up */
|
||||
else /* planner screwed up */
|
||||
elog(ERROR, "unsupported mergejoin strategy %d", opstrategy);
|
||||
|
||||
clause->nulls_first = nulls_first;
|
||||
@ -354,21 +354,21 @@ MJCompare(MergeJoinState *mergestate)
|
||||
{
|
||||
if (clause->risnull)
|
||||
{
|
||||
nulleqnull = true; /* NULL "=" NULL */
|
||||
nulleqnull = true; /* NULL "=" NULL */
|
||||
continue;
|
||||
}
|
||||
if (clause->nulls_first)
|
||||
result = -1; /* NULL "<" NOT_NULL */
|
||||
result = -1; /* NULL "<" NOT_NULL */
|
||||
else
|
||||
result = 1; /* NULL ">" NOT_NULL */
|
||||
result = 1; /* NULL ">" NOT_NULL */
|
||||
break;
|
||||
}
|
||||
if (clause->risnull)
|
||||
{
|
||||
if (clause->nulls_first)
|
||||
result = 1; /* NOT_NULL ">" NULL */
|
||||
result = 1; /* NOT_NULL ">" NULL */
|
||||
else
|
||||
result = -1; /* NOT_NULL "<" NULL */
|
||||
result = -1; /* NOT_NULL "<" NULL */
|
||||
break;
|
||||
}
|
||||
|
||||
@ -384,7 +384,7 @@ MJCompare(MergeJoinState *mergestate)
|
||||
fresult = FunctionCallInvoke(&fcinfo);
|
||||
if (fcinfo.isnull)
|
||||
{
|
||||
nulleqnull = true; /* treat like NULL = NULL */
|
||||
nulleqnull = true; /* treat like NULL = NULL */
|
||||
continue;
|
||||
}
|
||||
result = DatumGetInt32(fresult);
|
||||
@ -1447,10 +1447,10 @@ ExecInitMergeJoin(MergeJoin *node, EState *estate, int eflags)
|
||||
|
||||
/*
|
||||
* For certain types of inner child nodes, it is advantageous to issue
|
||||
* MARK every time we advance past an inner tuple we will never return
|
||||
* to. For other types, MARK on a tuple we cannot return to is a waste
|
||||
* of cycles. Detect which case applies and set mj_ExtraMarks if we
|
||||
* want to issue "unnecessary" MARK calls.
|
||||
* MARK every time we advance past an inner tuple we will never return to.
|
||||
* For other types, MARK on a tuple we cannot return to is a waste of
|
||||
* cycles. Detect which case applies and set mj_ExtraMarks if we want to
|
||||
* issue "unnecessary" MARK calls.
|
||||
*
|
||||
* Currently, only Material wants the extra MARKs, and it will be helpful
|
||||
* only if eflags doesn't specify REWIND.
|
||||
|
@ -38,7 +38,7 @@
|
||||
* Portions Copyright (c) 1994, Regents of the University of California
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $PostgreSQL: pgsql/src/backend/executor/nodeResult.c,v 1.40 2007/02/22 23:44:25 tgl Exp $
|
||||
* $PostgreSQL: pgsql/src/backend/executor/nodeResult.c,v 1.41 2007/11/15 21:14:35 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -133,8 +133,8 @@ ExecResult(ResultState *node)
|
||||
return NULL;
|
||||
|
||||
/*
|
||||
* prepare to compute projection expressions, which will expect
|
||||
* to access the input tuples as varno OUTER.
|
||||
* prepare to compute projection expressions, which will expect to
|
||||
* access the input tuples as varno OUTER.
|
||||
*/
|
||||
econtext->ecxt_outertuple = outerTupleSlot;
|
||||
}
|
||||
@ -308,9 +308,9 @@ ExecReScanResult(ResultState *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 the subnode now, so that we can pass the
|
||||
* exprCtxt down to the subnode (needed for gated indexscan).
|
||||
* first ExecProcNode. However, if caller is passing us an exprCtxt then
|
||||
* forcibly rescan the subnode now, so that we can pass the exprCtxt down
|
||||
* to the subnode (needed for gated indexscan).
|
||||
*/
|
||||
if (node->ps.lefttree &&
|
||||
(node->ps.lefttree->chgParam == NULL || exprCtxt != NULL))
|
||||
|
@ -7,7 +7,7 @@
|
||||
* Portions Copyright (c) 1994, Regents of the University of California
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $PostgreSQL: pgsql/src/backend/executor/nodeSubplan.c,v 1.90 2007/08/26 21:44:25 tgl Exp $
|
||||
* $PostgreSQL: pgsql/src/backend/executor/nodeSubplan.c,v 1.91 2007/11/15 21:14:35 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -259,14 +259,14 @@ ExecScanSubPlan(SubPlanState *node,
|
||||
* ROWCOMPARE_SUBLINK.
|
||||
*
|
||||
* For EXPR_SUBLINK we require the subplan to produce no more than one
|
||||
* tuple, else an error is raised. If zero tuples are produced, we return
|
||||
* tuple, else an error is raised. If zero tuples are produced, we return
|
||||
* NULL. Assuming we get a tuple, we just use its first column (there can
|
||||
* be only one non-junk column in this case).
|
||||
*
|
||||
* For ARRAY_SUBLINK we allow the subplan to produce any number of tuples,
|
||||
* and form an array of the first column's values. Note in particular
|
||||
* that we produce a zero-element array if no tuples are produced (this
|
||||
* is a change from pre-8.3 behavior of returning NULL).
|
||||
* that we produce a zero-element array if no tuples are produced (this is
|
||||
* a change from pre-8.3 behavior of returning NULL).
|
||||
*/
|
||||
result = BoolGetDatum(subLinkType == ALL_SUBLINK);
|
||||
*isNull = false;
|
||||
@ -859,17 +859,17 @@ ExecInitSubPlan(SubPlan *subplan, PlanState *parent)
|
||||
slot = ExecAllocTableSlot(tupTable);
|
||||
ExecSetSlotDescriptor(slot, tupDesc);
|
||||
sstate->projLeft = ExecBuildProjectionInfo(lefttlist,
|
||||
NULL,
|
||||
slot,
|
||||
NULL);
|
||||
NULL,
|
||||
slot,
|
||||
NULL);
|
||||
|
||||
tupDesc = ExecTypeFromTL(rightptlist, false);
|
||||
slot = ExecAllocTableSlot(tupTable);
|
||||
ExecSetSlotDescriptor(slot, tupDesc);
|
||||
sstate->projRight = ExecBuildProjectionInfo(righttlist,
|
||||
sstate->innerecontext,
|
||||
slot,
|
||||
NULL);
|
||||
sstate->innerecontext,
|
||||
slot,
|
||||
NULL);
|
||||
}
|
||||
|
||||
return sstate;
|
||||
@ -910,8 +910,8 @@ ExecSetParamPlan(SubPlanState *node, ExprContext *econtext)
|
||||
elog(ERROR, "ANY/ALL subselect unsupported as initplan");
|
||||
|
||||
/*
|
||||
* By definition, an initplan has no parameters from our query level,
|
||||
* but it could have some from an outer level. Rescan it if needed.
|
||||
* By definition, an initplan has no parameters from our query level, but
|
||||
* it could have some from an outer level. Rescan it if needed.
|
||||
*/
|
||||
if (planstate->chgParam != NULL)
|
||||
ExecReScan(planstate, NULL);
|
||||
|
@ -12,7 +12,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $PostgreSQL: pgsql/src/backend/executor/nodeSubqueryscan.c,v 1.37 2007/02/27 01:11:25 tgl Exp $
|
||||
* $PostgreSQL: pgsql/src/backend/executor/nodeSubqueryscan.c,v 1.38 2007/11/15 21:14:35 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -98,7 +98,7 @@ ExecInitSubqueryScan(SubqueryScan *node, EState *estate, int eflags)
|
||||
Assert(!(eflags & EXEC_FLAG_MARK));
|
||||
|
||||
/*
|
||||
* SubqueryScan should not have any "normal" children. Also, if planner
|
||||
* SubqueryScan should not have any "normal" children. Also, if planner
|
||||
* left anything in subrtable, it's fishy.
|
||||
*/
|
||||
Assert(outerPlan(node) == NULL);
|
||||
|
@ -8,7 +8,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $PostgreSQL: pgsql/src/backend/executor/nodeTidscan.c,v 1.56 2007/10/24 18:37:08 tgl Exp $
|
||||
* $PostgreSQL: pgsql/src/backend/executor/nodeTidscan.c,v 1.57 2007/11/15 21:14:35 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -155,7 +155,7 @@ TidListCreate(TidScanState *tidstate)
|
||||
ItemPointerData cursor_tid;
|
||||
|
||||
if (execCurrentOf(cexpr, econtext,
|
||||
RelationGetRelid(tidstate->ss.ss_currentRelation),
|
||||
RelationGetRelid(tidstate->ss.ss_currentRelation),
|
||||
&cursor_tid))
|
||||
{
|
||||
if (numTids >= numAllocTids)
|
||||
@ -274,8 +274,8 @@ TidNext(TidScanState *node)
|
||||
|
||||
/*
|
||||
* XXX shouldn't we check here to make sure tuple matches TID list? In
|
||||
* runtime-key case this is not certain, is it? However, in the
|
||||
* WHERE CURRENT OF case it might not match anyway ...
|
||||
* runtime-key case this is not certain, is it? However, in the WHERE
|
||||
* CURRENT OF case it might not match anyway ...
|
||||
*/
|
||||
|
||||
ExecStoreTuple(estate->es_evTuple[scanrelid - 1],
|
||||
@ -328,8 +328,8 @@ TidNext(TidScanState *node)
|
||||
|
||||
/*
|
||||
* For WHERE CURRENT OF, the tuple retrieved from the cursor might
|
||||
* since have been updated; if so, we should fetch the version that
|
||||
* is current according to our snapshot.
|
||||
* since have been updated; if so, we should fetch the version that is
|
||||
* current according to our snapshot.
|
||||
*/
|
||||
if (node->tss_isCurrentOf)
|
||||
heap_get_latest_tid(heapRelation, snapshot, &tuple->t_self);
|
||||
|
@ -8,7 +8,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $PostgreSQL: pgsql/src/backend/executor/spi.c,v 1.183 2007/10/25 13:48:57 tgl Exp $
|
||||
* $PostgreSQL: pgsql/src/backend/executor/spi.c,v 1.184 2007/11/15 21:14:35 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -46,8 +46,8 @@ static int _SPI_pquery(QueryDesc *queryDesc, bool fire_triggers, long tcount);
|
||||
static void _SPI_error_callback(void *arg);
|
||||
|
||||
static void _SPI_cursor_operation(Portal portal,
|
||||
FetchDirection direction, long count,
|
||||
DestReceiver *dest);
|
||||
FetchDirection direction, long count,
|
||||
DestReceiver *dest);
|
||||
|
||||
static SPIPlanPtr _SPI_copy_plan(SPIPlanPtr plan, MemoryContext parentcxt);
|
||||
static SPIPlanPtr _SPI_save_plan(SPIPlanPtr plan);
|
||||
@ -910,7 +910,7 @@ SPI_cursor_open(const char *name, SPIPlanPtr plan,
|
||||
oldcontext = MemoryContextSwitchTo(PortalGetHeapMemory(portal));
|
||||
/* sizeof(ParamListInfoData) includes the first array element */
|
||||
paramLI = (ParamListInfo) palloc(sizeof(ParamListInfoData) +
|
||||
(plan->nargs - 1) *sizeof(ParamExternData));
|
||||
(plan->nargs - 1) *sizeof(ParamExternData));
|
||||
paramLI->numParams = plan->nargs;
|
||||
|
||||
for (k = 0; k < plan->nargs; k++)
|
||||
@ -967,8 +967,8 @@ SPI_cursor_open(const char *name, SPIPlanPtr plan,
|
||||
cplan);
|
||||
|
||||
/*
|
||||
* Set up options for portal. Default SCROLL type is chosen the same
|
||||
* way as PerformCursorOpen does it.
|
||||
* Set up options for portal. Default SCROLL type is chosen the same way
|
||||
* as PerformCursorOpen does it.
|
||||
*/
|
||||
portal->cursorOptions = plan->cursor_options;
|
||||
if (!(portal->cursorOptions & (CURSOR_OPT_SCROLL | CURSOR_OPT_NO_SCROLL)))
|
||||
@ -983,9 +983,9 @@ SPI_cursor_open(const char *name, SPIPlanPtr plan,
|
||||
}
|
||||
|
||||
/*
|
||||
* Disallow SCROLL with SELECT FOR UPDATE. This is not redundant with
|
||||
* the check in transformDeclareCursorStmt because the cursor options
|
||||
* might not have come through there.
|
||||
* Disallow SCROLL with SELECT FOR UPDATE. This is not redundant with the
|
||||
* check in transformDeclareCursorStmt because the cursor options might
|
||||
* not have come through there.
|
||||
*/
|
||||
if (portal->cursorOptions & CURSOR_OPT_SCROLL)
|
||||
{
|
||||
@ -999,9 +999,9 @@ SPI_cursor_open(const char *name, SPIPlanPtr plan,
|
||||
}
|
||||
|
||||
/*
|
||||
* If told to be read-only, we'd better check for read-only queries.
|
||||
* This can't be done earlier because we need to look at the finished,
|
||||
* planned queries. (In particular, we don't want to do it between
|
||||
* If told to be read-only, we'd better check for read-only queries. This
|
||||
* can't be done earlier because we need to look at the finished, planned
|
||||
* queries. (In particular, we don't want to do it between
|
||||
* RevalidateCachedPlan and PortalDefineQuery, because throwing an error
|
||||
* between those steps would result in leaking our plancache refcount.)
|
||||
*/
|
||||
@ -1011,14 +1011,14 @@ SPI_cursor_open(const char *name, SPIPlanPtr plan,
|
||||
|
||||
foreach(lc, stmt_list)
|
||||
{
|
||||
Node *pstmt = (Node *) lfirst(lc);
|
||||
Node *pstmt = (Node *) lfirst(lc);
|
||||
|
||||
if (!CommandIsReadOnly(pstmt))
|
||||
ereport(ERROR,
|
||||
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
|
||||
/* translator: %s is a SQL statement name */
|
||||
errmsg("%s is not allowed in a non-volatile function",
|
||||
CreateCommandTag(pstmt))));
|
||||
/* translator: %s is a SQL statement name */
|
||||
errmsg("%s is not allowed in a non-volatile function",
|
||||
CreateCommandTag(pstmt))));
|
||||
}
|
||||
}
|
||||
|
||||
@ -1396,8 +1396,8 @@ _SPI_prepare_plan(const char *src, SPIPlanPtr plan)
|
||||
raw_parsetree_list = pg_parse_query(src);
|
||||
|
||||
/*
|
||||
* Do parse analysis and rule rewrite for each raw parsetree, then
|
||||
* cons up a phony plancache entry for each one.
|
||||
* Do parse analysis and rule rewrite for each raw parsetree, then cons up
|
||||
* a phony plancache entry for each one.
|
||||
*/
|
||||
plancache_list = NIL;
|
||||
|
||||
@ -1416,9 +1416,9 @@ _SPI_prepare_plan(const char *src, SPIPlanPtr plan)
|
||||
plansource = (CachedPlanSource *) palloc0(sizeof(CachedPlanSource));
|
||||
cplan = (CachedPlan *) palloc0(sizeof(CachedPlan));
|
||||
|
||||
plansource->raw_parse_tree = parsetree;
|
||||
plansource->raw_parse_tree = parsetree;
|
||||
/* cast-away-const here is a bit ugly, but there's no reason to copy */
|
||||
plansource->query_string = (char *) src;
|
||||
plansource->query_string = (char *) src;
|
||||
plansource->commandTag = CreateCommandTag(parsetree);
|
||||
plansource->param_types = argtypes;
|
||||
plansource->num_params = nargs;
|
||||
@ -1621,7 +1621,7 @@ _SPI_execute_plan(SPIPlanPtr plan, Datum *Values, const char *Nulls,
|
||||
ProcessUtility(stmt,
|
||||
plansource->query_string,
|
||||
paramLI,
|
||||
false, /* not top level */
|
||||
false, /* not top level */
|
||||
dest,
|
||||
NULL);
|
||||
/* Update "processed" if stmt returned tuples */
|
||||
@ -1713,7 +1713,7 @@ _SPI_pquery(QueryDesc *queryDesc, bool fire_triggers, long tcount)
|
||||
{
|
||||
case CMD_SELECT:
|
||||
Assert(queryDesc->plannedstmt->utilityStmt == NULL);
|
||||
if (queryDesc->plannedstmt->intoClause) /* select into table? */
|
||||
if (queryDesc->plannedstmt->intoClause) /* select into table? */
|
||||
res = SPI_OK_SELINTO;
|
||||
else if (queryDesc->dest->mydest != DestSPI)
|
||||
{
|
||||
@ -1984,8 +1984,8 @@ _SPI_copy_plan(SPIPlanPtr plan, MemoryContext parentcxt)
|
||||
newsource = (CachedPlanSource *) palloc0(sizeof(CachedPlanSource));
|
||||
newcplan = (CachedPlan *) palloc0(sizeof(CachedPlan));
|
||||
|
||||
newsource->raw_parse_tree = copyObject(plansource->raw_parse_tree);
|
||||
newsource->query_string = pstrdup(plansource->query_string);
|
||||
newsource->raw_parse_tree = copyObject(plansource->raw_parse_tree);
|
||||
newsource->query_string = pstrdup(plansource->query_string);
|
||||
newsource->commandTag = plansource->commandTag;
|
||||
newsource->param_types = newplan->argtypes;
|
||||
newsource->num_params = newplan->nargs;
|
||||
|
Reference in New Issue
Block a user