mirror of
https://github.com/postgres/postgres.git
synced 2025-07-11 10:01:57 +03:00
Add the ability to create indexes 'concurrently', that is, without
blocking concurrent writes to the table. Greg Stark, with a little help from Tom Lane.
This commit is contained in:
@ -8,7 +8,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $PostgreSQL: pgsql/src/backend/storage/page/itemptr.c,v 1.17 2006/07/14 14:52:23 momjian Exp $
|
||||
* $PostgreSQL: pgsql/src/backend/storage/page/itemptr.c,v 1.18 2006/08/25 04:06:53 tgl Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -16,13 +16,14 @@
|
||||
|
||||
#include "storage/itemptr.h"
|
||||
|
||||
|
||||
/*
|
||||
* ItemPointerEquals
|
||||
* Returns true if both item pointers point to the same item,
|
||||
* otherwise returns false.
|
||||
*
|
||||
* Note:
|
||||
* Assumes that the disk item pointers are not NULL.
|
||||
* Asserts that the disk item pointers are both valid!
|
||||
*/
|
||||
bool
|
||||
ItemPointerEquals(ItemPointer pointer1, ItemPointer pointer2)
|
||||
@ -35,3 +36,30 @@ ItemPointerEquals(ItemPointer pointer1, ItemPointer pointer2)
|
||||
else
|
||||
return false;
|
||||
}
|
||||
|
||||
/*
|
||||
* ItemPointerCompare
|
||||
* Generic btree-style comparison for item pointers.
|
||||
*/
|
||||
int32
|
||||
ItemPointerCompare(ItemPointer arg1, ItemPointer arg2)
|
||||
{
|
||||
/*
|
||||
* 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;
|
||||
}
|
||||
|
Reference in New Issue
Block a user