summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTomas Vondra2017-01-12 09:47:38 +0000
committerTomas Vondra2017-01-12 09:47:38 +0000
commitfd2f70e36c2906b8a49907a5266a9a46450ca7b2 (patch)
treea7aac76db34bb47e65f670562a170f9f4084351f
parent7e46863af5bdbcbf0a62592f6de6a8cfb87dc67f (diff)
make pgxc_ctl connect to 'postgres' database when pinging a node
pingNode() was not specifying database in the connection string, so the OS username was used implicitly. When such database did not exist (e.g. when initializing new nodes, under OS account different from 'postgres'), this resulted in FATAL failures in the server log: FATAL: database "user" does not exist Adding 'database=postgres' to the connection string fixes the issue. It might be useful to allow using custom database names, but 'postgres' is pretty much guaranteed to exist. Bug report by me, patch by Pavan Deolasee.
-rw-r--r--contrib/pgxc_ctl/utils.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/contrib/pgxc_ctl/utils.c b/contrib/pgxc_ctl/utils.c
index 96c487f20c..501e7f83ea 100644
--- a/contrib/pgxc_ctl/utils.c
+++ b/contrib/pgxc_ctl/utils.c
@@ -312,6 +312,9 @@ int pingNode(char *host, char *port)
snprintf(editBuf, MAXPATH, "port = %d ", atoi(port));
strncat(conninfo, editBuf, MAXLINE);
}
+
+ strncat(conninfo, "dbname = postgres ", MAXLINE);
+
if (conninfo[0])
{
status = PQping(conninfo);