PostgreSQL Source Code: src/backend/executor/nodeLockRows.c Source File (original) (raw)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
23
31
32
33
34
35
36
39{
44 bool epq_needed;
46
48
49
50
51
54
55
56
57
60
62 {
63
65 return NULL;
66 }
67
68
69 epq_needed = false;
70
71
72
73
74
76 {
80 bool isNull;
84 int lockflags = 0;
87
88
91
92
94 {
95 Oid tableoid;
96
99 &isNull);
100
101 if (isNull)
104
106 if (tableoid != erm->relid)
107 {
108
111 continue;
112 }
113 }
115
116
119 &isNull);
120
121 if (isNull)
123
124
125 if (erm->relation->rd_rel->relkind == RELKIND_FOREIGN_TABLE)
126 {
128 bool updated = false;
129
131
134 (errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
135 errmsg("cannot lock rows in foreign table \"%s\"",
137
139 erm,
140 datum,
141 markSlot,
142 &updated);
144 {
145
147 }
148
149
150
151
152
153 if (updated)
154 epq_needed = true;
155
156 continue;
157 }
158
159
162 {
165 break;
168 break;
171 break;
174 break;
175 default:
176 elog(ERROR, "unsupported rowmark type");
178 break;
179 }
180
184
188 lockflags,
189 &tmfd);
190
191 switch (test)
192 {
194
196
198
199
200
201
202
203
204
205
206
207
208
209
210
211
213
215
216
217
218
219
221 epq_needed = true;
222 break;
223
228 errmsg("could not serialize access due to concurrent update")));
229 elog(ERROR, "unexpected table_tuple_lock status: %u",
231 break;
232
237 errmsg("could not serialize access due to concurrent update")));
238
240
242 elog(ERROR, "attempted to lock invisible tuple");
243 break;
244
245 default:
246 elog(ERROR, "unrecognized table_tuple_lock status: %u",
248 }
249
250
252 }
253
254
255
256
257 if (epq_needed)
258 {
259
261
262
263
264
265
267
268
269
270
273 {
274
276 }
277 }
278
279
280 return slot;
281}
282
283
284
285
286
287
288
289
292{
295 List *epq_arowmarks;
297
298
300
301
302
303
306 lrstate->ps.state = estate;
308
309
310
311
312
313
314
315
316
317
318
320
321
322
323
325
326
330
331
332
333
334
336
337
338
339
340
341
343 epq_arowmarks = NIL;
345 {
349
350
351
352
353
354
357 continue;
358
359
362
363
364
365
366
367
368
371 else
372 epq_arowmarks = lappend(epq_arowmarks, aerm);
373 }
374
375
378
379 return lrstate;
380}
381
382
383
384
385
386
387
388
389void
391{
392
395}
396
397
398void
400{
402
403
404
405
406
409}
bool bms_is_member(int x, const Bitmapset *a)
#define OidIsValid(objectId)
int errcode(int sqlerrcode)
int errmsg(const char *fmt,...)
#define ereport(elevel,...)
void ExecReScan(PlanState *node)
ExecRowMark * ExecFindRowMark(EState *estate, Index rti, bool missing_ok)
ExecAuxRowMark * ExecBuildAuxRowMark(ExecRowMark *erm, List *targetlist)
TupleTableSlot * EvalPlanQualSlot(EPQState *epqstate, Relation relation, Index rti)
void EvalPlanQualBegin(EPQState *epqstate)
void EvalPlanQualInit(EPQState *epqstate, EState *parentestate, Plan *subplan, List *auxrowmarks, int epqParam, List *resultRelations)
void EvalPlanQualEnd(EPQState *epqstate)
TupleTableSlot * EvalPlanQualNext(EPQState *epqstate)
void ExecEndNode(PlanState *node)
PlanState * ExecInitNode(Plan *node, EState *estate, int eflags)
void ExecInitResultTypeTL(PlanState *planstate)
const TupleTableSlotOps * ExecGetResultSlotOps(PlanState *planstate, bool *isfixed)
#define outerPlanState(node)
static TupleTableSlot * ExecProcNode(PlanState *node)
#define EvalPlanQualSetSlot(epqstate, slot)
static Datum ExecGetJunkAttribute(TupleTableSlot *slot, AttrNumber attno, bool *isNull)
FdwRoutine * GetFdwRoutineForRelation(Relation relation, bool makecopy)
Assert(PointerIsAligned(start, uint64))
static void ItemPointerSetInvalid(ItemPointerData *pointer)
ItemPointerData * ItemPointer
List * lappend(List *list, void *datum)
@ LockTupleNoKeyExclusive
#define CHECK_FOR_INTERRUPTS()
void ExecReScanLockRows(LockRowsState *node)
static TupleTableSlot * ExecLockRows(PlanState *pstate)
LockRowsState * ExecInitLockRows(LockRows *node, EState *estate, int eflags)
void ExecEndLockRows(LockRowsState *node)
#define castNode(_type_, nodeptr)
#define lfirst_node(type, lc)
static ListCell * lnext(const List *l, const ListCell *c)
#define ERRCODE_T_R_SERIALIZATION_FAILURE
#define RowMarkRequiresRowShareLock(marktype)
@ ROW_MARK_NOKEYEXCLUSIVE
static Oid DatumGetObjectId(Datum X)
static Pointer DatumGetPointer(Datum X)
#define RelationGetRelationName(relation)
Bitmapset * es_unpruned_relids
LockWaitPolicy waitPolicy
RefetchForeignRow_function RefetchForeignRow
const TupleTableSlotOps * resultops
ProjectionInfo * ps_ProjInfo
ExecProcNodeMtd ExecProcNode
static TM_Result table_tuple_lock(Relation rel, ItemPointer tid, Snapshot snapshot, TupleTableSlot *slot, CommandId cid, LockTupleMode mode, LockWaitPolicy wait_policy, uint8 flags, TM_FailureData *tmfd)
#define TUPLE_LOCK_FLAG_FIND_LAST_VERSION
#define TUPLE_LOCK_FLAG_LOCK_UPDATE_IN_PROGRESS
static TupleTableSlot * ExecClearTuple(TupleTableSlot *slot)
#define IsolationUsesXactSnapshot()