mirror of
https://github.com/EnterpriseDB/repmgr.git
synced 2026-03-27 08:56:29 +00:00
Make is_standby() and is_witness() work the same way, actually
is_standby() can show the segmentation fault problem but for code clearity
This commit is contained in:
@@ -73,7 +73,7 @@ bool
|
|||||||
is_standby(PGconn *conn)
|
is_standby(PGconn *conn)
|
||||||
{
|
{
|
||||||
PGresult *res;
|
PGresult *res;
|
||||||
bool result;
|
bool result = false;
|
||||||
|
|
||||||
res = PQexec(conn, "SELECT pg_is_in_recovery()");
|
res = PQexec(conn, "SELECT pg_is_in_recovery()");
|
||||||
|
|
||||||
@@ -86,9 +86,7 @@ is_standby(PGconn *conn)
|
|||||||
exit(ERR_DB_QUERY);
|
exit(ERR_DB_QUERY);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (strcmp(PQgetvalue(res, 0, 0), "f") == 0)
|
if (PQntuples(res) == 1 && strcmp(PQgetvalue(res, 0, 0), "t") == 0)
|
||||||
result = false;
|
|
||||||
else
|
|
||||||
result = true;
|
result = true;
|
||||||
|
|
||||||
PQclear(res);
|
PQclear(res);
|
||||||
|
|||||||
Reference in New Issue
Block a user