Header And Logo

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

Functions

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