mirror of
https://git.postgresql.org/git/postgresql.git
synced 2024-12-21 08:29:39 +08:00
Fix CHECK_RELATION_BLOCK_RANGE macro, which was not merely producing
a warning but was outright wrong.
This commit is contained in:
parent
c1ac3df734
commit
45839ffd28
@ -63,14 +63,15 @@ extern Datum pg_relpages(PG_FUNCTION_ARGS);
|
||||
#define IS_INDEX(r) ((r)->rd_rel->relkind == 'i')
|
||||
#define IS_BTREE(r) ((r)->rd_rel->relam == BTREE_AM_OID)
|
||||
|
||||
#define CHECK_PAGE_OFFSET_RANGE(page, offset) { \
|
||||
if ( !(FirstOffsetNumber<=(offset) && \
|
||||
(offset)<=PageGetMaxOffsetNumber(page)) ) \
|
||||
elog(ERROR, "Page offset number out of range."); }
|
||||
#define CHECK_PAGE_OFFSET_RANGE(pg, offnum) { \
|
||||
if ( !(FirstOffsetNumber <= (offnum) && \
|
||||
(offnum) <= PageGetMaxOffsetNumber(pg)) ) \
|
||||
elog(ERROR, "page offset number out of range"); }
|
||||
|
||||
/* note: BlockNumber is unsigned, hence can't be negative */
|
||||
#define CHECK_RELATION_BLOCK_RANGE(rel, blkno) { \
|
||||
if ( (blkno)<0 && RelationGetNumberOfBlocks((rel))<=(blkno) ) \
|
||||
elog(ERROR, "Block number out of range."); }
|
||||
if ( RelationGetNumberOfBlocks(rel) <= (BlockNumber) (blkno) ) \
|
||||
elog(ERROR, "block number out of range"); }
|
||||
|
||||
/* ------------------------------------------------
|
||||
* structure for single btree page statistics
|
||||
|
Loading…
Reference in New Issue
Block a user