Commit be6221e9 authored by Fujii Masao's avatar Fujii Masao

Fix bug in pg_basebackup -F plain -R.

Commit caba97a9 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/250dcf2a-94e7-c05e-824a-73cfb38a48a4@oss.nttdata.com
parent e49d5ebb
...@@ -128,7 +128,7 @@ WriteRecoveryConfig(PGconn *pgconn, char *target_dir, PQExpBuffer contents) ...@@ -128,7 +128,7 @@ WriteRecoveryConfig(PGconn *pgconn, char *target_dir, PQExpBuffer contents)
snprintf(filename, MAXPGPATH, "%s/%s", target_dir, snprintf(filename, MAXPGPATH, "%s/%s", target_dir,
use_recovery_conf ? "recovery.conf" : "postgresql.auto.conf"); 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) if (cf == NULL)
{ {
pg_log_error("could not open file \"%s\": %m", filename); pg_log_error("could not open file \"%s\": %m", filename);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment