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:
@@ -1610,7 +1610,7 @@ which contains connection details for the local database.
|
||||
|
||||
Creates a witness server as a separate PostgreSQL instance. This instance
|
||||
can be on a separate server or a server running an existing node. The
|
||||
witness server contain a copy of the repmgr metadata tables but will not
|
||||
witness server contains a copy of the repmgr metadata tables but will not
|
||||
be set up as a standby; instead it will update its metadata copy each
|
||||
time a failover occurs.
|
||||
|
||||
|
||||
16
repmgr.c
16
repmgr.c
@@ -283,7 +283,11 @@ main(int argc, char **argv)
|
||||
|
||||
/*
|
||||
* Pre-set any defaults , which can be overwritten if matching
|
||||
* command line parameters are provided
|
||||
* command line parameters are provided.
|
||||
*
|
||||
* Note: PQconndefaults() does not provide a default value for
|
||||
* "dbname", but if none is provided will default to "username"
|
||||
* when the connection is made.
|
||||
*/
|
||||
|
||||
for (c = 0; c < source_conninfo.size && source_conninfo.keywords[c]; c++)
|
||||
@@ -316,7 +320,6 @@ main(int argc, char **argv)
|
||||
}
|
||||
|
||||
/* set default user for -R/--remote-user */
|
||||
|
||||
{
|
||||
struct passwd *pw = NULL;
|
||||
|
||||
@@ -330,15 +333,6 @@ main(int argc, char **argv)
|
||||
strncpy(runtime_options.username, pw->pw_name, MAXLEN);
|
||||
}
|
||||
|
||||
/*
|
||||
* 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);
|
||||
}
|
||||
|
||||
while ((c = getopt_long(argc, argv, "?Vd:h:p:U:S:D:f:R:w:k:FWIvb:rcL:tm:C:l:P", long_options,
|
||||
&optindex)) != -1)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user