static void CheckValidRowMarkRel(Relation rel, RowMarkType markType);
static void ExecPostprocessPlan(EState *estate);
static void ExecEndPlan(PlanState *planstate, EState *estate);
-static void ExecutePlan(EState *estate, PlanState *planstate,
- bool use_parallel_mode,
+static void ExecutePlan(QueryDesc *queryDesc,
CmdType operation,
bool sendTuples,
uint64 numberTuples,
ScanDirection direction,
- DestReceiver *dest,
- bool execute_once);
+ DestReceiver *dest);
static bool ExecCheckRTEPerms(RangeTblEntry *rte);
static bool ExecCheckRTEPermsModified(Oid relOid, Oid userid,
Bitmapset *modifiedCols,
* retrieved tuples, not for instance to those inserted/updated/deleted
* by a ModifyTable plan node.
*
+ * execute_once is ignored, and is present only to avoid an API break
+ * in stable branches.
+ *
* There is no return value, but output tuples (if any) are sent to
* the destination receiver specified in the QueryDesc; and the number
* of tuples processed at the top level can be found in
* run plan
*/
if (!ScanDirectionIsNoMovement(direction))
- {
- if (execute_once && queryDesc->already_executed)
- elog(ERROR, "can't re-execute query flagged for single execution");
- queryDesc->already_executed = true;
-
- ExecutePlan(estate,
- queryDesc->planstate,
- queryDesc->plannedstmt->parallelModeNeeded,
+ ExecutePlan(queryDesc,
operation,
sendTuples,
count,
direction,
- dest,
- execute_once);
- }
+ dest);
/*
* shutdown tuple receiver, if we started it
* moving in the specified direction.
*
* Runs to completion if numberTuples is 0
- *
- * Note: the ctid attribute is a 'junk' attribute that is removed before the
- * user can see it
* ----------------------------------------------------------------
*/
static void
-ExecutePlan(EState *estate,
- PlanState *planstate,
- bool use_parallel_mode,
+ExecutePlan(QueryDesc *queryDesc,
CmdType operation,
bool sendTuples,
uint64 numberTuples,
ScanDirection direction,
- DestReceiver *dest,
- bool execute_once)
+ DestReceiver *dest)
{
+ EState *estate = queryDesc->estate;
+ PlanState *planstate = queryDesc->planstate;
+ bool use_parallel_mode;
TupleTableSlot *slot;
uint64 current_tuple_count;
estate->es_direction = direction;
/*
- * If the plan might potentially be executed multiple times, we must force
- * it to run without parallelism, because we might exit early.
+ * Set up parallel mode if appropriate.
+ *
+ * Parallel mode only supports complete execution of a plan. If we've
+ * already partially executed it, or if the caller asks us to exit early,
+ * we must force the plan to run without parallelism.
*/
- if (!execute_once)
+ if (queryDesc->already_executed || numberTuples != 0)
use_parallel_mode = false;
+ else
+ use_parallel_mode = queryDesc->plannedstmt->parallelModeNeeded;
+ queryDesc->already_executed = true;
estate->es_use_parallel_mode = use_parallel_mode;
if (use_parallel_mode)
* isTopLevel: true if query is being executed at backend "top level"
* (that is, directly from a client command message)
*
+ * run_once: ignored, present only to avoid an API break in stable branches.
+ *
* dest: where to send output of primary (canSetTag) query
*
* altdest: where to send output of non-primary queries
*/
MarkPortalActive(portal);
- /* Set run_once flag. Shouldn't be clear if previously set. */
- Assert(!portal->run_once || run_once);
- portal->run_once = run_once;
-
/*
* Set up global portal context pointers.
*
{
PushActiveSnapshot(queryDesc->snapshot);
ExecutorRun(queryDesc, direction, (uint64) count,
- portal->run_once);
+ false);
nprocessed = queryDesc->estate->es_processed;
PopActiveSnapshot();
}
{
PushActiveSnapshot(queryDesc->snapshot);
ExecutorRun(queryDesc, direction, (uint64) count,
- portal->run_once);
+ false);
nprocessed = queryDesc->estate->es_processed;
PopActiveSnapshot();
}
*/
MarkPortalActive(portal);
- /* If supporting FETCH, portal can't be run-once. */
- Assert(!portal->run_once);
-
/*
* Set up global portal context pointers.
*/