]> granicus.if.org Git - postgresql/commit
Check block number against the correct fork in get_raw_page().
authorTom Lane <tgl@sss.pgh.pa.us>
Tue, 22 Jul 2014 15:45:53 +0000 (11:45 -0400)
committerTom Lane <tgl@sss.pgh.pa.us>
Tue, 22 Jul 2014 15:45:53 +0000 (11:45 -0400)
commitf59c8eff7dd3dea4116a34e1890ee219f6d7f8d5
tree1157c5e32d17b8a8bc5a8aab10ea6b05005fff3e
parent07115248fdaf06ba9b4f1a5f557cbf0282d835dd
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.
contrib/pageinspect/rawpage.c
src/backend/storage/buffer/bufmgr.c