MCPcopy Create free account
hub / github.com/apache/cloudberry / ExecInsertIndexTuples

Function ExecInsertIndexTuples

src/backend/executor/execIndexing.c:286–489  ·  view source on GitHub ↗

---------------------------------------------------------------- * ExecInsertIndexTuples * * This routine takes care of inserting index tuples * into all the relations indexing the result relation * when a heap tuple is inserted into the result relation. * * When 'update' is true, executor is performing an UPDATE * that could not use an optimization like heapam's HOT (in * more gen

Source from the content-addressed store, hash-verified

284 * ----------------------------------------------------------------
285 */
286List *
287ExecInsertIndexTuples(ResultRelInfo *resultRelInfo,
288 TupleTableSlot *slot,
289 EState *estate,
290 bool update,
291 bool noDupErr,
292 bool *specConflict,
293 List *arbiterIndexes)
294{
295 ItemPointer tupleid = &slot->tts_tid;
296 List *result = NIL;
297 int i;
298 int numIndices;
299 RelationPtr relationDescs;
300 Relation heapRelation;
301 IndexInfo **indexInfoArray;
302 ExprContext *econtext;
303 Datum values[INDEX_MAX_KEYS];
304 bool isnull[INDEX_MAX_KEYS];
305
306 Assert(ItemPointerIsValid(tupleid));
307
308 /*
309 * Get information from the result relation info structure.
310 */
311 numIndices = resultRelInfo->ri_NumIndices;
312 relationDescs = resultRelInfo->ri_IndexRelationDescs;
313 indexInfoArray = resultRelInfo->ri_IndexRelationInfo;
314 heapRelation = resultRelInfo->ri_RelationDesc;
315
316 /* Sanity check: slot must belong to the same rel as the resultRelInfo. */
317 Assert(slot->tts_tableOid == RelationGetRelid(heapRelation));
318
319 /*
320 * We will use the EState's per-tuple context for evaluating predicates
321 * and index expressions (creating it if it's not already there).
322 */
323 econtext = GetPerTupleExprContext(estate);
324
325 /* Arrange for econtext's scan tuple to be the tuple under test */
326 econtext->ecxt_scantuple = slot;
327
328 /*
329 * for each index, form and insert the index tuple
330 */
331 for (i = 0; i < numIndices; i++)
332 {
333 Relation indexRelation = relationDescs[i];
334 IndexInfo *indexInfo;
335 bool applyNoDupErr;
336 IndexUniqueCheck checkUnique;
337 bool indexUnchanged;
338 bool satisfiesConstraint;
339
340 if (indexRelation == NULL)
341 continue;
342
343 indexInfo = indexInfoArray[i];

Callers 10

UpdateIndexMethod · 0.85
CopyFromDirectoryTableFunction · 0.85
CopyFromFunction · 0.85
AppendOnlyMoveTupleFunction · 0.85
AOCSMoveTupleFunction · 0.85
ExecSimpleRelationInsertFunction · 0.85
ExecSimpleRelationUpdateFunction · 0.85
ExecInsertFunction · 0.85
ExecUpdateFunction · 0.85

Calls 7

ExecPrepareQualFunction · 0.85
ExecQualFunction · 0.85
FormIndexDatumFunction · 0.85
list_member_oidFunction · 0.85
index_insertFunction · 0.85
lappend_oidFunction · 0.85

Tested by

no test coverage detected