diff options
author | Fujii Masao | 2020-02-12 00:08:22 +0000 |
---|---|---|
committer | Fujii Masao | 2020-02-12 00:08:22 +0000 |
commit | be6221e9be234109aa261ea767c85f5e8cda90e8 (patch) | |
tree | e7a17109919009cf417bcbdcd7e5aa0d399678ce | |
parent | e49d5ebbaebc3ecd6b495fda9518c2c2fac5c296 (diff) |
Fix bug in pg_basebackup -F plain -R.
Commit caba97a9d9 changed pg_basebackup -F plain -R so that
it overwrote postgresql.auto.conf in the backup, with new connection
setting. This could cause the existing postgresql.auto.conf settings
in the server to get lost unexpectedly. This is a bug.
This commit fixes the bug by making pg_basebackup -F plain -R
append the connection setting into postgresql.auto.conf in the backup.
Author: Fujii Masao
Reviewed-by: Sergei Kornilov
Discussion: https://postgr.es/m/[email protected]
-rw-r--r-- | src/fe_utils/recovery_gen.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/fe_utils/recovery_gen.c b/src/fe_utils/recovery_gen.c index facfb6b1f6..46ca20e20b 100644 --- a/src/fe_utils/recovery_gen.c +++ b/src/fe_utils/recovery_gen.c @@ -128,7 +128,7 @@ WriteRecoveryConfig(PGconn *pgconn, char *target_dir, PQExpBuffer contents) snprintf(filename, MAXPGPATH, "%s/%s", target_dir, use_recovery_conf ? "recovery.conf" : "postgresql.auto.conf"); - cf = fopen(filename, use_recovery_conf ? "a" : "w"); + cf = fopen(filename, use_recovery_conf ? "w" : "a"); if (cf == NULL) { pg_log_error("could not open file \"%s\": %m", filename); |