PostgreSQL Source Code git master
All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
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)

Definition at line 385 of file nodeLockRows.c.

386{
387 /* We may have shut down EPQ already, but no harm in another call */
390}
void EvalPlanQualEnd(EPQState *epqstate)
Definition: execMain.c:2991
void ExecEndNode(PlanState *node)
Definition: execProcnode.c:562
#define outerPlanState(node)
Definition: execnodes.h:1221
EPQState lr_epqstate
Definition: execnodes.h:2849

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

Referenced by ExecEndNode().

◆ ExecInitLockRows()

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

Definition at line 291 of file nodeLockRows.c.

292{
293 LockRowsState *lrstate;
294 Plan *outerPlan = outerPlan(node);
295 List *epq_arowmarks;
296 ListCell *lc;
297
298 /* check for unsupported flags */
299 Assert(!(eflags & EXEC_FLAG_MARK));
300
301 /*
302 * create state structure
303 */
304 lrstate = makeNode(LockRowsState);
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 */
319 ExecInitResultTypeTL(&lrstate->ps);
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;
343 epq_arowmarks = NIL;
344 foreach(lc, node->rowMarks)
345 {
347 ExecRowMark *erm;
348 ExecAuxRowMark *aerm;
349
350 /* ignore "parent" rowmarks; they are irrelevant at runtime */
351 if (rc->isParent)
352 continue;
353
354 /* find ExecRowMark and build ExecAuxRowMark */
355 erm = ExecFindRowMark(estate, rc->rti, false);
356 aerm = ExecBuildAuxRowMark(erm, outerPlan->targetlist);
357
358 /*
359 * Only locking rowmarks go into our own list. Non-locking marks are
360 * passed off to the EvalPlanQual machinery. This is because we don't
361 * want to bother fetching non-locked rows unless we actually have to
362 * do an EPQ recheck.
363 */
365 lrstate->lr_arowMarks = lappend(lrstate->lr_arowMarks, aerm);
366 else
367 epq_arowmarks = lappend(epq_arowmarks, aerm);
368 }
369
370 /* Now we have the info needed to set up EPQ state */
371 EvalPlanQualInit(&lrstate->lr_epqstate, estate,
372 outerPlan, epq_arowmarks, node->epqParam, NIL);
373
374 return lrstate;
375}
#define Assert(condition)
Definition: c.h:812
ExecRowMark * ExecFindRowMark(EState *estate, Index rti, bool missing_ok)
Definition: execMain.c:2386
ExecAuxRowMark * ExecBuildAuxRowMark(ExecRowMark *erm, List *targetlist)
Definition: execMain.c:2409
void EvalPlanQualInit(EPQState *epqstate, EState *parentestate, Plan *subplan, List *auxrowmarks, int epqParam, List *resultRelations)
Definition: execMain.c:2548
PlanState * ExecInitNode(Plan *node, EState *estate, int eflags)
Definition: execProcnode.c:142
void ExecInitResultTypeTL(PlanState *planstate)
Definition: execTuples.c:1942
const TupleTableSlotOps * ExecGetResultSlotOps(PlanState *planstate, bool *isfixed)
Definition: execUtils.c:504
#define EXEC_FLAG_MARK
Definition: executor.h:69
List * lappend(List *list, void *datum)
Definition: list.c:339
static TupleTableSlot * ExecLockRows(PlanState *pstate)
Definition: nodeLockRows.c:38
#define makeNode(_type_)
Definition: nodes.h:155
#define lfirst_node(type, lc)
Definition: pg_list.h:176
#define NIL
Definition: pg_list.h:68
#define outerPlan(node)
Definition: plannodes.h:183
#define RowMarkRequiresRowShareLock(marktype)
Definition: plannodes.h:1335
RowMarkType markType
Definition: execnodes.h:767
Definition: pg_list.h:54
PlanState ps
Definition: execnodes.h:2847
List * lr_arowMarks
Definition: execnodes.h:2848
int epqParam
Definition: plannodes.h:1258
List * rowMarks
Definition: plannodes.h:1257
bool isParent
Definition: plannodes.h:1387
const TupleTableSlotOps * resultops
Definition: execnodes.h:1202
bool resultopsset
Definition: execnodes.h:1210
Plan * plan
Definition: execnodes.h:1125
EState * state
Definition: execnodes.h:1127
ProjectionInfo * ps_ProjInfo
Definition: execnodes.h:1165
bool resultopsfixed
Definition: execnodes.h:1206
ExecProcNodeMtd ExecProcNode
Definition: execnodes.h:1131

References Assert, LockRows::epqParam, EvalPlanQualInit(), EXEC_FLAG_MARK, ExecBuildAuxRowMark(), ExecFindRowMark(), ExecGetResultSlotOps(), ExecInitNode(), ExecInitResultTypeTL(), ExecLockRows(), PlanState::ExecProcNode, PlanRowMark::isParent, lappend(), lfirst_node, LockRowsState::lr_arowMarks, LockRowsState::lr_epqstate, makeNode, ExecRowMark::markType, NIL, outerPlan, outerPlanState, PlanState::plan, LockRowsState::ps, PlanState::ps_ProjInfo, PlanState::resultops, PlanState::resultopsfixed, PlanState::resultopsset, RowMarkRequiresRowShareLock, LockRows::rowMarks, PlanRowMark::rti, and PlanState::state.

Referenced by ExecInitNode().

◆ ExecReScanLockRows()

void ExecReScanLockRows ( LockRowsState node)

Definition at line 394 of file nodeLockRows.c.

395{
397
398 /*
399 * if chgParam of subnode is not null then plan will be re-scanned by
400 * first ExecProcNode.
401 */
402 if (outerPlan->chgParam == NULL)
404}
void ExecReScan(PlanState *node)
Definition: execAmi.c:76

References ExecReScan(), outerPlan, and outerPlanState.

Referenced by ExecReScan().