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