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:30 +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 9033a9df35f9e11ce1eb3eb7f18e58041fe8af26..c0fff4c6b80ea9e11f316aa5e2723fbb53cc4e21 100644 (file)
@@ -652,7 +652,7 @@ spgvacuumpage(spgBulkDeleteState *bds, BlockNumber blkno)
     */
    if (!SpGistBlockIsRoot(blkno))
    {
-       if (PageIsEmpty(page))
+       if (PageIsNew(page) || PageIsEmpty(page))
        {
            RecordFreeIndexPage(index, blkno);
            bds->stats->pages_deleted++;