Force a checkpoint in CREATE DATABASE before starting to copy the files,
commitf01240b5e3c5125cb7acc4b626fd2080c7a113a7
authorheikki <heikki>
Thu, 9 Oct 2008 10:34:06 +0000 (9 10:34 +0000)
committerheikki <heikki>
Thu, 9 Oct 2008 10:34:06 +0000 (9 10:34 +0000)
tree88bde27b573e3f33079ab22aae453bd2e122731a
parent19edb6229edeadc648bd03548ee20b79530c46a9
Force a checkpoint in CREATE DATABASE before starting to copy the files,
to process any pending unlinks for the source database.

Before, if you dropped a relation in the template database just before
CREATE DATABASE, and a checkpoint happened during copydir(), the checkpoint
might delete a file that we're just about to copy, causing lstat() in
copydir() to fail with ENOENT.

Backpatch to 8.3, where the pending unlinks were introduced.

Per report by Matthew Wakeling and analysis by Tom Lane.
src/backend/commands/dbcommands.c