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

#define ItemPointerCopy (   fromPointer,
  toPointer 
)
#define ItemPointerGetBlockNumber (   pointer)
Value:
( \
BlockIdGetBlockNumber(&(pointer)->ip_blkid) \
)
#define ItemPointerIsValid(pointer)
Definition: itemptr.h:59
#define BlockIdGetBlockNumber(blockId)
Definition: block.h:115
#define AssertMacro(condition)
Definition: c.h:672

Definition at line 66 of file itemptr.h.

Referenced by _bt_get_endpoint(), _bt_mark_page_halfdead(), _bt_search(), _bt_unlink_halfdead_page(), brinbuildCallback(), brinGetTupleForHeapBlock(), brininsert(), brinSetHeapBlockItemptr(), 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(), 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(), PredicateLockTuple(), PrintCatCacheLeakWarning(), ResolveCminCmaxDuringDecoding(), setRedirectionTuple(), spgMatchNodeAction(), spgprocesspending(), spgWalk(), tbm_add_tuples(), TidListCreate(), UnlockTuple(), vac_cmp_itemptr(), validate_index_heapscan(), and XactLockTableWaitErrorCb().

#define ItemPointerSetBlockNumber (   pointer,
  blockNumber 
)
Value:
( \
BlockIdSet(&((pointer)->ip_blkid), blockNumber) \
)
#define AssertMacro(condition)
Definition: c.h:672
#define BlockIdSet(blockId, blockNumber)
Definition: block.h:84
#define PointerIsValid(pointer)
Definition: c.h:522

Definition at line 97 of file itemptr.h.

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

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

Definition at line 131 of file itemptr.h.

Referenced by _bt_mark_page_halfdead(), _bt_unlink_halfdead_page(), _hash_first(), _hash_step(), AfterTriggerSaveEvent(), brinGetTupleForHeapBlock(), btree_xlog_mark_page_halfdead(), btree_xlog_unlink_page(), DecodeMultiInsert(), DecodeXLogTuple(), end_heap_rewrite(), entryGetItem(), exec_move_row_from_datum(), ExecCheckIndexConstraints(), ExecEvalFieldStore(), ExecLockRows(), ExecModifyTable(), get_tuple_from_datum(), GetAttributeByName(), GetAttributeByNum(), hashbeginscan(), hashrescan(), heap_form_tuple(), heap_tuple_from_minimal_tuple(), hstore_from_record(), hstore_populate_record(), InitPlan(), initscan(), leafRepackItems(), make_row_from_rec_and_jsonb(), make_tuple_indirect(), PLy_typeinfo_init(), populate_record_worker(), populate_recordset_object_end(), processPendingPage(), record_cmp(), record_eq(), record_image_cmp(), record_image_eq(), record_out(), record_send(), RelationGetIndexScan(), rewrite_heap_tuple(), scanGetCandidate(), spgFormDeadTuple(), spgFormNodeTuple(), spgRedoVacuumRedirect(), toast_flatten_tuple_to_datum(), TQExamineRecord(), TQRemapRecord(), TupleQueueHandleDataMessage(), and vacuumRedirectAndPlaceholder().

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

Definition at line 107 of file itemptr.h.

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

Typedef Documentation

Definition at line 48 of file itemptr.h.

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(), 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(), TidListCreate(), 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:264
#define ItemPointerGetOffsetNumber(pointer)
Definition: itemptr.h:76
#define ItemPointerGetBlockNumber(pointer)
Definition: itemptr.h:66