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:27 +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 d40da0eeccad20596f2082c94089965c9004df29..06c0b0af7eedcbb530e78b508a6ca6c1afabd79e 100644 (file)
@@ -655,7 +655,7 @@ spgvacuumpage(spgBulkDeleteState *bds, BlockNumber blkno)
     */
    if (!SpGistBlockIsRoot(blkno))
    {
-       if (PageIsEmpty(page))
+       if (PageIsNew(page) || PageIsEmpty(page))
        {
            RecordFreeIndexPage(index, blkno);
            bds->stats->pages_deleted++;