Don't assume that PageIsEmpty() returns true on an all-zeros page.
authorHeikki Linnakangas
Mon, 27 Jul 2015 15:54:09 +0000 (18:54 +0300)
committerHeikki Linnakangas
Mon, 27 Jul 2015 15:54:32 +0000 (18:54 +0300)
It does currently, and I don't see us changing that any time soon, but we
don't make that assumption anywhere else.

Per Tom Lane's suggestion. Backpatch to 9.2, like the previous patch that
added this assumption.

src/backend/access/spgist/spgvacuum.c

index 36ba24de583d6464ed1e097355a541b7dae9daf6..cffcbb5a53d6b18640a29dae6c11fd5e96e67d20 100644 (file)
@@ -653,7 +653,7 @@ spgvacuumpage(spgBulkDeleteState *bds, BlockNumber blkno)
     */
    if (!SpGistBlockIsRoot(blkno))
    {
-       if (PageIsEmpty(page))
+       if (PageIsNew(page) || PageIsEmpty(page))
        {
            RecordFreeIndexPage(index, blkno);
            bds->stats->pages_deleted++;