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:
Jaime Casanova
2011-07-26 18:36:27 -05:00
parent c983fdf83c
commit 28c5ac3d91

View File

@@ -73,7 +73,7 @@ bool
is_standby(PGconn *conn)
{
PGresult *res;
bool result;
bool result = false;
res = PQexec(conn, "SELECT pg_is_in_recovery()");
@@ -86,9 +86,7 @@ is_standby(PGconn *conn)
exit(ERR_DB_QUERY);
}
if (strcmp(PQgetvalue(res, 0, 0), "f") == 0)
result = false;
else
if (PQntuples(res) == 1 && strcmp(PQgetvalue(res, 0, 0), "t") == 0)
result = true;
PQclear(res);