Don't assume that PageIsEmpty() returns true on an all-zeros page.
authorHeikki Linnakangas <[email protected]>
Mon, 27 Jul 2015 15:54:09 +0000 (18:54 +0300)
committerHeikki Linnakangas <[email protected]>
Mon, 27 Jul 2015 15:54:36 +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 5b457f679451262ad2122bb6593f49baceff990c..7092647c039e7244fb181993054de21904bcf90c 100644 (file)
@@ -656,7 +656,7 @@ spgvacuumpage(spgBulkDeleteState *bds, BlockNumber blkno)
     */
    if (!SpGistBlockIsRoot(blkno))
    {
-       if (PageIsEmpty(page))
+       if (PageIsNew(page) || PageIsEmpty(page))
        {
            RecordFreeIndexPage(index, blkno);
            bds->stats->pages_deleted++;