mirror of
https://github.com/postgres/postgres.git
synced 2025-07-28 23:42:10 +03:00
Fix CHECK_RELATION_BLOCK_RANGE macro, which was not merely producing
a warning but was outright wrong.
This commit is contained in:
@ -61,8 +61,9 @@ extern Datum bt_page_stats(PG_FUNCTION_ARGS);
|
||||
(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) ) \
|
||||
if ( RelationGetNumberOfBlocks(rel) <= (BlockNumber) (blkno) ) \
|
||||
elog(ERROR, "block number out of range"); }
|
||||
|
||||
/* ------------------------------------------------
|
||||
|
@ -52,8 +52,9 @@ extern Datum pg_relpages(PG_FUNCTION_ARGS);
|
||||
(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) ) \
|
||||
if ( RelationGetNumberOfBlocks(rel) <= (BlockNumber) (blkno) ) \
|
||||
elog(ERROR, "block number out of range"); }
|
||||
|
||||
/* ------------------------------------------------
|
||||
|
Reference in New Issue
Block a user