---------------------------------------------------------------- * ExecLockRows * ---------------------------------------------------------------- */
| 35 | * ---------------------------------------------------------------- |
| 36 | */ |
| 37 | static TupleTableSlot * /* return: a tuple or NULL */ |
| 38 | ExecLockRows(PlanState *pstate) |
| 39 | { |
| 40 | LockRowsState *node = castNode(LockRowsState, pstate); |
| 41 | TupleTableSlot *slot; |
| 42 | EState *estate; |
| 43 | PlanState *outerPlan; |
| 44 | bool epq_needed; |
| 45 | ListCell *lc; |
| 46 | |
| 47 | CHECK_FOR_INTERRUPTS(); |
| 48 | |
| 49 | /* |
| 50 | * get information from the node |
| 51 | */ |
| 52 | estate = node->ps.state; |
| 53 | outerPlan = outerPlanState(node); |
| 54 | |
| 55 | /* |
| 56 | * Get next tuple from subplan, if any. |
| 57 | */ |
| 58 | lnext: |
| 59 | slot = ExecProcNode(outerPlan); |
| 60 | |
| 61 | if (TupIsNull(slot)) |
| 62 | { |
| 63 | /* Release any resources held by EPQ mechanism before exiting */ |
| 64 | EvalPlanQualEnd(&node->lr_epqstate); |
| 65 | return NULL; |
| 66 | } |
| 67 | |
| 68 | /* We don't need EvalPlanQual unless we get updated tuple version(s) */ |
| 69 | epq_needed = false; |
| 70 | |
| 71 | /* |
| 72 | * Attempt to lock the source tuple(s). (Note we only have locking |
| 73 | * rowmarks in lr_arowMarks.) |
| 74 | */ |
| 75 | foreach(lc, node->lr_arowMarks) |
| 76 | { |
| 77 | ExecAuxRowMark *aerm = (ExecAuxRowMark *) lfirst(lc); |
| 78 | ExecRowMark *erm = aerm->rowmark; |
| 79 | Datum datum; |
| 80 | bool isNull; |
| 81 | ItemPointerData tid; |
| 82 | TM_FailureData tmfd; |
| 83 | LockTupleMode lockmode; |
| 84 | int lockflags = 0; |
| 85 | TM_Result test; |
| 86 | TupleTableSlot *markSlot; |
| 87 | |
| 88 | /* clear any leftover test tuple for this rel */ |
| 89 | markSlot = EvalPlanQualSlot(&node->lr_epqstate, erm->relation, erm->rti); |
| 90 | ExecClearTuple(markSlot); |
| 91 | |
| 92 | /* if child rel, must check whether it produced this row */ |
| 93 | if (erm->rti != erm->prti) |
| 94 | { |
nothing calls this directly
no test coverage detected