mirror of
https://github.com/EnterpriseDB/repmgr.git
synced 2026-03-22 22:56:29 +00:00
"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:
33
dbutils.c
33
dbutils.c
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user