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

Function ExecResetTupleTable

src/backend/executor/execTuples.c:1207–1243  ·  view source on GitHub ↗

-------------------------------- * ExecResetTupleTable * * This releases any resources (buffer pins, tupdesc refcounts) * held by the tuple table, and optionally releases the memory * occupied by the tuple table data structure. * It is expected that this routine be called by ExecEndPlan(). * -------------------------------- */

Source from the content-addressed store, hash-verified

1205 * --------------------------------
1206 */
1207void
1208ExecResetTupleTable(List *tupleTable, /* tuple table */
1209 bool shouldFree) /* true if we should free memory */
1210{
1211 ListCell *lc;
1212
1213 foreach(lc, tupleTable)
1214 {
1215 TupleTableSlot *slot = lfirst_node(TupleTableSlot, lc);
1216
1217 /* Always release resources and reset the slot to empty */
1218 ExecClearTuple(slot);
1219 slot->tts_ops->release(slot);
1220 if (slot->tts_tupleDescriptor)
1221 {
1222 ReleaseTupleDesc(slot->tts_tupleDescriptor);
1223 slot->tts_tupleDescriptor = NULL;
1224 }
1225
1226 /* If shouldFree, release memory occupied by the slot itself */
1227 if (shouldFree)
1228 {
1229 if (!TTS_FIXED(slot))
1230 {
1231 if (slot->tts_values)
1232 pfree(slot->tts_values);
1233 if (slot->tts_isnull)
1234 pfree(slot->tts_isnull);
1235 }
1236 pfree(slot);
1237 }
1238 }
1239
1240 /* If shouldFree, release the list structure */
1241 if (shouldFree)
1242 list_free(tupleTable);
1243}
1244
1245/* --------------------------------
1246 * MakeSingleTupleTableSlot

Callers 8

afterTriggerInvokeEventsFunction · 0.85
CopyFromDirectoryTableFunction · 0.85
CopyFromFunction · 0.85
finish_edataFunction · 0.85
ExecEndPlanFunction · 0.85
EvalPlanQualEndFunction · 0.85
endCurrentIndexScanFunction · 0.85

Calls 5

ExecClearTupleFunction · 0.85
foreachFunction · 0.50
pfreeFunction · 0.50
list_freeFunction · 0.50
releaseMethod · 0.45

Tested by

no test coverage detected