Clean up CREATE DATABASE processing to make it more robust and get rid

Tom Lane <tgl@sss.pgh.pa.us>

Commit: 558730ac6bbc668a75c7a7619beae5a1b34d965f
Author: Tom Lane <tgl@sss.pgh.pa.us>
Date: 2005-08-02T19:02:32Z
Releases: 8.1.0
Clean up CREATE DATABASE processing to make it more robust and get rid
of special case for Windows port.  Put a PG_TRY around most of createdb()
to ensure that we remove copied subdirectories on failure, even if the
failure happens while creating the pg_database row.  (I think this explains
Oliver Siegmar's recent report.)  Having done that, there's no need for
the fragile assumption that copydir() mustn't ereport(ERROR), so simplify
its API.  Eliminate the old code that used system("cp ...") to copy
subdirectories, in favor of using copydir() on all platforms.  This not
only should allow much better error reporting, but allows us to fsync
the created files before trusting that the copy has succeeded.

Files

PathChange+/−
configure modified +0 −8
configure.in modified +1 −2
src/backend/commands/dbcommands.c modified +165 −214
src/include/port.h modified +3 −3
src/Makefile.global.in modified +3 −5
src/port/copydir.c modified +101 −45