From a6f1c6e483800b4f201b5586ff978d984a2208cb Mon Sep 17 00:00:00 2001 From: Ian Barwick Date: Mon, 26 Dec 2016 12:38:22 +0900 Subject: [PATCH] repmgr: use provided --replication-user in pg_basebackup mode --- repmgr.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/repmgr.c b/repmgr.c index e0b32ed8..6521019a 100644 --- a/repmgr.c +++ b/repmgr.c @@ -6991,7 +6991,11 @@ run_basebackup(const char *data_dir, int server_version) appendPQExpBuffer(¶ms, " -p %s", runtime_options.masterport); } - if (strlen(runtime_options.username)) + if (strlen(runtime_options.replication_user)) + { + appendPQExpBuffer(¶ms, " -U %s", runtime_options.replication_user); + } + else if (strlen(runtime_options.username)) { appendPQExpBuffer(¶ms, " -U %s", runtime_options.username); } @@ -8048,6 +8052,9 @@ check_upstream_config(PGconn *conn, int server_version_num, bool exit_on_error) param_set(&repl_conninfo, "replication", "1"); + if (*runtime_options.replication_user) + param_set(&repl_conninfo, "user", runtime_options.replication_user); + /* * work out how many replication connections are required (1 or 2) */