Header And Logo

PostgreSQL
| The world's most advanced open source database.

Data Structures | Defines | Typedefs | Functions

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

Defines

#define SizeOfIptrData   (offsetof(ItemPointerData, ip_posid) + sizeof(OffsetNumber))
#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)

Define Documentation

#define ItemPointerCopy (   fromPointer,
  toPointer 
)
Value:
( \
    AssertMacro(PointerIsValid(toPointer)), \
    AssertMacro(PointerIsValid(fromPointer)), \
    *(toPointer) = *(fromPointer) \
)

Definition at line 120 of file itemptr.h.

Referenced by AfterTriggerExecute(), AfterTriggerSaveEvent(), currtid_byrelname(), currtid_byreloid(), heap_lock_tuple(), and heap_lock_updated_tuple_rec().

#define ItemPointerGetBlockNumber (   pointer  ) 
#define ItemPointerGetOffsetNumber (   pointer  ) 
#define ItemPointerIsValid (   pointer  )     ((bool) (PointerIsValid(pointer) && ((pointer)->ip_posid != 0)))
#define ItemPointerSet (   pointer,
  blockNumber,
  offNum 
)
#define ItemPointerSetBlockNumber (   pointer,
  blockNumber 
)
Value:
( \
    AssertMacro(PointerIsValid(pointer)), \
    BlockIdSet(&((pointer)->ip_blkid), blockNumber) \
)

Definition at line 100 of file itemptr.h.

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

#define ItemPointerSetInvalid (   pointer  ) 
#define ItemPointerSetOffsetNumber (   pointer,
  offsetNumber 
)
Value:
( \
    AssertMacro(PointerIsValid(pointer)), \
    (pointer)->ip_posid = (offsetNumber) \
)

Definition at line 110 of file itemptr.h.

Referenced by gistFormTuple(), hashgettuple(), heap_hot_search_buffer(), heap_xlog_multi_insert(), IndexBuildHeapScan(), and validate_index_heapscan().

#define SizeOfIptrData   (offsetof(ItemPointerData, ip_posid) + sizeof(OffsetNumber))

Definition at line 48 of file itemptr.h.

Referenced by gincostestimate(), and TidListCreate().


Typedef Documentation

Definition at line 51 of file itemptr.h.


Function Documentation

int32 ItemPointerCompare ( ItemPointer  arg1,
ItemPointer  arg2 
)

Definition at line 45 of file itemptr.c.

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

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

{
    /*
     * Don't use ItemPointerGetBlockNumber or ItemPointerGetOffsetNumber here,
     * because they assert ip_posid != 0 which might not be true for a
     * user-supplied TID.
     */
    BlockNumber b1 = BlockIdGetBlockNumber(&(arg1->ip_blkid));
    BlockNumber b2 = BlockIdGetBlockNumber(&(arg2->ip_blkid));

    if (b1 < b2)
        return -1;
    else if (b1 > b2)
        return 1;
    else if (arg1->ip_posid < arg2->ip_posid)
        return -1;
    else if (arg1->ip_posid > arg2->ip_posid)
        return 1;
    else
        return 0;
}

bool ItemPointerEquals ( ItemPointer  pointer1,
ItemPointer  pointer2 
)