summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2014-07-22 11:45:57 -0400
committerTom Lane <tgl@sss.pgh.pa.us>2014-07-22 11:45:57 -0400
commit810f0d2a2dfa3c11baa68866045a85f708e69a3e (patch)
tree343668c101277b83628c974553a463e709dde701 /src
parentcec0c2182cec30000fb51710ce5cdf1b0cd7de25 (diff)
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.
Diffstat (limited to 'src')
-rw-r--r--src/backend/storage/buffer/bufmgr.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c
index 46373b60126..101f1a3ef47 100644
--- a/src/backend/storage/buffer/bufmgr.c
+++ b/src/backend/storage/buffer/bufmgr.c
@@ -1974,8 +1974,8 @@ FlushBuffer(volatile BufferDesc *buf, SMgrRelation reln)
}
/*
- * RelationGetNumberOfBlocks
- * Determines the current number of pages in the relation.
+ * RelationGetNumberOfBlocksInFork
+ * Determines the current number of pages in the specified relation fork.
*/
BlockNumber
RelationGetNumberOfBlocksInFork(Relation relation, ForkNumber forkNum)