From 375a96a5c8f2ffb89c8c2b7ddacb7f8cbc0e59af Mon Sep 17 00:00:00 2001 From: Ian Barwick Date: Tue, 16 Jan 2018 11:14:04 +0900 Subject: [PATCH] repmgrd: log execution error in "repmgrd_get_local_node_id()" That shouldn't happen, but if it does it will make it easier to identify the issue. --- dbutils.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/dbutils.c b/dbutils.c index 4c805fa2..f5fbd1f2 100644 --- a/dbutils.c +++ b/dbutils.c @@ -1608,7 +1608,12 @@ repmgrd_get_local_node_id(PGconn *conn) res = PQexec(conn, "SELECT repmgr.get_local_node_id()"); - if (!PQgetisnull(res, 0, 0)) + if (PQresultStatus(res) != PGRES_TUPLES_OK) + { + log_error(_("unable to execute \"SELECT repmgr.get_local_node_id()\"")); + log_detail("%s", PQerrorMessage(conn)); + } + else if (!PQgetisnull(res, 0, 0)) { local_node_id = atoi(PQgetvalue(res, 0, 0)); }