Add function test_db_connection()

The difference between this and establish_db_connection() is that
it outputs any connection failure as a [NOTICE] rather than an
[ERROR]; it's intended for use in e.g. polling a server to wait
for it to come up/go down, while preventing [ERROR] log lines
which may cause confusion.
This commit is contained in:
Ian Barwick
2016-01-20 07:56:03 +09:00
parent 995083d66c
commit f982708b35
2 changed files with 31 additions and 4 deletions

View File

@@ -78,8 +78,13 @@ typedef struct s_replication_slot
InvalidXLogRecPtr \
}
PGconn *_establish_db_connection(const char *conninfo,
const bool exit_on_error,
const bool log_notice);
PGconn *establish_db_connection(const char *conninfo,
const bool exit_on_error);
const bool exit_on_error);
PGconn *test_db_connection(const char *conninfo,
const bool exit_on_error);
PGconn *establish_db_connection_by_params(const char *keywords[],
const char *values[],
const bool exit_on_error);