Hi, I found that pg_basebackup -F plain -R *overwrites* postgresql.auto.conf taken from the primary server with new primary_conninfo setting, while pg_basebackup -F tar -R just *appends* it into the file. I think that this is a bug and pg_basebackup -F plain -R should *append* the setting. Thought?
I attached the patch to fix the bug. This patch should be back-patch to v12. Regards, -- Fujii Masao NTT DATA CORPORATION Advanced Platform Technology Group Research and Development Headquarters
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);