PostgreSQL Source Code git master
Loading...
Searching...
No Matches
nodeLockRows.h File Reference
#include "nodes/execnodes.h"
Include dependency graph for nodeLockRows.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

LockRowsStateExecInitLockRows (LockRows *node, EState *estate, int eflags)
 
void ExecEndLockRows (LockRowsState *node)
 
void ExecReScanLockRows (LockRowsState *node)
 

Function Documentation

◆ ExecEndLockRows()

void ExecEndLockRows ( LockRowsState node)
extern

Definition at line 394 of file nodeLockRows.c.

395{
396 /* We may have shut down EPQ already, but no harm in another call */
399}
void EvalPlanQualEnd(EPQState *epqstate)
Definition execMain.c:3183
void ExecEndNode(PlanState *node)
#define outerPlanState(node)
Definition execnodes.h:1263
EPQState lr_epqstate
Definition execnodes.h:2754

References EvalPlanQualEnd(), ExecEndNode(), LockRowsState::lr_epqstate, and outerPlanState.

Referenced by ExecEndNode().

◆ ExecInitLockRows()

LockRowsState * ExecInitLockRows ( LockRows node,
EState estate,
int  eflags 
)
extern

Definition at line 291 of file nodeLockRows.c.

292{
294 Plan *outerPlan = outerPlan(node);
296 ListCell *lc;
297
298 /* check for unsupported flags */
299 Assert(!(eflags & EXEC_FLAG_MARK));
300
301 /*
302 * create state structure
303 */
305 lrstate->ps.plan = (Plan *) node;
306 lrstate->ps.state = estate;
307 lrstate->ps.ExecProcNode = ExecLockRows;
308
309 /*
310 * Miscellaneous initialization
311 *
312 * LockRows nodes never call ExecQual or ExecProject, therefore no
313 * ExprContext is needed.
314 */
315
316 /*
317 * Initialize result type.
318 */
320
321 /*
322 * then initialize outer plan
323 */
324 outerPlanState(lrstate) = ExecInitNode(outerPlan, estate, eflags);
325
326 /* node returns unmodified slots from the outer plan */
327 lrstate->ps.resultopsset = true;
329 &lrstate->ps.resultopsfixed);
330
331 /*
332 * LockRows nodes do no projections, so initialize projection info for
333 * this node appropriately
334 */
335 lrstate->ps.ps_ProjInfo = NULL;
336
337 /*
338 * Locate the ExecRowMark(s) that this node is responsible for, and
339 * construct ExecAuxRowMarks for them. (InitPlan should already have
340 * built the global list of ExecRowMarks.)
341 */
342 lrstate->lr_arowMarks = NIL;
344 foreach(lc, node->rowMarks)
345 {
347 RangeTblEntry *rte = exec_rt_fetch(rc->rti, estate);
350
351 /* ignore "parent" rowmarks; they are irrelevant at runtime */
352 if (rc->isParent)
353 continue;
354
355 /*
356 * Also ignore rowmarks belonging to child tables that have been
357 * pruned in ExecDoInitialPruning().
358 */
359 if (rte->rtekind == RTE_RELATION &&
360 !bms_is_member(rc->rti, estate->es_unpruned_relids))
361 continue;
362
363 /* find ExecRowMark and build ExecAuxRowMark */
364 erm = ExecFindRowMark(estate, rc->rti, false);
365 aerm = ExecBuildAuxRowMark(erm, outerPlan->targetlist);
366
367 /*
368 * Only locking rowmarks go into our own list. Non-locking marks are
369 * passed off to the EvalPlanQual machinery. This is because we don't
370 * want to bother fetching non-locked rows unless we actually have to
371 * do an EPQ recheck.
372 */
373 if (RowMarkRequiresRowShareLock(erm->markType))
374 lrstate->lr_arowMarks = lappend(lrstate->lr_arowMarks, aerm);
375 else
377 }
378
379 /* Now we have the info needed to set up EPQ state */
380 EvalPlanQualInit(&lrstate->lr_epqstate, estate,
382
383 return lrstate;
384}
bool bms_is_member(int x, const Bitmapset *a)
Definition bitmapset.c:510
#define Assert(condition)
Definition c.h:873
ExecRowMark * ExecFindRowMark(EState *estate, Index rti, bool missing_ok)
Definition execMain.c:2560
ExecAuxRowMark * ExecBuildAuxRowMark(ExecRowMark *erm, List *targetlist)
Definition execMain.c:2583
void EvalPlanQualInit(EPQState *epqstate, EState *parentestate, Plan *subplan, List *auxrowmarks, int epqParam, List *resultRelations)
Definition execMain.c:2722
PlanState * ExecInitNode(Plan *node, EState *estate, int eflags)
void ExecInitResultTypeTL(PlanState *planstate)
const TupleTableSlotOps * ExecGetResultSlotOps(PlanState *planstate, bool *isfixed)
Definition execUtils.c:504
static RangeTblEntry * exec_rt_fetch(Index rti, EState *estate)
Definition executor.h:697
#define EXEC_FLAG_MARK
Definition executor.h:70
List * lappend(List *list, void *datum)
Definition list.c:339
static TupleTableSlot * ExecLockRows(PlanState *pstate)
#define makeNode(_type_)
Definition nodes.h:161
@ RTE_RELATION
#define lfirst_node(type, lc)
Definition pg_list.h:176
#define NIL
Definition pg_list.h:68
#define outerPlan(node)
Definition plannodes.h:261
#define RowMarkRequiresRowShareLock(marktype)
Definition plannodes.h:1544
static int fb(int x)
Bitmapset * es_unpruned_relids
Definition execnodes.h:675
Definition pg_list.h:54
int epqParam
Definition plannodes.h:1467
List * rowMarks
Definition plannodes.h:1465

References Assert, bms_is_member(), LockRows::epqParam, EState::es_unpruned_relids, EvalPlanQualInit(), EXEC_FLAG_MARK, exec_rt_fetch(), ExecBuildAuxRowMark(), ExecFindRowMark(), ExecGetResultSlotOps(), ExecInitNode(), ExecInitResultTypeTL(), ExecLockRows(), fb(), PlanRowMark::isParent, lappend(), lfirst_node, makeNode, NIL, outerPlan, outerPlanState, RowMarkRequiresRowShareLock, LockRows::rowMarks, RTE_RELATION, and PlanRowMark::rti.

Referenced by ExecInitNode().

◆ ExecReScanLockRows()

void ExecReScanLockRows ( LockRowsState node)
extern

Definition at line 403 of file nodeLockRows.c.

404{
406
407 /*
408 * if chgParam of subnode is not null then plan will be re-scanned by
409 * first ExecProcNode.
410 */
411 if (outerPlan->chgParam == NULL)
413}
void ExecReScan(PlanState *node)
Definition execAmi.c:77

References ExecReScan(), fb(), outerPlan, and outerPlanState.

Referenced by ExecReScan().