mirror of
https://github.com/postgres/postgres.git
synced 2025-07-12 21:01:52 +03:00
Pass ItemPointer not HeapTuple to IndexBuildCallback.
Not all AMs use HeapTuples internally, making it inconvenient to pass a HeapTuple. As the index callbacks really only need the TID, not the full tuple, modify callback to only take ItemPointer. Author: Ashwin Agrawal Reviewed-By: Andres Freund Discussion: https://postgr.es/m/CALfoeis6=8ehuR=VNtHvj3z16cYfCwPdTcpaxU+sfSUJ5QgR3g@mail.gmail.com
This commit is contained in:
@ -1636,10 +1636,9 @@ heapam_index_build_range_scan(Relation heapRelation,
|
||||
* For a heap-only tuple, pretend its TID is that of the root. See
|
||||
* src/backend/access/heap/README.HOT for discussion.
|
||||
*/
|
||||
HeapTupleData rootTuple;
|
||||
ItemPointerData tid;
|
||||
OffsetNumber offnum;
|
||||
|
||||
rootTuple = *heapTuple;
|
||||
offnum = ItemPointerGetOffsetNumber(&heapTuple->t_self);
|
||||
|
||||
if (!OffsetNumberIsValid(root_offsets[offnum - 1]))
|
||||
@ -1650,18 +1649,18 @@ heapam_index_build_range_scan(Relation heapRelation,
|
||||
offnum,
|
||||
RelationGetRelationName(heapRelation))));
|
||||
|
||||
ItemPointerSetOffsetNumber(&rootTuple.t_self,
|
||||
root_offsets[offnum - 1]);
|
||||
ItemPointerSet(&tid, ItemPointerGetBlockNumber(&heapTuple->t_self),
|
||||
root_offsets[offnum - 1]);
|
||||
|
||||
/* Call the AM's callback routine to process the tuple */
|
||||
callback(indexRelation, &rootTuple, values, isnull, tupleIsAlive,
|
||||
callback(indexRelation, &tid, values, isnull, tupleIsAlive,
|
||||
callback_state);
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Call the AM's callback routine to process the tuple */
|
||||
callback(indexRelation, heapTuple, values, isnull, tupleIsAlive,
|
||||
callback_state);
|
||||
callback(indexRelation, &heapTuple->t_self, values, isnull,
|
||||
tupleIsAlive, callback_state);
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user