Fix CHECK_RELATION_BLOCK_RANGE macro, which was not merely producing

a warning but was outright wrong.
REL8_3_STABLE
Tom Lane 18 years ago
parent 4608f359a6
commit 93624bcda0
  1. 3
      contrib/pageinspect/btreefuncs.c
  2. 3
      contrib/pgstattuple/pgstatindex.c

@ -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"); }
/* ------------------------------------------------

Loading…
Cancel
Save