PostgreSQL Source Code  git master
itemptr.c File Reference
#include "postgres.h"
#include "storage/itemptr.h"
Include dependency graph for itemptr.c:

Go to the source code of this file.

Functions

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

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