Added code for Postgres < 11.8

This commit is contained in:
Andrew Kane
2023-12-19 13:55:56 -05:00
parent 041f939bde
commit 87fe23d9ec

View File

@@ -888,7 +888,21 @@ BuildIndex(Relation heap, Relation index, IndexInfo *indexInfo,
FlushPages(buildstate);
if (RelationNeedsWAL(index))
{
#if PG_VERSION_NUM >= 110008
log_newpage_range(index, MAIN_FORKNUM, 0, RelationGetNumberOfBlocks(index), true);
#else
for (BlockNumber blkno = 0; blkno < RelationGetNumberOfBlocksInFork(index, forkNum); blkno++)
{
Buffer buf = ReadBufferExtended(index, forkNum, blkno, RBM_NORMAL, NULL);
LockBuffer(buf, BUFFER_LOCK_EXCLUSIVE);
MarkBufferDirty(buf);
log_newpage_buffer(buf, true);
UnlockReleaseBuffer(buf);
}
#endif
}
FreeBuildState(buildstate);
}