"standby clone": fix --superuser handling

get_superuser_connection() was erroneously using the local node record
to connect to as a superuser, which works when registering the primary
but obviously not when cloning a standby.

Addresses GitHub #380.
This commit is contained in:
Ian Barwick
2018-03-02 14:46:27 +09:00
parent 40ccae57a3
commit 9981ede1af
6 changed files with 42 additions and 51 deletions

View File

@@ -219,8 +219,7 @@ establish_db_connection_quiet(const char *conninfo)
}
PGconn
*
PGconn *
establish_primary_db_connection(PGconn *conn,
const bool exit_on_error)
{
@@ -237,36 +236,6 @@ establish_primary_db_connection(PGconn *conn,
}
PGconn *
establish_db_connection_as_user(const char *conninfo,
const char *user,
const bool exit_on_error)
{
PGconn *conn = NULL;
t_conninfo_param_list conninfo_params = T_CONNINFO_PARAM_LIST_INITIALIZER;
bool parse_success = false;
char *errmsg = NULL;
initialize_conninfo_params(&conninfo_params, false);
parse_success = parse_conninfo_string(conninfo, &conninfo_params, errmsg, true);
if (parse_success == false)
{
log_error(_("unable to pass provided conninfo string:\n %s"), errmsg);
return NULL;
}
param_set(&conninfo_params, "user", user);
conn = establish_db_connection_by_params(&conninfo_params, false);
return conn;
}
PGconn *
establish_db_connection_by_params(t_conninfo_param_list *param_list,
const bool exit_on_error)