本节介绍heapam_tuple_insert函数的代码流程 相关数据结构 结构体中有些成员可能目前难以理解,暂时先列出来,先把当前用到的成员能搞明白就可以。 // src/include/executor/tuptable.h type
本节介绍heapam_tuple_insert函数的代码流程
结构体中有些成员可能目前难以理解,暂时先列出来,先把当前用到的成员能搞明白就可以。
// src/include/executor/tuptable.h
typedef struct TupleTableSlot
{
nodeTag type;
#define FIELDNO_TUPLETABLESLOT_FLAGS 1
uint16 tts_flags;
#define FIELDNO_TUPLETABLESLOT_NVALID 2
AttrNumber tts_nvalid;
const TupleTableSlotOps *const tts_ops;
#define FIELDNO_TUPLETABLESLOT_TUPLEDESCRIPTOR 4
TupleDesc tts_tupleDescriptor;
#define FIELDNO_TUPLETABLESLOT_VALUES 5
Datum *tts_values;
#define FIELDNO_TUPLETABLESLOT_ISNULL 6
bool *tts_isnull;
MemoryContext tts_mcxt;
ItemPointerData tts_tid;
Oid tts_tableOid;
} TupleTableSlot;
static void
heapam_tuple_insert(Relation relation, TupleTableSlot *slot, CommandId cid,
int options, BulkInsertState bistate);
HeapTuple tuple = ExecFetchSlotHeapTuple(slot, true, &shouldFree);
slot->tts_tableOid = RelationGetRelid(relation);
tuple->t_tableOid = slot->tts_tableOid;
heap_insert(relation, tuple, cid, options, bistate);
ItemPointerCopy(&tuple->t_self, &slot->tts_tid);
if (shouldFree)
pfree(tuple);
--结束END--
本文标题: PostgreSQL源码学习--插入数据#3
本文链接: https://lsjlt.com/news/5535.html(转载时请注明来源链接)
有问题或投稿请发送至: 邮箱/279061341@qq.com QQ/279061341
2024-10-23
2024-10-22
2024-10-22
2024-10-22
2024-10-22
2024-10-22
2024-10-22
2024-10-22
2024-10-22
2024-10-22
回答
回答
回答
回答
回答
回答
回答
回答
回答
回答
0