1
0
mirror of https://github.com/postgres/postgres.git synced 2025-11-06 07:49:08 +03:00

Mark ItemPointer arguments as const throughout

This is a follow up 991295f.  I searched over src/ and made all
ItemPointer arguments as const as much as possible.

Note: We cut out from the original patch the pieces that would have
created incompatibilities in the index or table AM APIs.  Those could
be considered separately.

Author: Chao Li <li.evan.chao@gmail.com>
Discussion: https://www.postgresql.org/message-id/CAEoWx2nBaypg16Z5ciHuKw66pk850RFWw9ACS2DqqJ_AkKeRsw%40mail.gmail.com
This commit is contained in:
Peter Eisentraut
2025-10-30 14:10:39 +01:00
parent a27c40bfe8
commit e1ac846f3d
25 changed files with 64 additions and 64 deletions

View File

@@ -418,7 +418,7 @@ TidStoreSetBlockOffsets(TidStore *ts, BlockNumber blkno, OffsetNumber *offsets,
/* Return true if the given TID is present in the TidStore */ /* Return true if the given TID is present in the TidStore */
bool bool
TidStoreIsMember(TidStore *ts, ItemPointer tid) TidStoreIsMember(TidStore *ts, const ItemPointerData *tid)
{ {
int wordnum; int wordnum;
int bitnum; int bitnum;

View File

@@ -106,7 +106,7 @@ _h_spooldestroy(HSpool *hspool)
* spool an index entry into the sort file. * spool an index entry into the sort file.
*/ */
void 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, tuplesort_putindextuplevalues(hspool->sortstate, hspool->index,
self, values, isnull); self, values, isnull);

View File

@@ -63,7 +63,7 @@ static XLogRecPtr log_heap_update(Relation reln, Buffer oldbuf,
bool all_visible_cleared, bool new_all_visible_cleared); bool all_visible_cleared, bool new_all_visible_cleared);
#ifdef USE_ASSERT_CHECKING #ifdef USE_ASSERT_CHECKING
static void check_lock_if_inplace_updateable_rel(Relation relation, static void check_lock_if_inplace_updateable_rel(Relation relation,
ItemPointer otid, const ItemPointerData *otid,
HeapTuple newtup); HeapTuple newtup);
static void check_inplace_rel_lock(HeapTuple oldtup); static void check_inplace_rel_lock(HeapTuple oldtup);
#endif #endif
@@ -72,7 +72,7 @@ static Bitmapset *HeapDetermineColumnsInfo(Relation relation,
Bitmapset *external_cols, Bitmapset *external_cols,
HeapTuple oldtup, HeapTuple newtup, HeapTuple oldtup, HeapTuple newtup,
bool *has_external); 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, LockTupleMode mode, LockWaitPolicy wait_policy,
bool *have_tuple_lock); bool *have_tuple_lock);
static inline BlockNumber heapgettup_advance_block(HeapScanDesc scan, static inline BlockNumber heapgettup_advance_block(HeapScanDesc scan,
@@ -86,7 +86,7 @@ static void compute_new_xmax_infomask(TransactionId xmax, uint16 old_infomask,
TransactionId *result_xmax, uint16 *result_infomask, TransactionId *result_xmax, uint16 *result_infomask,
uint16 *result_infomask2); uint16 *result_infomask2);
static TM_Result heap_lock_updated_tuple(Relation rel, HeapTuple tuple, static TM_Result heap_lock_updated_tuple(Relation rel, HeapTuple tuple,
ItemPointer ctid, TransactionId xid, const ItemPointerData *ctid, TransactionId xid,
LockTupleMode mode); LockTupleMode mode);
static void GetMultiXactIdHintBits(MultiXactId multi, uint16 *new_infomask, static void GetMultiXactIdHintBits(MultiXactId multi, uint16 *new_infomask,
uint16 *new_infomask2); uint16 *new_infomask2);
@@ -95,7 +95,7 @@ static TransactionId MultiXactIdGetUpdateXid(TransactionId xmax,
static bool DoesMultiXactIdConflict(MultiXactId multi, uint16 infomask, static bool DoesMultiXactIdConflict(MultiXactId multi, uint16 infomask,
LockTupleMode lockmode, bool *current_is_member); LockTupleMode lockmode, bool *current_is_member);
static void MultiXactIdWait(MultiXactId multi, MultiXactStatus status, uint16 infomask, 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); int *remaining);
static bool ConditionalMultiXactIdWait(MultiXactId multi, MultiXactStatus status, static bool ConditionalMultiXactIdWait(MultiXactId multi, MultiXactStatus status,
uint16 infomask, Relation rel, int *remaining, uint16 infomask, Relation rel, int *remaining,
@@ -2786,7 +2786,7 @@ xmax_infomask_changed(uint16 new_infomask, uint16 old_infomask)
* generated by another transaction). * generated by another transaction).
*/ */
TM_Result TM_Result
heap_delete(Relation relation, ItemPointer tid, heap_delete(Relation relation, const ItemPointerData *tid,
CommandId cid, Snapshot crosscheck, bool wait, CommandId cid, Snapshot crosscheck, bool wait,
TM_FailureData *tmfd, bool changingPart) TM_FailureData *tmfd, bool changingPart)
{ {
@@ -3209,7 +3209,7 @@ l1:
* via ereport(). * via ereport().
*/ */
void void
simple_heap_delete(Relation relation, ItemPointer tid) simple_heap_delete(Relation relation, const ItemPointerData *tid)
{ {
TM_Result result; TM_Result result;
TM_FailureData tmfd; TM_FailureData tmfd;
@@ -3255,7 +3255,7 @@ simple_heap_delete(Relation relation, ItemPointer tid)
* generated by another transaction). * generated by another transaction).
*/ */
TM_Result 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, CommandId cid, Snapshot crosscheck, bool wait,
TM_FailureData *tmfd, LockTupleMode *lockmode, TM_FailureData *tmfd, LockTupleMode *lockmode,
TU_UpdateIndexes *update_indexes) TU_UpdateIndexes *update_indexes)
@@ -4238,7 +4238,7 @@ l2:
*/ */
static void static void
check_lock_if_inplace_updateable_rel(Relation relation, check_lock_if_inplace_updateable_rel(Relation relation,
ItemPointer otid, const ItemPointerData *otid,
HeapTuple newtup) HeapTuple newtup)
{ {
/* LOCKTAG_TUPLE acceptable for any catalog */ /* LOCKTAG_TUPLE acceptable for any catalog */
@@ -4499,7 +4499,7 @@ HeapDetermineColumnsInfo(Relation relation,
* via ereport(). * via ereport().
*/ */
void void
simple_heap_update(Relation relation, ItemPointer otid, HeapTuple tup, simple_heap_update(Relation relation, const ItemPointerData *otid, HeapTuple tup,
TU_UpdateIndexes *update_indexes) TU_UpdateIndexes *update_indexes)
{ {
TM_Result result; TM_Result result;
@@ -5285,7 +5285,7 @@ out_unlocked:
* wait_policy is Skip. * wait_policy is Skip.
*/ */
static bool 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) LockWaitPolicy wait_policy, bool *have_tuple_lock)
{ {
if (*have_tuple_lock) if (*have_tuple_lock)
@@ -5706,7 +5706,7 @@ test_lockmode_for_conflict(MultiXactStatus status, TransactionId xid,
* version as well. * version as well.
*/ */
static TM_Result 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) LockTupleMode mode)
{ {
TM_Result result; TM_Result result;
@@ -6051,7 +6051,7 @@ out_unlocked:
* levels, because that would lead to a serializability failure. * levels, because that would lead to a serializability failure.
*/ */
static TM_Result 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) TransactionId xid, LockTupleMode mode)
{ {
/* /*
@@ -6096,7 +6096,7 @@ heap_lock_updated_tuple(Relation rel, HeapTuple tuple, ItemPointer ctid,
* An explicit confirmation WAL record also makes logical decoding simpler. * An explicit confirmation WAL record also makes logical decoding simpler.
*/ */
void void
heap_finish_speculative(Relation relation, ItemPointer tid) heap_finish_speculative(Relation relation, const ItemPointerData *tid)
{ {
Buffer buffer; Buffer buffer;
Page page; Page page;
@@ -6183,7 +6183,7 @@ heap_finish_speculative(Relation relation, ItemPointer tid)
* confirmation records. * confirmation records.
*/ */
void void
heap_abort_speculative(Relation relation, ItemPointer tid) heap_abort_speculative(Relation relation, const ItemPointerData *tid)
{ {
TransactionId xid = GetCurrentTransactionId(); TransactionId xid = GetCurrentTransactionId();
ItemId lp; ItemId lp;
@@ -7705,7 +7705,7 @@ DoesMultiXactIdConflict(MultiXactId multi, uint16 infomask,
static bool static bool
Do_MultiXactIdWait(MultiXactId multi, MultiXactStatus status, Do_MultiXactIdWait(MultiXactId multi, MultiXactStatus status,
uint16 infomask, bool nowait, uint16 infomask, bool nowait,
Relation rel, ItemPointer ctid, XLTW_Oper oper, Relation rel, const ItemPointerData *ctid, XLTW_Oper oper,
int *remaining, bool logLockFailure) int *remaining, bool logLockFailure)
{ {
bool result = true; bool result = true;
@@ -7782,7 +7782,7 @@ Do_MultiXactIdWait(MultiXactId multi, MultiXactStatus status,
*/ */
static void static void
MultiXactIdWait(MultiXactId multi, MultiXactStatus status, uint16 infomask, MultiXactIdWait(MultiXactId multi, MultiXactStatus status, uint16 infomask,
Relation rel, ItemPointer ctid, XLTW_Oper oper, Relation rel, const ItemPointerData *ctid, XLTW_Oper oper,
int *remaining) int *remaining)
{ {
(void) Do_MultiXactIdWait(multi, status, infomask, false, (void) Do_MultiXactIdWait(multi, status, infomask, false,
@@ -8068,7 +8068,7 @@ index_delete_prefetch_buffer(Relation rel,
static inline void static inline void
index_delete_check_htid(TM_IndexDeleteOp *delstate, index_delete_check_htid(TM_IndexDeleteOp *delstate,
Page page, OffsetNumber maxoff, Page page, OffsetNumber maxoff,
ItemPointer htid, TM_IndexStatus *istatus) const ItemPointerData *htid, TM_IndexStatus *istatus)
{ {
OffsetNumber indexpagehoffnum = ItemPointerGetOffsetNumber(htid); OffsetNumber indexpagehoffnum = ItemPointerGetOffsetNumber(htid);
ItemId iid; ItemId iid;

View File

@@ -859,7 +859,7 @@ _bt_singleval_fillfactor(Page page, BTDedupState state, Size newitemsz)
* returned posting list tuple (they must be included in htids array.) * returned posting list tuple (they must be included in htids array.)
*/ */
IndexTuple IndexTuple
_bt_form_posting(IndexTuple base, ItemPointer htids, int nhtids) _bt_form_posting(IndexTuple base, const ItemPointerData *htids, int nhtids)
{ {
uint32 keysize, uint32 keysize,
newsize; newsize;

View File

@@ -37,7 +37,7 @@ static bool _bt_readpage(IndexScanDesc scan, ScanDirection dir,
static void _bt_saveitem(BTScanOpaque so, int itemIndex, static void _bt_saveitem(BTScanOpaque so, int itemIndex,
OffsetNumber offnum, IndexTuple itup); OffsetNumber offnum, IndexTuple itup);
static int _bt_setuppostingitems(BTScanOpaque so, int itemIndex, static int _bt_setuppostingitems(BTScanOpaque so, int itemIndex,
OffsetNumber offnum, ItemPointer heapTid, OffsetNumber offnum, const ItemPointerData *heapTid,
IndexTuple itup); IndexTuple itup);
static inline void _bt_savepostingitem(BTScanOpaque so, int itemIndex, static inline void _bt_savepostingitem(BTScanOpaque so, int itemIndex,
OffsetNumber offnum, OffsetNumber offnum,
@@ -2079,7 +2079,7 @@ _bt_saveitem(BTScanOpaque so, int itemIndex,
*/ */
static int static int
_bt_setuppostingitems(BTScanOpaque so, int itemIndex, OffsetNumber offnum, _bt_setuppostingitems(BTScanOpaque so, int itemIndex, OffsetNumber offnum,
ItemPointer heapTid, IndexTuple itup) const ItemPointerData *heapTid, IndexTuple itup)
{ {
BTScanPosItem *currItem = &so->currPos.items[itemIndex]; BTScanPosItem *currItem = &so->currPos.items[itemIndex];

View File

@@ -257,7 +257,7 @@ typedef struct BTWriteState
static double _bt_spools_heapscan(Relation heap, Relation index, static double _bt_spools_heapscan(Relation heap, Relation index,
BTBuildState *buildstate, IndexInfo *indexInfo); BTBuildState *buildstate, IndexInfo *indexInfo);
static void _bt_spooldestroy(BTSpool *btspool); 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); Datum *values, bool *isnull);
static void _bt_leafbuild(BTSpool *btspool, BTSpool *btspool2); static void _bt_leafbuild(BTSpool *btspool, BTSpool *btspool2);
static void _bt_build_callback(Relation index, ItemPointer tid, Datum *values, static void _bt_build_callback(Relation index, ItemPointer tid, Datum *values,
@@ -525,7 +525,7 @@ _bt_spooldestroy(BTSpool *btspool)
* spool an index entry into the sort file. * spool an index entry into the sort file.
*/ */
static void 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, tuplesort_putindextuplevalues(btspool->sortstate, btspool->index,
self, values, isnull); self, values, isnull);

View File

@@ -69,7 +69,7 @@ static void _bt_deltasortsplits(FindSplitData *state, double fillfactormult,
static int _bt_splitcmp(const void *arg1, const void *arg2); static int _bt_splitcmp(const void *arg1, const void *arg2);
static bool _bt_afternewitemoff(FindSplitData *state, OffsetNumber maxoff, static bool _bt_afternewitemoff(FindSplitData *state, OffsetNumber maxoff,
int leaffillfactor, bool *usemult); 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, static OffsetNumber _bt_bestsplitloc(FindSplitData *state, int perfectpenalty,
bool *newitemonleft, FindSplitStrat strategy); bool *newitemonleft, FindSplitStrat strategy);
static int _bt_defaultinterval(FindSplitData *state); static int _bt_defaultinterval(FindSplitData *state);
@@ -747,7 +747,7 @@ _bt_afternewitemoff(FindSplitData *state, OffsetNumber maxoff,
* transaction. * transaction.
*/ */
static bool static bool
_bt_adjacenthtid(ItemPointer lowhtid, ItemPointer highhtid) _bt_adjacenthtid(const ItemPointerData *lowhtid, const ItemPointerData *highhtid)
{ {
BlockNumber lowblk, BlockNumber lowblk,
highblk; highblk;

View File

@@ -1908,7 +1908,7 @@ spgSplitNodeAction(Relation index, SpGistState *state,
*/ */
bool bool
spgdoinsert(Relation index, SpGistState *state, spgdoinsert(Relation index, SpGistState *state,
ItemPointer heapPtr, Datum *datums, bool *isnulls) const ItemPointerData *heapPtr, Datum *datums, bool *isnulls)
{ {
bool result = true; bool result = true;
TupleDesc leafDescriptor = state->leafTupDesc; TupleDesc leafDescriptor = state->leafTupDesc;

View File

@@ -868,7 +868,7 @@ SpGistGetLeafTupleSize(TupleDesc tupleDescriptor,
* Construct a leaf tuple containing the given heap TID and datum values * Construct a leaf tuple containing the given heap TID and datum values
*/ */
SpGistLeafTuple SpGistLeafTuple
spgFormLeafTuple(SpGistState *state, ItemPointer heapPtr, spgFormLeafTuple(SpGistState *state, const ItemPointerData *heapPtr,
const Datum *datums, const bool *isnulls) const Datum *datums, const bool *isnulls)
{ {
SpGistLeafTuple tup; SpGistLeafTuple tup;

View File

@@ -61,7 +61,7 @@ typedef struct spgBulkDeleteState
* ensures that scans of the list don't miss items added during the scan. * ensures that scans of the list don't miss items added during the scan.
*/ */
static void static void
spgAddPendingTID(spgBulkDeleteState *bds, ItemPointer tid) spgAddPendingTID(spgBulkDeleteState *bds, const ItemPointerData *tid)
{ {
spgVacPendingItem *pitem; spgVacPendingItem *pitem;
spgVacPendingItem **listLink; spgVacPendingItem **listLink;

View File

@@ -310,7 +310,7 @@ CatalogTuplesMultiInsertWithInfo(Relation heapRel, TupleTableSlot **slot,
* (Use CatalogTupleUpdateWithInfo in such cases.) * (Use CatalogTupleUpdateWithInfo in such cases.)
*/ */
void void
CatalogTupleUpdate(Relation heapRel, ItemPointer otid, HeapTuple tup) CatalogTupleUpdate(Relation heapRel, const ItemPointerData *otid, HeapTuple tup)
{ {
CatalogIndexState indstate; CatalogIndexState indstate;
TU_UpdateIndexes updateIndexes = TU_All; TU_UpdateIndexes updateIndexes = TU_All;
@@ -334,7 +334,7 @@ CatalogTupleUpdate(Relation heapRel, ItemPointer otid, HeapTuple tup)
* so that callers needn't trouble over this ... but we don't do so today. * so that callers needn't trouble over this ... but we don't do so today.
*/ */
void void
CatalogTupleUpdateWithInfo(Relation heapRel, ItemPointer otid, HeapTuple tup, CatalogTupleUpdateWithInfo(Relation heapRel, const ItemPointerData *otid, HeapTuple tup,
CatalogIndexState indstate) CatalogIndexState indstate)
{ {
TU_UpdateIndexes updateIndexes = TU_All; TU_UpdateIndexes updateIndexes = TU_All;
@@ -362,7 +362,7 @@ CatalogTupleUpdateWithInfo(Relation heapRel, ItemPointer otid, HeapTuple tup,
* it might be better to do something about caching CatalogIndexState. * it might be better to do something about caching CatalogIndexState.
*/ */
void void
CatalogTupleDelete(Relation heapRel, ItemPointer tid) CatalogTupleDelete(Relation heapRel, const ItemPointerData *tid)
{ {
simple_heap_delete(heapRel, tid); simple_heap_delete(heapRel, tid);
} }

View File

@@ -128,7 +128,7 @@ typedef enum
static bool check_exclusion_or_unique_constraint(Relation heap, Relation index, static bool check_exclusion_or_unique_constraint(Relation heap, Relation index,
IndexInfo *indexInfo, IndexInfo *indexInfo,
ItemPointer tupleid, const ItemPointerData *tupleid,
const Datum *values, const bool *isnull, const Datum *values, const bool *isnull,
EState *estate, bool newIndex, EState *estate, bool newIndex,
CEOUC_WAIT_MODE waitMode, CEOUC_WAIT_MODE waitMode,
@@ -541,7 +541,7 @@ ExecInsertIndexTuples(ResultRelInfo *resultRelInfo,
bool bool
ExecCheckIndexConstraints(ResultRelInfo *resultRelInfo, TupleTableSlot *slot, ExecCheckIndexConstraints(ResultRelInfo *resultRelInfo, TupleTableSlot *slot,
EState *estate, ItemPointer conflictTid, EState *estate, ItemPointer conflictTid,
ItemPointer tupleid, List *arbiterIndexes) const ItemPointerData *tupleid, List *arbiterIndexes)
{ {
int i; int i;
int numIndices; int numIndices;
@@ -703,7 +703,7 @@ ExecCheckIndexConstraints(ResultRelInfo *resultRelInfo, TupleTableSlot *slot,
static bool static bool
check_exclusion_or_unique_constraint(Relation heap, Relation index, check_exclusion_or_unique_constraint(Relation heap, Relation index,
IndexInfo *indexInfo, IndexInfo *indexInfo,
ItemPointer tupleid, const ItemPointerData *tupleid,
const Datum *values, const bool *isnull, const Datum *values, const bool *isnull,
EState *estate, bool newIndex, EState *estate, bool newIndex,
CEOUC_WAIT_MODE waitMode, CEOUC_WAIT_MODE waitMode,
@@ -955,7 +955,7 @@ retry:
void void
check_exclusion_constraint(Relation heap, Relation index, check_exclusion_constraint(Relation heap, Relation index,
IndexInfo *indexInfo, IndexInfo *indexInfo,
ItemPointer tupleid, const ItemPointerData *tupleid,
const Datum *values, const bool *isnull, const Datum *values, const bool *isnull,
EState *estate, bool newIndex) EState *estate, bool newIndex)
{ {

View File

@@ -168,7 +168,7 @@
* PredicateLockRelation(Relation relation, Snapshot snapshot) * PredicateLockRelation(Relation relation, Snapshot snapshot)
* PredicateLockPage(Relation relation, BlockNumber blkno, * PredicateLockPage(Relation relation, BlockNumber blkno,
* Snapshot snapshot) * Snapshot snapshot)
* PredicateLockTID(Relation relation, ItemPointer tid, Snapshot snapshot, * PredicateLockTID(Relation relation, const ItemPointerData *tid, Snapshot snapshot,
* TransactionId tuple_xid) * TransactionId tuple_xid)
* PredicateLockPageSplit(Relation relation, BlockNumber oldblkno, * PredicateLockPageSplit(Relation relation, BlockNumber oldblkno,
* BlockNumber newblkno) * BlockNumber newblkno)
@@ -180,7 +180,7 @@
* conflict detection (may also trigger rollback) * conflict detection (may also trigger rollback)
* CheckForSerializableConflictOut(Relation relation, TransactionId xid, * CheckForSerializableConflictOut(Relation relation, TransactionId xid,
* Snapshot snapshot) * Snapshot snapshot)
* CheckForSerializableConflictIn(Relation relation, ItemPointer tid, * CheckForSerializableConflictIn(Relation relation, const ItemPointerData *tid,
* BlockNumber blkno) * BlockNumber blkno)
* CheckTableForSerializableConflictIn(Relation relation) * CheckTableForSerializableConflictIn(Relation relation)
* *
@@ -2618,7 +2618,7 @@ PredicateLockPage(Relation relation, BlockNumber blkno, Snapshot snapshot)
* Skip if this is a temporary table. * Skip if this is a temporary table.
*/ */
void void
PredicateLockTID(Relation relation, ItemPointer tid, Snapshot snapshot, PredicateLockTID(Relation relation, const ItemPointerData *tid, Snapshot snapshot,
TransactionId tuple_xid) TransactionId tuple_xid)
{ {
PREDICATELOCKTARGETTAG tag; PREDICATELOCKTARGETTAG tag;
@@ -4333,7 +4333,7 @@ CheckTargetForConflictsIn(PREDICATELOCKTARGETTAG *targettag)
* tuple itself. * tuple itself.
*/ */
void void
CheckForSerializableConflictIn(Relation relation, ItemPointer tid, BlockNumber blkno) CheckForSerializableConflictIn(Relation relation, const ItemPointerData *tid, BlockNumber blkno)
{ {
PREDICATELOCKTARGETTAG targettag; PREDICATELOCKTARGETTAG targettag;

View File

@@ -42,7 +42,7 @@
#define DELIM ',' #define DELIM ','
#define NTIDARGS 2 #define NTIDARGS 2
static ItemPointer currtid_for_view(Relation viewrel, ItemPointer tid); static ItemPointer currtid_for_view(Relation viewrel, const ItemPointerData *tid);
/* ---------------------------------------------------------------- /* ----------------------------------------------------------------
* tidin * tidin
@@ -293,7 +293,7 @@ hashtidextended(PG_FUNCTION_ARGS)
* relation "rel". * relation "rel".
*/ */
static ItemPointer static ItemPointer
currtid_internal(Relation rel, ItemPointer tid) currtid_internal(Relation rel, const ItemPointerData *tid)
{ {
ItemPointer result; ItemPointer result;
AclResult aclresult; AclResult aclresult;
@@ -335,7 +335,7 @@ currtid_internal(Relation rel, ItemPointer tid)
* correspond to the CTID of a base relation. * correspond to the CTID of a base relation.
*/ */
static ItemPointer static ItemPointer
currtid_for_view(Relation viewrel, ItemPointer tid) currtid_for_view(Relation viewrel, const ItemPointerData *tid)
{ {
TupleDesc att = RelationGetDescr(viewrel); TupleDesc att = RelationGetDescr(viewrel);
RuleLock *rulelock; RuleLock *rulelock;

View File

@@ -816,7 +816,7 @@ tuplesort_putheaptuple(Tuplesortstate *state, HeapTuple tup)
*/ */
void void
tuplesort_putindextuplevalues(Tuplesortstate *state, Relation rel, tuplesort_putindextuplevalues(Tuplesortstate *state, Relation rel,
ItemPointer self, const Datum *values, const ItemPointerData *self, const Datum *values,
const bool *isnull) const bool *isnull)
{ {
SortTuple stup; SortTuple stup;

View File

@@ -453,7 +453,7 @@ typedef struct HSpool HSpool; /* opaque struct in hashsort.c */
extern HSpool *_h_spoolinit(Relation heap, Relation index, uint32 num_buckets); extern HSpool *_h_spoolinit(Relation heap, Relation index, uint32 num_buckets);
extern void _h_spooldestroy(HSpool *hspool); 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); const Datum *values, const bool *isnull);
extern void _h_indexbuild(HSpool *hspool, Relation heapRel); extern void _h_indexbuild(HSpool *hspool, Relation heapRel);

View File

@@ -316,12 +316,12 @@ extern void heap_insert(Relation relation, HeapTuple tup, CommandId cid,
extern void heap_multi_insert(Relation relation, TupleTableSlot **slots, extern void heap_multi_insert(Relation relation, TupleTableSlot **slots,
int ntuples, CommandId cid, int options, int ntuples, CommandId cid, int options,
BulkInsertState bistate); 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, CommandId cid, Snapshot crosscheck, bool wait,
TM_FailureData *tmfd, bool changingPart); TM_FailureData *tmfd, bool changingPart);
extern void heap_finish_speculative(Relation relation, ItemPointer tid); extern void heap_finish_speculative(Relation relation, const ItemPointerData *tid);
extern void heap_abort_speculative(Relation relation, ItemPointer tid); extern void heap_abort_speculative(Relation relation, const ItemPointerData *tid);
extern TM_Result heap_update(Relation relation, ItemPointer otid, extern TM_Result heap_update(Relation relation, const ItemPointerData *otid,
HeapTuple newtup, HeapTuple newtup,
CommandId cid, Snapshot crosscheck, bool wait, CommandId cid, Snapshot crosscheck, bool wait,
TM_FailureData *tmfd, LockTupleMode *lockmode, TM_FailureData *tmfd, LockTupleMode *lockmode,
@@ -358,8 +358,8 @@ extern bool heap_tuple_should_freeze(HeapTupleHeader tuple,
extern bool heap_tuple_needs_eventual_freeze(HeapTupleHeader tuple); extern bool heap_tuple_needs_eventual_freeze(HeapTupleHeader tuple);
extern void simple_heap_insert(Relation relation, HeapTuple tup); extern void simple_heap_insert(Relation relation, HeapTuple tup);
extern void simple_heap_delete(Relation relation, ItemPointer tid); extern void simple_heap_delete(Relation relation, const ItemPointerData *tid);
extern void simple_heap_update(Relation relation, ItemPointer otid, extern void simple_heap_update(Relation relation, const ItemPointerData *otid,
HeapTuple tup, TU_UpdateIndexes *update_indexes); HeapTuple tup, TU_UpdateIndexes *update_indexes);
extern TransactionId heap_index_delete_tuples(Relation rel, extern TransactionId heap_index_delete_tuples(Relation rel,

View File

@@ -1234,7 +1234,7 @@ extern void _bt_dedup_start_pending(BTDedupState state, IndexTuple base,
OffsetNumber baseoff); OffsetNumber baseoff);
extern bool _bt_dedup_save_htid(BTDedupState state, IndexTuple itup); extern bool _bt_dedup_save_htid(BTDedupState state, IndexTuple itup);
extern Size _bt_dedup_finish_pending(Page newpage, BTDedupState state); 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); int nhtids);
extern void _bt_update_posting(BTVacuumPosting vacposting); extern void _bt_update_posting(BTVacuumPosting vacposting);
extern IndexTuple _bt_swap_posting(IndexTuple newitem, IndexTuple oposting, extern IndexTuple _bt_swap_posting(IndexTuple newitem, IndexTuple oposting,

View File

@@ -511,7 +511,7 @@ extern unsigned int SpGistGetInnerTypeSize(SpGistTypeDesc *att, Datum datum);
extern Size SpGistGetLeafTupleSize(TupleDesc tupleDescriptor, extern Size SpGistGetLeafTupleSize(TupleDesc tupleDescriptor,
const Datum *datums, const bool *isnulls); const Datum *datums, const bool *isnulls);
extern SpGistLeafTuple spgFormLeafTuple(SpGistState *state, extern SpGistLeafTuple spgFormLeafTuple(SpGistState *state,
ItemPointer heapPtr, const ItemPointerData *heapPtr,
const Datum *datums, const bool *isnulls); const Datum *datums, const bool *isnulls);
extern SpGistNodeTuple spgFormNodeTuple(SpGistState *state, extern SpGistNodeTuple spgFormNodeTuple(SpGistState *state,
Datum label, bool isnull); Datum label, bool isnull);
@@ -541,7 +541,7 @@ extern void spgPageIndexMultiDelete(SpGistState *state, Page page,
int firststate, int reststate, int firststate, int reststate,
BlockNumber blkno, OffsetNumber offnum); BlockNumber blkno, OffsetNumber offnum);
extern bool spgdoinsert(Relation index, SpGistState *state, extern bool spgdoinsert(Relation index, SpGistState *state,
ItemPointer heapPtr, Datum *datums, bool *isnulls); const ItemPointerData *heapPtr, Datum *datums, bool *isnulls);
/* spgproc.c */ /* spgproc.c */
extern double *spg_key_orderbys_distances(Datum key, bool isLeaf, extern double *spg_key_orderbys_distances(Datum key, bool isLeaf,

View File

@@ -40,7 +40,7 @@ extern void TidStoreUnlock(TidStore *ts);
extern void TidStoreDestroy(TidStore *ts); extern void TidStoreDestroy(TidStore *ts);
extern void TidStoreSetBlockOffsets(TidStore *ts, BlockNumber blkno, OffsetNumber *offsets, extern void TidStoreSetBlockOffsets(TidStore *ts, BlockNumber blkno, OffsetNumber *offsets,
int num_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 TidStoreIter *TidStoreBeginIterate(TidStore *ts);
extern TidStoreIterResult *TidStoreIterateNext(TidStoreIter *iter); extern TidStoreIterResult *TidStoreIterateNext(TidStoreIter *iter);
extern int TidStoreGetBlockOffsets(TidStoreIterResult *result, extern int TidStoreGetBlockOffsets(TidStoreIterResult *result,

View File

@@ -187,7 +187,7 @@ extern void IndexSetParentIndex(Relation partitionIdx, Oid parentOid);
* As noted in validate_index(), this can be significantly faster. * As noted in validate_index(), this can be significantly faster.
*/ */
static inline int64 static inline int64
itemptr_encode(ItemPointer itemptr) itemptr_encode(const ItemPointerData *itemptr)
{ {
BlockNumber block = ItemPointerGetBlockNumber(itemptr); BlockNumber block = ItemPointerGetBlockNumber(itemptr);
OffsetNumber offset = ItemPointerGetOffsetNumber(itemptr); OffsetNumber offset = ItemPointerGetOffsetNumber(itemptr);

View File

@@ -44,11 +44,11 @@ extern void CatalogTuplesMultiInsertWithInfo(Relation heapRel,
TupleTableSlot **slot, TupleTableSlot **slot,
int ntuples, int ntuples,
CatalogIndexState indstate); CatalogIndexState indstate);
extern void CatalogTupleUpdate(Relation heapRel, ItemPointer otid, extern void CatalogTupleUpdate(Relation heapRel, const ItemPointerData *otid,
HeapTuple tup); HeapTuple tup);
extern void CatalogTupleUpdateWithInfo(Relation heapRel, extern void CatalogTupleUpdateWithInfo(Relation heapRel,
ItemPointer otid, HeapTuple tup, const ItemPointerData *otid, HeapTuple tup,
CatalogIndexState indstate); CatalogIndexState indstate);
extern void CatalogTupleDelete(Relation heapRel, ItemPointer tid); extern void CatalogTupleDelete(Relation heapRel, const ItemPointerData *tid);
#endif /* INDEXING_H */ #endif /* INDEXING_H */

View File

@@ -745,11 +745,11 @@ extern List *ExecInsertIndexTuples(ResultRelInfo *resultRelInfo,
extern bool ExecCheckIndexConstraints(ResultRelInfo *resultRelInfo, extern bool ExecCheckIndexConstraints(ResultRelInfo *resultRelInfo,
TupleTableSlot *slot, TupleTableSlot *slot,
EState *estate, ItemPointer conflictTid, EState *estate, ItemPointer conflictTid,
ItemPointer tupleid, const ItemPointerData *tupleid,
List *arbiterIndexes); List *arbiterIndexes);
extern void check_exclusion_constraint(Relation heap, Relation index, extern void check_exclusion_constraint(Relation heap, Relation index,
IndexInfo *indexInfo, IndexInfo *indexInfo,
ItemPointer tupleid, const ItemPointerData *tupleid,
const Datum *values, const bool *isnull, const Datum *values, const bool *isnull,
EState *estate, bool newIndex); EState *estate, bool newIndex);

View File

@@ -54,7 +54,7 @@ extern void SetSerializableTransactionSnapshot(Snapshot snapshot,
extern void RegisterPredicateLockingXid(TransactionId xid); extern void RegisterPredicateLockingXid(TransactionId xid);
extern void PredicateLockRelation(Relation relation, Snapshot snapshot); extern void PredicateLockRelation(Relation relation, Snapshot snapshot);
extern void PredicateLockPage(Relation relation, BlockNumber blkno, 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); TransactionId tuple_xid);
extern void PredicateLockPageSplit(Relation relation, BlockNumber oldblkno, BlockNumber newblkno); extern void PredicateLockPageSplit(Relation relation, BlockNumber oldblkno, BlockNumber newblkno);
extern void PredicateLockPageCombine(Relation relation, BlockNumber oldblkno, BlockNumber newblkno); extern void PredicateLockPageCombine(Relation relation, BlockNumber oldblkno, BlockNumber newblkno);
@@ -64,7 +64,7 @@ extern void ReleasePredicateLocks(bool isCommit, bool isReadOnlySafe);
/* conflict detection (may also trigger rollback) */ /* conflict detection (may also trigger rollback) */
extern bool CheckForSerializableConflictOutNeeded(Relation relation, Snapshot snapshot); extern bool CheckForSerializableConflictOutNeeded(Relation relation, Snapshot snapshot);
extern void CheckForSerializableConflictOut(Relation relation, TransactionId xid, 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); extern void CheckTableForSerializableConflictIn(Relation relation);
/* final rollback checking */ /* final rollback checking */

View File

@@ -458,7 +458,7 @@ extern void tuplesort_puttupleslot(Tuplesortstate *state,
TupleTableSlot *slot); TupleTableSlot *slot);
extern void tuplesort_putheaptuple(Tuplesortstate *state, HeapTuple tup); extern void tuplesort_putheaptuple(Tuplesortstate *state, HeapTuple tup);
extern void tuplesort_putindextuplevalues(Tuplesortstate *state, extern void tuplesort_putindextuplevalues(Tuplesortstate *state,
Relation rel, ItemPointer self, Relation rel, const ItemPointerData *self,
const Datum *values, const bool *isnull); const Datum *values, const bool *isnull);
extern void tuplesort_putbrintuple(Tuplesortstate *state, BrinTuple *tuple, Size size); extern void tuplesort_putbrintuple(Tuplesortstate *state, BrinTuple *tuple, Size size);
extern void tuplesort_putgintuple(Tuplesortstate *state, GinTuple *tuple, Size size); extern void tuplesort_putgintuple(Tuplesortstate *state, GinTuple *tuple, Size size);