Fix handling of pg_stat_statements.stat temporary file

Magnus Hagander <magnus@hagander.net>

Commit: 2791f2180d8e7c469fac2a4d88fc449689e4c970
Author: Magnus Hagander <magnus@hagander.net>
Date: 2012-05-27T08:58:14Z
Releases: 9.1.4
Fix handling of pg_stat_statements.stat temporary file

Write the file to a temporary name and then rename() it into the
permanent name, to ensure it can't end up half-written and corrupt
in case of a crash during shutdown.

Unlink the file after it has been read so it's removed from the data
directory and not included in base backups going to replication slaves.

Files

PathChange+/−
contrib/pg_stat_statements/pg_stat_statements.c modified +19 −3