Add a fallback_application_name parameter to conninfo to identify

the connection if application_name is not set
This commit is contained in:
Jaime Casanova
2011-05-08 19:26:59 -05:00
parent c4ae5741a3
commit 1e8b9e8960

View File

@@ -25,7 +25,12 @@ PGconn *
establishDBConnection(const char *conninfo, const bool exit_on_error)
{
/* Make a connection to the database */
PGconn *conn = PQconnectdb(conninfo);
PGconn *conn = NULL;
char connection_string[MAXLEN];
strcpy(connection_string, conninfo);
strcat(connection_string, " fallback_application_name='repmgr'");
conn = PQconnectdb(connection_string);
/* Check to see that the backend connection was successfully made */
if ((PQstatus(conn) != CONNECTION_OK))