Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Avoid calling PageGetSpecialPointer() on an all-zeros page.
authorHeikki Linnakangas <heikki.linnakangas@iki.fi>
Mon, 27 Jul 2015 09:24:27 +0000 (12:24 +0300)
committerHeikki Linnakangas <heikki.linnakangas@iki.fi>
Mon, 27 Jul 2015 09:24:27 +0000 (12:24 +0300)
That was otherwise harmless, but tripped the new assertion in
PageGetSpecialPointer().

Reported by Amit Langote. Backpatch to 9.5, where the assertion was added.

src/backend/access/nbtree/nbtree.c

index 9431ab5d042811a45fd53df2918c34abac3249f1..cf4a6dc7c478075286f00e88903336cafdeca760 100644 (file)
@@ -881,7 +881,7 @@ btvacuumpage(BTVacState *vstate, BlockNumber blkno, BlockNumber orig_blkno)
    BlockNumber recurse_to;
    Buffer      buf;
    Page        page;
-   BTPageOpaque opaque;
+   BTPageOpaque opaque = NULL;
 
 restart:
    delete_now = false;
@@ -900,9 +900,11 @@ restart:
                             info->strategy);
    LockBuffer(buf, BT_READ);
    page = BufferGetPage(buf);
-   opaque = (BTPageOpaque) PageGetSpecialPointer(page);
    if (!PageIsNew(page))
+   {
        _bt_checkpage(rel, buf);
+       opaque = (BTPageOpaque) PageGetSpecialPointer(page);
+   }
 
    /*
     * If we are recursing, the only case we want to do anything with is a