fix: correctly check the return value of PQexec()

not only check if return value is not NULL but also check that the
returned result is a PGRES_COMMAND_OK (e.g. the INSERT was successful)
This commit is contained in:
Christian Kruse
2014-01-07 14:27:31 +01:00
parent a97065113d
commit 7428e92e10

View File

@@ -743,7 +743,8 @@ do_standby_register(void)
options.conninfo, options.priority);
log_debug(_("standby register: %s\n"), sqlquery);
if (!PQexec(master_conn, sqlquery))
res = PQexec(master_conn, sqlquery);
if (!res || PQresultStatus(res) != PGRES_COMMAND_OK)
{
log_err(_("Cannot insert node details, %s\n"),
PQerrorMessage(master_conn));