PostgreSQL Source Code  git master
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros
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

int32 ItemPointerCompare ( ItemPointer  arg1,
ItemPointer  arg2 
)

Definition at line 52 of file itemptr.c.

References BlockIdGetBlockNumber, ItemPointerData::ip_blkid, and ItemPointerData::ip_posid.

Referenced by _bt_check_unique(), bttidcmp(), dataBeginPlaceToPageLeaf(), tideq(), tidge(), tidgt(), tidlarger(), tidle(), tidlt(), tidne(), tidsmaller(), and validate_index_heapscan().

53 {
54  /*
55  * Don't use ItemPointerGetBlockNumber or ItemPointerGetOffsetNumber here,
56  * because they assert ip_posid != 0 which might not be true for a
57  * user-supplied TID.
58  */
61 
62  if (b1 < b2)
63  return -1;
64  else if (b1 > b2)
65  return 1;
66  else if (arg1->ip_posid < arg2->ip_posid)
67  return -1;
68  else if (arg1->ip_posid > arg2->ip_posid)
69  return 1;
70  else
71  return 0;
72 }
#define BlockIdGetBlockNumber(blockId)
Definition: block.h:115
uint32 BlockNumber
Definition: block.h:31
BlockIdData ip_blkid
Definition: itemptr.h:38
OffsetNumber ip_posid
Definition: itemptr.h:39
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(), hashgettuple(), heap_get_latest_tid(), heap_lock_updated_tuple(), heap_lock_updated_tuple_rec(), lookup_C_func(), plpgsql_compile(), PLy_procedure_argument_valid(), 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:757
unsigned short uint16
Definition: c.h:267
#define ItemPointerGetOffsetNumber(pointer)
Definition: itemptr.h:76
#define ItemPointerGetBlockNumber(pointer)
Definition: itemptr.h:66