Commit 082aca9e authored by Tom Lane's avatar Tom Lane

Fix PageGetExactFreeSpace() so that it actually behaves sensibly

if pd_lower > pd_upper, rather than merely claiming to.  This would
only matter if the page header were corrupt, which shouldn't occur,
but ...
parent 0028b22d
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/storage/page/bufpage.c,v 1.77 2008/01/01 19:45:52 momjian Exp $ * $PostgreSQL: pgsql/src/backend/storage/page/bufpage.c,v 1.78 2008/02/10 20:39:08 tgl Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -489,6 +489,9 @@ PageGetExactFreeSpace(Page page) ...@@ -489,6 +489,9 @@ PageGetExactFreeSpace(Page page)
space = (int) ((PageHeader) page)->pd_upper - space = (int) ((PageHeader) page)->pd_upper -
(int) ((PageHeader) page)->pd_lower; (int) ((PageHeader) page)->pd_lower;
if (space < 0)
return 0;
return (Size) space; return (Size) space;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment