Force a checkpoint in CREATE DATABASE before starting to copy the files,
authorHeikki Linnakangas <heikki@enterprisedb.com>
Thu, 9 Oct 2008 10:34:22 +0000 (10:34 +0000)
committerHeikki Linnakangas <heikki@enterprisedb.com>
Thu, 9 Oct 2008 10:34:22 +0000 (10:34 +0000)
commit274702451aa0ec031f61f832c43111d92d9dd122
treed7b45b05ab032048d2b9dcffa4cf93eed929ef12
parent1f8762f18e777374e90adcd133cc3371e2630d6e
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