PostgreSQL Source Code  git master
itemptr.h File Reference
#include "storage/block.h"
#include "storage/off.h"
Include dependency graph for itemptr.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  ItemPointerData
 

Macros

#define SpecTokenOffsetNumber   0xfffe
 
#define MovedPartitionsOffsetNumber   0xfffd
 
#define MovedPartitionsBlockNumber   InvalidBlockNumber
 
#define ItemPointerIsValid(pointer)   ((bool) (PointerIsValid(pointer) && ((pointer)->ip_posid != 0)))
 
#define ItemPointerGetBlockNumberNoCheck(pointer)
 
#define ItemPointerGetBlockNumber(pointer)
 
#define ItemPointerGetOffsetNumberNoCheck(pointer)
 
#define ItemPointerGetOffsetNumber(pointer)
 
#define ItemPointerSet(pointer, blockNumber, offNum)
 
#define ItemPointerSetBlockNumber(pointer, blockNumber)
 
#define ItemPointerSetOffsetNumber(pointer, offsetNumber)
 
#define ItemPointerCopy(fromPointer, toPointer)
 
#define ItemPointerSetInvalid(pointer)
 
#define ItemPointerIndicatesMovedPartitions(pointer)
 
#define ItemPointerSetMovedPartitions(pointer)   ItemPointerSet((pointer), MovedPartitionsBlockNumber, MovedPartitionsOffsetNumber)
 

Typedefs

typedef struct ItemPointerData ItemPointerData
 
typedef ItemPointerDataItemPointer
 

Functions

bool ItemPointerEquals (ItemPointer pointer1, ItemPointer pointer2)
 
int32 ItemPointerCompare (ItemPointer arg1, ItemPointer arg2)
 

Macro Definition Documentation

◆ ItemPointerCopy

#define ItemPointerCopy (   fromPointer,
  toPointer 
)

◆ ItemPointerGetBlockNumber

#define ItemPointerGetBlockNumber (   pointer)
Value:
( \
AssertMacro(ItemPointerIsValid(pointer)), \
ItemPointerGetBlockNumberNoCheck(pointer) \
)
#define ItemPointerIsValid(pointer)
Definition: itemptr.h:82

Definition at line 98 of file itemptr.h.

Referenced by _bt_adjacenthtid(), _bt_check_third_page(), brinbuildCallback(), brinGetTupleForHeapBlock(), brininsert(), brinRevmapDesummarizeRange(), brinSetHeapBlockItemptr(), bt_normalize_tuple(), bt_target_page_check(), bt_tuple_present_callback(), CheckForSerializableConflictIn(), compare_rows(), comparetup_index_btree(), comparetup_index_hash(), ConditionalLockTuple(), doPickSplit(), get_actual_variable_endpoint(), gin_desc(), gingetbitmap(), gistBufferingFindCorrectParent(), gistbufferinginserttuples(), gistdeletepage(), gistdoinsert(), gistFindCorrectParent(), gistFindPath(), gistGetMaxLevel(), gistMemorizeAllDownlinks(), gistProcessItup(), gistScanPage(), gistvacuum_delete_empty_pages(), heap2_desc(), heap_abort_speculative(), heap_compute_xid_horizon_for_tuples(), heap_delete(), heap_fetch(), heap_finish_speculative(), heap_get_latest_tid(), heap_hot_search_buffer(), heap_inplace_update(), heap_insert(), heap_lock_tuple(), heap_lock_updated_tuple_rec(), heap_prune_chain(), heap_update(), heapam_index_build_range_scan(), heapam_index_fetch_tuple(), heapam_index_validate_scan(), heapam_tuple_tid_valid(), heapgettup(), heapgettup_pagemode(), HeapTupleHeaderAdvanceLatestRemovedXid(), IndexOnlyNext(), ItemPointerEquals(), itemptr_comparator(), itemptr_encode(), lazy_vacuum_heap(), lazy_vacuum_page(), LockTuple(), pgstat_heap(), PredicateLockTuple(), PrintCatCacheLeakWarning(), ResolveCminCmaxDuringDecoding(), setRedirectionTuple(), spgMatchNodeAction(), spgprocesspending(), spgTestLeafTuple(), spgWalk(), tbm_add_tuples(), test_itemptr_pair(), UnlockTuple(), vac_cmp_itemptr(), and XactLockTableWaitErrorCb().

◆ ItemPointerGetBlockNumberNoCheck

#define ItemPointerGetBlockNumberNoCheck (   pointer)
Value:
( \
BlockIdGetBlockNumber(&(pointer)->ip_blkid) \
)

Definition at line 89 of file itemptr.h.

Referenced by bt_page_print_tuples(), bt_target_page_check(), ItemPointerCompare(), scalarineqsel(), table_tuple_get_latest_tid(), tidout(), and tidsend().

◆ ItemPointerGetOffsetNumber

#define ItemPointerGetOffsetNumber (   pointer)
Value:
( \
AssertMacro(ItemPointerIsValid(pointer)), \
ItemPointerGetOffsetNumberNoCheck(pointer) \
)
#define ItemPointerIsValid(pointer)
Definition: itemptr.h:82

Definition at line 117 of file itemptr.h.

Referenced by _bt_adjacenthtid(), _bt_check_natts(), _bt_check_third_page(), _bt_truncate(), brinGetTupleForHeapBlock(), brininsert(), brinRevmapDesummarizeRange(), brinSetHeapBlockItemptr(), bt_normalize_tuple(), bt_target_page_check(), bt_tuple_present_callback(), CheckForSerializableConflictIn(), compare_rows(), comparetup_index_btree(), comparetup_index_hash(), ConditionalLockTuple(), doPickSplit(), gin_desc(), ginPostingListDecodeAllSegments(), heap2_desc(), heap_abort_speculative(), heap_compute_xid_horizon_for_tuples(), heap_delete(), heap_fetch(), heap_finish_speculative(), heap_get_latest_tid(), heap_get_root_tuples(), heap_hot_search_buffer(), heap_inplace_update(), heap_insert(), heap_lock_tuple(), heap_lock_updated_tuple_rec(), heap_multi_insert(), heap_prune_chain(), heap_update(), heapam_index_build_range_scan(), heapam_index_validate_scan(), heapam_scan_bitmap_next_block(), heapgettup(), heapgettup_pagemode(), ItemPointerEquals(), itemptr_comparator(), itemptr_encode(), lazy_vacuum_page(), LockTuple(), log_heap_update(), PredicateLockTuple(), PrintCatCacheLeakWarning(), spgMatchNodeAction(), spgprocesspending(), spgTestLeafTuple(), spgWalk(), tbm_add_tuples(), test_itemptr_pair(), UnlockTuple(), vac_cmp_itemptr(), and XactLockTableWaitErrorCb().

◆ ItemPointerGetOffsetNumberNoCheck

#define ItemPointerGetOffsetNumberNoCheck (   pointer)
Value:
( \
(pointer)->ip_posid \
)

Definition at line 108 of file itemptr.h.

Referenced by bt_page_print_tuples(), bt_target_page_check(), ItemPointerCompare(), scalarineqsel(), table_tuple_get_latest_tid(), tidout(), and tidsend().

◆ ItemPointerIndicatesMovedPartitions

#define ItemPointerIndicatesMovedPartitions (   pointer)
Value:
( \
ItemPointerGetOffsetNumber(pointer) == MovedPartitionsOffsetNumber && \
ItemPointerGetBlockNumberNoCheck(pointer) == MovedPartitionsBlockNumber \
)
#define MovedPartitionsOffsetNumber
Definition: itemptr.h:69
#define MovedPartitionsBlockNumber
Definition: itemptr.h:70

Definition at line 184 of file itemptr.h.

Referenced by ExecOnConflictUpdate(), heapam_tuple_lock(), RelationFindReplTupleByIndex(), and RelationFindReplTupleSeq().

◆ ItemPointerIsValid

◆ ItemPointerSet

◆ ItemPointerSetBlockNumber

#define ItemPointerSetBlockNumber (   pointer,
  blockNumber 
)
Value:
( \
AssertMacro(PointerIsValid(pointer)), \
BlockIdSet(&((pointer)->ip_blkid), blockNumber) \
)
#define PointerIsValid(pointer)
Definition: c.h:627

Definition at line 138 of file itemptr.h.

Referenced by gistformdownlink(), gistplacetopage(), heap_xlog_delete(), heap_xlog_insert(), and heap_xlog_multi_insert().

◆ ItemPointerSetInvalid

#define ItemPointerSetInvalid (   pointer)
Value:
( \
AssertMacro(PointerIsValid(pointer)), \
BlockIdSet(&((pointer)->ip_blkid), InvalidBlockNumber), \
(pointer)->ip_posid = InvalidOffsetNumber \
)
#define InvalidOffsetNumber
Definition: off.h:26
#define InvalidBlockNumber
Definition: block.h:33
#define PointerIsValid(pointer)
Definition: c.h:627

Definition at line 172 of file itemptr.h.

Referenced by AfterTriggerSaveEvent(), brin_xlog_desummarize_page(), brinGetTupleForHeapBlock(), brinRevmapDesummarizeRange(), brinSetHeapBlockItemptr(), DecodeMultiInsert(), DecodeXLogTuple(), deconstruct_composite_datum(), end_heap_rewrite(), entryGetItem(), ER_flatten_into(), exec_move_row_from_datum(), ExecCheckIndexConstraints(), ExecEvalFieldStoreDeForm(), ExecLockRows(), ExecModifyTable(), ExecuteCallStmt(), expand_tuple(), GetAttributeByName(), GetAttributeByNum(), heap_form_tuple(), heap_tuple_from_minimal_tuple(), hstore_from_record(), hstore_populate_record(), InitPlan(), initscan(), leafRepackItems(), make_expanded_record_from_datum(), make_tuple_indirect(), populate_record(), populate_recordset_record(), processPendingPage(), record_cmp(), record_eq(), record_image_cmp(), record_image_eq(), record_out(), record_send(), rewrite_heap_tuple(), scanGetCandidate(), spgFormDeadTuple(), spgFormNodeTuple(), spgRedoVacuumRedirect(), toast_flatten_tuple_to_datum(), tts_buffer_heap_clear(), tts_heap_clear(), tts_minimal_clear(), tts_virtual_clear(), TupleQueueReaderNext(), unique_key_recheck(), and vacuumRedirectAndPlaceholder().

