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 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)
 

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:60

Definition at line 76 of file itemptr.h.

Referenced by _bt_get_endpoint(), _bt_mark_page_halfdead(), _bt_search(), _bt_unlink_halfdead_page(), brinbuildCallback(), brinGetTupleForHeapBlock(), brininsert(), brinRevmapDesummarizeRange(), brinSetHeapBlockItemptr(), bt_check_level_from_leftmost(), bt_target_page_check(), btree_xlog_delete_get_latestRemovedXid(), btree_xlog_mark_page_halfdead(), CheckForSerializableConflictIn(), compare_rows(), comparetup_index_btree(), comparetup_index_hash(), ConditionalLockTuple(), doPickSplit(), GetTupleForTrigger(), gin_desc(), gingetbitmap(), gistBufferingFindCorrectParent(), gistbufferinginserttuples(), gistbulkdelete(), gistdoinsert(), gistFindCorrectParent(), gistFindPath(), gistGetMaxLevel(), gistMemorizeAllDownlinks(), gistProcessItup(), gistScanPage(), hash_xlog_vacuum_get_latestRemovedXid(), heap2_desc(), heap_abort_speculative(), heap_delete(), heap_fetch(), heap_finish_speculative(), heap_get_latest_tid(), heap_hot_search(), heap_hot_search_buffer(), heap_inplace_update(), heap_insert(), heap_lock_tuple(), heap_lock_updated_tuple_rec(), heap_prune_chain(), heap_update(), heapgettup(), heapgettup_pagemode(), index_fetch_heap(), index_getnext(), IndexBuildHeapRangeScan(), IndexOnlyNext(), ItemPointerEquals(), itemptr_comparator(), itemptr_encode(), lazy_vacuum_heap(), lazy_vacuum_page(), LockTuple(), pgstat_heap(), PredicateLockTuple(), PrintCatCacheLeakWarning(), ResolveCminCmaxDuringDecoding(), setRedirectionTuple(), spgMatchNodeAction(), spgprocesspending(), spgWalk(), tbm_add_tuples(), TidListEval(), UnlockTuple(), vac_cmp_itemptr(), validate_index_heapscan(), and XactLockTableWaitErrorCb().

◆ ItemPointerGetBlockNumberNoCheck

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

Definition at line 67 of file itemptr.h.

Referenced by bt_page_print_tuples(), ItemPointerCompare(), tidout(), and tidsend().

◆ ItemPointerGetOffsetNumber

◆ ItemPointerGetOffsetNumberNoCheck

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

Definition at line 86 of file itemptr.h.

Referenced by bt_page_print_tuples(), ItemPointerCompare(), tidout(), and tidsend().

◆ ItemPointerIsValid

◆ ItemPointerSet

◆ ItemPointerSetBlockNumber

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

Definition at line 116 of file itemptr.h.

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

◆ ItemPointerSetInvalid

#define ItemPointerSetInvalid (   pointer)

◆ ItemPointerSetOffsetNumber

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

Definition at line 126 of file itemptr.h.

Referenced by gistFormTuple(), heap_hot_search_buffer(), heap_xlog_delete(), heap_xlog_insert(), heap_xlog_multi_insert(), IndexBuildHeapRangeScan(), and validate_index_heapscan().

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(), bttidcmp(), dataBeginPlaceToPageLeaf(), tideq(), tidge(), tidgt(), tidlarger(), tidle(), tidlt(), tidne(), tidsmaller(), and validate_index_heapscan().

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:86
uint32 BlockNumber
Definition: block.h:31
#define ItemPointerGetBlockNumberNoCheck(pointer)
Definition: itemptr.h:67

◆ 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(), EvalPlanQualFetch(), ExecDelete(), ExecLockRows(), ExecUpdate(), GetTupleForTrigger(), gistplacetopage(), heap_get_latest_tid(), heap_lock_updated_tuple(), heap_lock_updated_tuple_rec(), lookup_C_func(), plpgsql_compile(), PLy_procedure_valid(), processPendingPage(), rewrite_heap_tuple(), scanGetCandidate(), SearchCatCacheList(), spgAddPendingTID(), TidListEval(), 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:753
unsigned short uint16
Definition: c.h:295
#define ItemPointerGetOffsetNumber(pointer)
Definition: itemptr.h:95
#define ItemPointerGetBlockNumber(pointer)
Definition: itemptr.h:76