diff options
author | Andres Freund <andres@anarazel.de> | 2019-11-08 00:44:52 -0800 |
---|---|---|
committer | Andres Freund <andres@anarazel.de> | 2019-11-08 11:49:29 -0800 |
commit | aae50236e4ce95c05a3962be0814c74c5a22206d (patch) | |
tree | ab040612da65567def53a6ee17db9b0b54f3037d /src/backend/access/heap/heapam_handler.c | |
parent | 71a8a4f6e36547bb060dbcc961ea9b57420f7190 (diff) | |
download | postgresql-aae50236e4ce95c05a3962be0814c74c5a22206d.tar.gz postgresql-aae50236e4ce95c05a3962be0814c74c5a22206d.zip |
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
Diffstat (limited to 'src/backend/access/heap/heapam_handler.c')
-rw-r--r-- | src/backend/access/heap/heapam_handler.c | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/src/backend/access/heap/heapam_handler.c b/src/backend/access/heap/heapam_handler.c index 2dd8821facd..7081172dcc2 100644 --- a/src/backend/access/heap/heapam_handler.c +++ b/src/backend/access/heap/heapam_handler.c @@ -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); } } |