Skip to content

Commit 65c384c

Browse files
committed
Avoid calling PageGetSpecialPointer() on an all-zeros page.
That was otherwise harmless, but tripped the new assertion in PageGetSpecialPointer(). Reported by Amit Langote. Backpatch to 9.5, where the assertion was added.
1 parent e3a9a19 commit 65c384c

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/backend/access/nbtree/nbtree.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -881,7 +881,7 @@ btvacuumpage(BTVacState *vstate, BlockNumber blkno, BlockNumber orig_blkno)
881881
BlockNumber recurse_to;
882882
Buffer buf;
883883
Page page;
884-
BTPageOpaque opaque;
884+
BTPageOpaque opaque = NULL;
885885

886886
restart:
887887
delete_now = false;
@@ -900,9 +900,11 @@ btvacuumpage(BTVacState *vstate, BlockNumber blkno, BlockNumber orig_blkno)
900900
info->strategy);
901901
LockBuffer(buf, BT_READ);
902902
page = BufferGetPage(buf);
903-
opaque = (BTPageOpaque) PageGetSpecialPointer(page);
904903
if (!PageIsNew(page))
904+
{
905905
_bt_checkpage(rel, buf);
906+
opaque = (BTPageOpaque) PageGetSpecialPointer(page);
907+
}
906908

907909
/*
908910
* If we are recursing, the only case we want to do anything with is a

0 commit comments

Comments
 (0)