◆ ItemPointerSetMovedPartitions

#define ItemPointerSetMovedPartitions (   pointer)    ItemPointerSet((pointer), MovedPartitionsBlockNumber, MovedPartitionsOffsetNumber)

Definition at line 195 of file itemptr.h.

◆ ItemPointerSetOffsetNumber

#define ItemPointerSetOffsetNumber (   pointer,
  offsetNumber 
)
Value:
( \
AssertMacro(PointerIsValid(pointer)), \
(pointer)->ip_posid = (offsetNumber) \
)
#define PointerIsValid(pointer)
Definition: c.h:627

Definition at line 148 of file itemptr.h.

Referenced by _bt_truncate(), gistFormTuple(), heap_hot_search_buffer(), heap_xlog_delete(), heap_xlog_insert(), heap_xlog_multi_insert(), and heapam_index_validate_scan().

◆ MovedPartitionsBlockNumber

#define MovedPartitionsBlockNumber   InvalidBlockNumber

Definition at line 70 of file itemptr.h.

◆ MovedPartitionsOffsetNumber

#define MovedPartitionsOffsetNumber   0xfffd

Definition at line 69 of file itemptr.h.

◆ SpecTokenOffsetNumber

#define SpecTokenOffsetNumber   0xfffe

Definition at line 63 of file itemptr.h.

Referenced by heap_finish_speculative().

Typedef Documentation

◆ ItemPointer

Definition at line 49 of file itemptr.h.

◆ ItemPointerData

Function Documentation

◆ ItemPointerCompare()

int32 ItemPointerCompare ( ItemPointer  arg1,
ItemPointer  arg2 
)

Definition at line 52 of file itemptr.c.

References ItemPointerGetBlockNumberNoCheck, and ItemPointerGetOffsetNumberNoCheck.

Referenced by _bt_check_unique(), _bt_compare(), _bt_load(), _bt_truncate(), bttidcmp(), dataBeginPlaceToPageLeaf(), heap_compute_xid_horizon_for_tuples(), heapam_index_validate_scan(), tideq(), tidge(), tidgt(), tidlarger(), tidle(), tidlt(), tidne(), and tidsmaller().

53 {
54  /*
55  * Use ItemPointerGet{Offset,Block}NumberNoCheck to avoid asserting
56  * ip_posid != 0, which may not be true for a user-supplied TID.
57  */
60 
61  if (b1 < b2)
62  return -1;
63  else if (b1 > b2)
64  return 1;
65  else if (ItemPointerGetOffsetNumberNoCheck(arg1) <
67  return -1;
68  else if (ItemPointerGetOffsetNumberNoCheck(arg1) >
70  return 1;
71  else
72  return 0;
73 }
#define ItemPointerGetOffsetNumberNoCheck(pointer)
Definition: itemptr.h:108
uint32 BlockNumber
Definition: block.h:31
#define ItemPointerGetBlockNumberNoCheck(pointer)
Definition: itemptr.h:89

◆ ItemPointerEquals()

bool ItemPointerEquals ( ItemPointer  pointer1,
ItemPointer  pointer2 
)

Definition at line 29 of file itemptr.c.

References ItemPointerGetBlockNumber, ItemPointerGetOffsetNumber, and StaticAssertStmt.

Referenced by _bt_killitems(), _hash_kill_items(), brinGetTupleForHeapBlock(), check_exclusion_or_unique_constraint(), collectMatchesForHeapRow(), compile_pltcl_function(), gistplacetopage(), heap_delete(), heap_get_latest_tid(), heap_lock_tuple(), heap_lock_updated_tuple(), heap_lock_updated_tuple_rec(), heap_update(), heapam_tuple_lock(), HeapTupleSatisfiesUpdate(), index_getnext_slot(), lookup_C_func(), plpgsql_compile(), PLy_procedure_valid(), processPendingPage(), rewrite_heap_tuple(), scanGetCandidate(), SearchCatCacheList(), spgAddPendingTID(), test_itemptr_pair(), test_lockmode_for_conflict(), and validate_plperl_function().

30 {
31  /*
32  * We really want ItemPointerData to be exactly 6 bytes. This is rather a
33  * random place to check, but there is no better place.
34  */
35  StaticAssertStmt(sizeof(ItemPointerData) == 3 * sizeof(uint16),
36  "ItemPointerData struct is improperly padded");
37 
38  if (ItemPointerGetBlockNumber(pointer1) ==
39  ItemPointerGetBlockNumber(pointer2) &&
40  ItemPointerGetOffsetNumber(pointer1) ==
42  return true;
43  else
44  return false;
45 }
#define StaticAssertStmt(condition, errmessage)
Definition: c.h:843
unsigned short uint16
Definition: c.h:358
#define ItemPointerGetOffsetNumber(pointer)
Definition: itemptr.h:117
#define ItemPointerGetBlockNumber(pointer)
Definition: itemptr.h:98