/* Return true if the given TID is present in the TidStore */
 bool
-TidStoreIsMember(TidStore *ts, ItemPointer tid)
+TidStoreIsMember(TidStore *ts, const ItemPointerData *tid)
 {
    int         wordnum;
    int         bitnum;
 
  * spool an index entry into the sort file.
  */
 void
-_h_spool(HSpool *hspool, ItemPointer self, const Datum *values, const bool *isnull)
+_h_spool(HSpool *hspool, const ItemPointerData *self, const Datum *values, const bool *isnull)
 {
    tuplesort_putindextuplevalues(hspool->sortstate, hspool->index,
                                  self, values, isnull);
 
                                  bool all_visible_cleared, bool new_all_visible_cleared);
 #ifdef USE_ASSERT_CHECKING
 static void check_lock_if_inplace_updateable_rel(Relation relation,
-                                                ItemPointer otid,
+                                                const ItemPointerData *otid,
                                                 HeapTuple newtup);
 static void check_inplace_rel_lock(HeapTuple oldtup);
 #endif
                                           Bitmapset *external_cols,
                                           HeapTuple oldtup, HeapTuple newtup,
                                           bool *has_external);
-static bool heap_acquire_tuplock(Relation relation, ItemPointer tid,
+static bool heap_acquire_tuplock(Relation relation, const ItemPointerData *tid,
                                 LockTupleMode mode, LockWaitPolicy wait_policy,
                                 bool *have_tuple_lock);
 static inline BlockNumber heapgettup_advance_block(HeapScanDesc scan,
                                      TransactionId *result_xmax, uint16 *result_infomask,
                                      uint16 *result_infomask2);
 static TM_Result heap_lock_updated_tuple(Relation rel, HeapTuple tuple,
-                                        ItemPointer ctid, TransactionId xid,
+                                        const ItemPointerData *ctid, TransactionId xid,
                                         LockTupleMode mode);
 static void GetMultiXactIdHintBits(MultiXactId multi, uint16 *new_infomask,
                                   uint16 *new_infomask2);
 static bool DoesMultiXactIdConflict(MultiXactId multi, uint16 infomask,
                                    LockTupleMode lockmode, bool *current_is_member);
 static void MultiXactIdWait(MultiXactId multi, MultiXactStatus status, uint16 infomask,
-                           Relation rel, ItemPointer ctid, XLTW_Oper oper,
+                           Relation rel, const ItemPointerData *ctid, XLTW_Oper oper,
                            int *remaining);
 static bool ConditionalMultiXactIdWait(MultiXactId multi, MultiXactStatus status,
                                       uint16 infomask, Relation rel, int *remaining,
  * generated by another transaction).
  */
 TM_Result
-heap_delete(Relation relation, ItemPointer tid,
+heap_delete(Relation relation, const ItemPointerData *tid,
            CommandId cid, Snapshot crosscheck, bool wait,
            TM_FailureData *tmfd, bool changingPart)
 {
  * via ereport().
  */
 void
-simple_heap_delete(Relation relation, ItemPointer tid)
+simple_heap_delete(Relation relation, const ItemPointerData *tid)
 {
    TM_Result   result;
    TM_FailureData tmfd;
  * generated by another transaction).
  */
 TM_Result
-heap_update(Relation relation, ItemPointer otid, HeapTuple newtup,
+heap_update(Relation relation, const ItemPointerData *otid, HeapTuple newtup,
            CommandId cid, Snapshot crosscheck, bool wait,
            TM_FailureData *tmfd, LockTupleMode *lockmode,
            TU_UpdateIndexes *update_indexes)
  */
 static void
 check_lock_if_inplace_updateable_rel(Relation relation,
-                                    ItemPointer otid,
+                                    const ItemPointerData *otid,
                                     HeapTuple newtup)
 {
    /* LOCKTAG_TUPLE acceptable for any catalog */
  * via ereport().
  */
 void
-simple_heap_update(Relation relation, ItemPointer otid, HeapTuple tup,
+simple_heap_update(Relation relation, const ItemPointerData *otid, HeapTuple tup,
                   TU_UpdateIndexes *update_indexes)
 {
    TM_Result   result;
  * wait_policy is Skip.
  */
 static bool
-heap_acquire_tuplock(Relation relation, ItemPointer tid, LockTupleMode mode,
+heap_acquire_tuplock(Relation relation, const ItemPointerData *tid, LockTupleMode mode,
                     LockWaitPolicy wait_policy, bool *have_tuple_lock)
 {
    if (*have_tuple_lock)
  * version as well.
  */
 static TM_Result
-heap_lock_updated_tuple_rec(Relation rel, ItemPointer tid, TransactionId xid,
+heap_lock_updated_tuple_rec(Relation rel, const ItemPointerData *tid, TransactionId xid,
                            LockTupleMode mode)
 {
    TM_Result   result;
  * levels, because that would lead to a serializability failure.
  */
 static TM_Result
-heap_lock_updated_tuple(Relation rel, HeapTuple tuple, ItemPointer ctid,
+heap_lock_updated_tuple(Relation rel, HeapTuple tuple, const ItemPointerData *ctid,
                        TransactionId xid, LockTupleMode mode)
 {
    /*
  * An explicit confirmation WAL record also makes logical decoding simpler.
  */
 void
-heap_finish_speculative(Relation relation, ItemPointer tid)
+heap_finish_speculative(Relation relation, const ItemPointerData *tid)
 {
    Buffer      buffer;
    Page        page;
  * confirmation records.
  */
 void
-heap_abort_speculative(Relation relation, ItemPointer tid)
+heap_abort_speculative(Relation relation, const ItemPointerData *tid)
 {
    TransactionId xid = GetCurrentTransactionId();
    ItemId      lp;
 static bool
 Do_MultiXactIdWait(MultiXactId multi, MultiXactStatus status,
                   uint16 infomask, bool nowait,
-                  Relation rel, ItemPointer ctid, XLTW_Oper oper,
+                  Relation rel, const ItemPointerData *ctid, XLTW_Oper oper,
                   int *remaining, bool logLockFailure)
 {
    bool        result = true;
  */
 static void
 MultiXactIdWait(MultiXactId multi, MultiXactStatus status, uint16 infomask,
-               Relation rel, ItemPointer ctid, XLTW_Oper oper,
+               Relation rel, const ItemPointerData *ctid, XLTW_Oper oper,
                int *remaining)
 {
    (void) Do_MultiXactIdWait(multi, status, infomask, false,
 static inline void
 index_delete_check_htid(TM_IndexDeleteOp *delstate,
                        Page page, OffsetNumber maxoff,
-                       ItemPointer htid, TM_IndexStatus *istatus)
+                       const ItemPointerData *htid, TM_IndexStatus *istatus)
 {
    OffsetNumber indexpagehoffnum = ItemPointerGetOffsetNumber(htid);
    ItemId      iid;
 
  * returned posting list tuple (they must be included in htids array.)
  */
 IndexTuple
-_bt_form_posting(IndexTuple base, ItemPointer htids, int nhtids)
+_bt_form_posting(IndexTuple base, const ItemPointerData *htids, int nhtids)
 {
    uint32      keysize,
                newsize;
 
 static void _bt_saveitem(BTScanOpaque so, int itemIndex,
                         OffsetNumber offnum, IndexTuple itup);
 static int _bt_setuppostingitems(BTScanOpaque so, int itemIndex,
-                                 OffsetNumber offnum, ItemPointer heapTid,
+                                 OffsetNumber offnum, const ItemPointerData *heapTid,
                                  IndexTuple itup);
 static inline void _bt_savepostingitem(BTScanOpaque so, int itemIndex,
                                       OffsetNumber offnum,
  */
 static int
 _bt_setuppostingitems(BTScanOpaque so, int itemIndex, OffsetNumber offnum,
-                     ItemPointer heapTid, IndexTuple itup)
+                     const ItemPointerData *heapTid, IndexTuple itup)
 {
    BTScanPosItem *currItem = &so->currPos.items[itemIndex];
 
 
 static double _bt_spools_heapscan(Relation heap, Relation index,
                                  BTBuildState *buildstate, IndexInfo *indexInfo);
 static void _bt_spooldestroy(BTSpool *btspool);
-static void _bt_spool(BTSpool *btspool, ItemPointer self,
+static void _bt_spool(BTSpool *btspool, const ItemPointerData *self,
                      Datum *values, bool *isnull);
 static void _bt_leafbuild(BTSpool *btspool, BTSpool *btspool2);
 static void _bt_build_callback(Relation index, ItemPointer tid, Datum *values,
  * spool an index entry into the sort file.
  */
 static void
-_bt_spool(BTSpool *btspool, ItemPointer self, Datum *values, bool *isnull)
+_bt_spool(BTSpool *btspool, const ItemPointerData *self, Datum *values, bool *isnull)
 {
    tuplesort_putindextuplevalues(btspool->sortstate, btspool->index,
                                  self, values, isnull);
 
 static int _bt_splitcmp(const void *arg1, const void *arg2);
 static bool _bt_afternewitemoff(FindSplitData *state, OffsetNumber maxoff,
                                int leaffillfactor, bool *usemult);
-static bool _bt_adjacenthtid(ItemPointer lowhtid, ItemPointer highhtid);
+static bool _bt_adjacenthtid(const ItemPointerData *lowhtid, const ItemPointerData *highhtid);
 static OffsetNumber _bt_bestsplitloc(FindSplitData *state, int perfectpenalty,
                                     bool *newitemonleft, FindSplitStrat strategy);
 static int _bt_defaultinterval(FindSplitData *state);
  * transaction.
  */
 static bool
-_bt_adjacenthtid(ItemPointer lowhtid, ItemPointer highhtid)
+_bt_adjacenthtid(const ItemPointerData *lowhtid, const ItemPointerData *highhtid)
 {
    BlockNumber lowblk,
                highblk;
 
  */
 bool
 spgdoinsert(Relation index, SpGistState *state,
-           ItemPointer heapPtr, Datum *datums, bool *isnulls)
+           const ItemPointerData *heapPtr, Datum *datums, bool *isnulls)
 {
    bool        result = true;
    TupleDesc   leafDescriptor = state->leafTupDesc;
 
  * Construct a leaf tuple containing the given heap TID and datum values
  */
 SpGistLeafTuple
-spgFormLeafTuple(SpGistState *state, ItemPointer heapPtr,
+spgFormLeafTuple(SpGistState *state, const ItemPointerData *heapPtr,
                 const Datum *datums, const bool *isnulls)
 {
    SpGistLeafTuple tup;
 
  * ensures that scans of the list don't miss items added during the scan.
  */
 static void
-spgAddPendingTID(spgBulkDeleteState *bds, ItemPointer tid)
+spgAddPendingTID(spgBulkDeleteState *bds, const ItemPointerData *tid)
 {
    spgVacPendingItem *pitem;
    spgVacPendingItem **listLink;
 
  * (Use CatalogTupleUpdateWithInfo in such cases.)
  */
 void
-CatalogTupleUpdate(Relation heapRel, ItemPointer otid, HeapTuple tup)
+CatalogTupleUpdate(Relation heapRel, const ItemPointerData *otid, HeapTuple tup)
 {
    CatalogIndexState indstate;
    TU_UpdateIndexes updateIndexes = TU_All;
  * so that callers needn't trouble over this ... but we don't do so today.
  */
 void
-CatalogTupleUpdateWithInfo(Relation heapRel, ItemPointer otid, HeapTuple tup,
+CatalogTupleUpdateWithInfo(Relation heapRel, const ItemPointerData *otid, HeapTuple tup,
                           CatalogIndexState indstate)
 {
    TU_UpdateIndexes updateIndexes = TU_All;
  * it might be better to do something about caching CatalogIndexState.
  */
 void
-CatalogTupleDelete(Relation heapRel, ItemPointer tid)
+CatalogTupleDelete(Relation heapRel, const ItemPointerData *tid)
 {
    simple_heap_delete(heapRel, tid);
 }
 
 
 static bool check_exclusion_or_unique_constraint(Relation heap, Relation index,
                                                 IndexInfo *indexInfo,
-                                                ItemPointer tupleid,
+                                                const ItemPointerData *tupleid,
                                                 const Datum *values, const bool *isnull,
                                                 EState *estate, bool newIndex,
                                                 CEOUC_WAIT_MODE waitMode,
 bool
 ExecCheckIndexConstraints(ResultRelInfo *resultRelInfo, TupleTableSlot *slot,
                          EState *estate, ItemPointer conflictTid,
-                         ItemPointer tupleid, List *arbiterIndexes)
+                         const ItemPointerData *tupleid, List *arbiterIndexes)
 {
    int         i;
    int         numIndices;
 static bool
 check_exclusion_or_unique_constraint(Relation heap, Relation index,
                                     IndexInfo *indexInfo,
-                                    ItemPointer tupleid,
+                                    const ItemPointerData *tupleid,
                                     const Datum *values, const bool *isnull,
                                     EState *estate, bool newIndex,
                                     CEOUC_WAIT_MODE waitMode,
 void
 check_exclusion_constraint(Relation heap, Relation index,
                           IndexInfo *indexInfo,
-                          ItemPointer tupleid,
+                          const ItemPointerData *tupleid,
                           const Datum *values, const bool *isnull,
                           EState *estate, bool newIndex)
 {
 
  *     PredicateLockRelation(Relation relation, Snapshot snapshot)
  *     PredicateLockPage(Relation relation, BlockNumber blkno,
  *                     Snapshot snapshot)
- *     PredicateLockTID(Relation relation, ItemPointer tid, Snapshot snapshot,
+ *     PredicateLockTID(Relation relation, const ItemPointerData *tid, Snapshot snapshot,
  *                      TransactionId tuple_xid)
  *     PredicateLockPageSplit(Relation relation, BlockNumber oldblkno,
  *                            BlockNumber newblkno)
  * conflict detection (may also trigger rollback)
  *     CheckForSerializableConflictOut(Relation relation, TransactionId xid,
  *                                     Snapshot snapshot)
- *     CheckForSerializableConflictIn(Relation relation, ItemPointer tid,
+ *     CheckForSerializableConflictIn(Relation relation, const ItemPointerData *tid,
  *                                    BlockNumber blkno)
  *     CheckTableForSerializableConflictIn(Relation relation)
  *
  * Skip if this is a temporary table.
  */
 void
-PredicateLockTID(Relation relation, ItemPointer tid, Snapshot snapshot,
+PredicateLockTID(Relation relation, const ItemPointerData *tid, Snapshot snapshot,
                 TransactionId tuple_xid)
 {
    PREDICATELOCKTARGETTAG tag;
  * tuple itself.
  */
 void
-CheckForSerializableConflictIn(Relation relation, ItemPointer tid, BlockNumber blkno)
+CheckForSerializableConflictIn(Relation relation, const ItemPointerData *tid, BlockNumber blkno)
 {
    PREDICATELOCKTARGETTAG targettag;
 
 
 #define DELIM          ','
 #define NTIDARGS       2
 
-static ItemPointer currtid_for_view(Relation viewrel, ItemPointer tid);
+static ItemPointer currtid_for_view(Relation viewrel, const ItemPointerData *tid);
 
 /* ----------------------------------------------------------------
  *     tidin
  *     relation "rel".
  */
 static ItemPointer
-currtid_internal(Relation rel, ItemPointer tid)
+currtid_internal(Relation rel, const ItemPointerData *tid)
 {
    ItemPointer result;
    AclResult   aclresult;
  *     correspond to the CTID of a base relation.
  */
 static ItemPointer
-currtid_for_view(Relation viewrel, ItemPointer tid)
+currtid_for_view(Relation viewrel, const ItemPointerData *tid)
 {
    TupleDesc   att = RelationGetDescr(viewrel);
    RuleLock   *rulelock;
 
  */
 void
 tuplesort_putindextuplevalues(Tuplesortstate *state, Relation rel,
-                             ItemPointer self, const Datum *values,
+                             const ItemPointerData *self, const Datum *values,
                              const bool *isnull)
 {
    SortTuple   stup;
 
 
 extern HSpool *_h_spoolinit(Relation heap, Relation index, uint32 num_buckets);
 extern void _h_spooldestroy(HSpool *hspool);
-extern void _h_spool(HSpool *hspool, ItemPointer self,
+extern void _h_spool(HSpool *hspool, const ItemPointerData *self,
                     const Datum *values, const bool *isnull);
 extern void _h_indexbuild(HSpool *hspool, Relation heapRel);
 
 
 extern void heap_multi_insert(Relation relation, TupleTableSlot **slots,
                              int ntuples, CommandId cid, int options,
                              BulkInsertState bistate);
-extern TM_Result heap_delete(Relation relation, ItemPointer tid,
+extern TM_Result heap_delete(Relation relation, const ItemPointerData *tid,
                             CommandId cid, Snapshot crosscheck, bool wait,
                             TM_FailureData *tmfd, bool changingPart);
-extern void heap_finish_speculative(Relation relation, ItemPointer tid);
-extern void heap_abort_speculative(Relation relation, ItemPointer tid);
-extern TM_Result heap_update(Relation relation, ItemPointer otid,
+extern void heap_finish_speculative(Relation relation, const ItemPointerData *tid);
+extern void heap_abort_speculative(Relation relation, const ItemPointerData *tid);
+extern TM_Result heap_update(Relation relation, const ItemPointerData *otid,
                             HeapTuple newtup,
                             CommandId cid, Snapshot crosscheck, bool wait,
                             TM_FailureData *tmfd, LockTupleMode *lockmode,
 extern bool heap_tuple_needs_eventual_freeze(HeapTupleHeader tuple);
 
 extern void simple_heap_insert(Relation relation, HeapTuple tup);
-extern void simple_heap_delete(Relation relation, ItemPointer tid);
-extern void simple_heap_update(Relation relation, ItemPointer otid,
+extern void simple_heap_delete(Relation relation, const ItemPointerData *tid);
+extern void simple_heap_update(Relation relation, const ItemPointerData *otid,
                               HeapTuple tup, TU_UpdateIndexes *update_indexes);
 
 extern TransactionId heap_index_delete_tuples(Relation rel,
 
                                    OffsetNumber baseoff);
 extern bool _bt_dedup_save_htid(BTDedupState state, IndexTuple itup);
 extern Size _bt_dedup_finish_pending(Page newpage, BTDedupState state);
-extern IndexTuple _bt_form_posting(IndexTuple base, ItemPointer htids,
+extern IndexTuple _bt_form_posting(IndexTuple base, const ItemPointerData *htids,
                                   int nhtids);
 extern void _bt_update_posting(BTVacuumPosting vacposting);
 extern IndexTuple _bt_swap_posting(IndexTuple newitem, IndexTuple oposting,
 
 extern Size SpGistGetLeafTupleSize(TupleDesc tupleDescriptor,
                                   const Datum *datums, const bool *isnulls);
 extern SpGistLeafTuple spgFormLeafTuple(SpGistState *state,
-                                       ItemPointer heapPtr,
+                                       const ItemPointerData *heapPtr,
                                        const Datum *datums, const bool *isnulls);
 extern SpGistNodeTuple spgFormNodeTuple(SpGistState *state,
                                        Datum label, bool isnull);
                                    int firststate, int reststate,
                                    BlockNumber blkno, OffsetNumber offnum);
 extern bool spgdoinsert(Relation index, SpGistState *state,
-                       ItemPointer heapPtr, Datum *datums, bool *isnulls);
+                       const ItemPointerData *heapPtr, Datum *datums, bool *isnulls);
 
 /* spgproc.c */
 extern double *spg_key_orderbys_distances(Datum key, bool isLeaf,
 
 extern void TidStoreDestroy(TidStore *ts);
 extern void TidStoreSetBlockOffsets(TidStore *ts, BlockNumber blkno, OffsetNumber *offsets,
                                    int num_offsets);
-extern bool TidStoreIsMember(TidStore *ts, ItemPointer tid);
+extern bool TidStoreIsMember(TidStore *ts, const ItemPointerData *tid);
 extern TidStoreIter *TidStoreBeginIterate(TidStore *ts);
 extern TidStoreIterResult *TidStoreIterateNext(TidStoreIter *iter);
 extern int TidStoreGetBlockOffsets(TidStoreIterResult *result,
 
  * As noted in validate_index(), this can be significantly faster.
  */
 static inline int64
-itemptr_encode(ItemPointer itemptr)
+itemptr_encode(const ItemPointerData *itemptr)
 {
    BlockNumber block = ItemPointerGetBlockNumber(itemptr);
    OffsetNumber offset = ItemPointerGetOffsetNumber(itemptr);
 
                                             TupleTableSlot **slot,
                                             int ntuples,
                                             CatalogIndexState indstate);
-extern void CatalogTupleUpdate(Relation heapRel, ItemPointer otid,
+extern void CatalogTupleUpdate(Relation heapRel, const ItemPointerData *otid,
                               HeapTuple tup);
 extern void CatalogTupleUpdateWithInfo(Relation heapRel,
-                                      ItemPointer otid, HeapTuple tup,
+                                      const ItemPointerData *otid, HeapTuple tup,
                                       CatalogIndexState indstate);
-extern void CatalogTupleDelete(Relation heapRel, ItemPointer tid);
+extern void CatalogTupleDelete(Relation heapRel, const ItemPointerData *tid);
 
 #endif                         /* INDEXING_H */
 
 extern bool ExecCheckIndexConstraints(ResultRelInfo *resultRelInfo,
                                      TupleTableSlot *slot,
                                      EState *estate, ItemPointer conflictTid,
-                                     ItemPointer tupleid,
+                                     const ItemPointerData *tupleid,
                                      List *arbiterIndexes);
 extern void check_exclusion_constraint(Relation heap, Relation index,
                                       IndexInfo *indexInfo,
-                                      ItemPointer tupleid,
+                                      const ItemPointerData *tupleid,
                                       const Datum *values, const bool *isnull,
                                       EState *estate, bool newIndex);
 
 
 extern void RegisterPredicateLockingXid(TransactionId xid);
 extern void PredicateLockRelation(Relation relation, Snapshot snapshot);
 extern void PredicateLockPage(Relation relation, BlockNumber blkno, Snapshot snapshot);
-extern void PredicateLockTID(Relation relation, ItemPointer tid, Snapshot snapshot,
+extern void PredicateLockTID(Relation relation, const ItemPointerData *tid, Snapshot snapshot,
                             TransactionId tuple_xid);
 extern void PredicateLockPageSplit(Relation relation, BlockNumber oldblkno, BlockNumber newblkno);
 extern void PredicateLockPageCombine(Relation relation, BlockNumber oldblkno, BlockNumber newblkno);
 /* conflict detection (may also trigger rollback) */
 extern bool CheckForSerializableConflictOutNeeded(Relation relation, Snapshot snapshot);
 extern void CheckForSerializableConflictOut(Relation relation, TransactionId xid, Snapshot snapshot);
-extern void CheckForSerializableConflictIn(Relation relation, ItemPointer tid, BlockNumber blkno);
+extern void CheckForSerializableConflictIn(Relation relation, const ItemPointerData *tid, BlockNumber blkno);
 extern void CheckTableForSerializableConflictIn(Relation relation);
 
 /* final rollback checking */
 
                                   TupleTableSlot *slot);
 extern void tuplesort_putheaptuple(Tuplesortstate *state, HeapTuple tup);
 extern void tuplesort_putindextuplevalues(Tuplesortstate *state,
-                                         Relation rel, ItemPointer self,
+                                         Relation rel, const ItemPointerData *self,
                                          const Datum *values, const bool *isnull);
 extern void tuplesort_putbrintuple(Tuplesortstate *state, BrinTuple *tuple, Size size);
 extern void tuplesort_putgintuple(Tuplesortstate *state, GinTuple *tuple, Size size);