repmgr: fix generation of default "dbname"

If not explicitly provided, "dbname" was being set early to the default
"username" value, which was leading to different behaviour to libpq
applications, where "dbname" defaults to "username" at connection
time.
This commit is contained in:
Ian Barwick
2017-06-28 22:21:43 +09:00
committed by Ian Barwick
parent a666a49977
commit c793b1b7d2

View File

@@ -90,6 +90,10 @@ main(int argc, char **argv)
*
* Only some actions will need these, but we need to do this before
* the command line is parsed.
*
* Note: PQconndefaults() does not provide a default value for
* "dbname", but if none is provided will default to "username"
* when the connection is made.
*/
initialize_conninfo_params(&source_conninfo, true);
@@ -123,15 +127,6 @@ main(int argc, char **argv)
}
}
/*
* Though libpq will default to the username as dbname, PQconndefaults()
* doesn't return this
*/
if (runtime_options.dbname[0] == '\0')
{
strncpy(runtime_options.dbname, runtime_options.username, MAXLEN);
}
/* set default user for -R/--remote-user */
{