pgsql: Check block number against the correct fork in get_raw_page().

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: pgsql-committers(at)postgresql(dot)org
Subject: pgsql: Check block number against the correct fork in get_raw_page().
Date: 2014-07-22 15:46:45
Message-ID: E1X9cH7-0006Xl-N2@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Check block number against the correct fork in get_raw_page().

get_raw_page tried to validate the supplied block number against
RelationGetNumberOfBlocks(), which of course is only right when
accessing the main fork. In most cases, the main fork is longer
than the others, so that the check was too weak (allowing a
lower-level error to be reported, but no real harm to be done).
However, very small tables could have an FSM larger than their heap,
in which case the mistake prevented access to some FSM pages.
Per report from Torsten Foertsch.

In passing, make the bad-block-number error into an ereport not elog
(since it's certainly not an internal error); and fix sloppily
maintained comment for RelationGetNumberOfBlocksInFork.

This has been wrong since we invented relation forks, so back-patch
to all supported branches.

Branch
------
master

Details
-------
http://git.postgresql.org/pg/commitdiff/27cef0a56111a7a44e0d9b9a7819f7e9f4980a77

Modified Files
--------------
contrib/pageinspect/rawpage.c | 8 +++++---
src/backend/storage/buffer/bufmgr.c | 4 ++--
2 files changed, 7 insertions(+), 5 deletions(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Tom Lane 2014-07-22 15:51:18 Re: [COMMITTERS] pgsql: Diagnose incompatible OpenLDAP versions during build and test.
Previous Message Andrew Dunstan 2014-07-22 15:27:47 pgsql: Allow empty string object keys in json_object().