Re: pg_basebackup -F plain -R overwrites postgresql.auto.conf

Sergei Kornilov <sk@zsrv.org>

From: Sergei Kornilov <sk@zsrv.org>
To: Fujii Masao <masao.fujii@oss.nttdata.com>, "pgsql-hackers@postgresql.org" <pgsql-hackers@postgresql.org>
Date: 2020-02-10T08:23:49Z
Lists: pgsql-hackers
Hello

Seems bug was introduced in caba97a9d9f4d4fa2531985fd12d3cd823da06f3 - in HEAD only

In REL_12_STABLE we have:

	bool		is_recovery_guc_supported = true;

	if (PQserverVersion(conn) < MINIMUM_VERSION_FOR_RECOVERY_GUC)
		is_recovery_guc_supported = false;

	snprintf(filename, MAXPGPATH, "%s/%s", basedir,
			 is_recovery_guc_supported ? "postgresql.auto.conf" : "recovery.conf");

	cf = fopen(filename, is_recovery_guc_supported ? "a" : "w");

It looks correct: append mode for postgresql.auto.conf

In HEAD version is_recovery_guc_supported variable was replaced to inversed use_recovery_conf without change fopen mode.

regards, Sergei



Commits

  1. Fix bug in pg_basebackup -F plain -R.

  2. Split out recovery confing-writing code from pg_basebackup