From: Sebastian Harl Date: Tue, 30 Mar 2010 20:09:55 +0000 (+0200) Subject: postgresql plugin: Let the read callback fail if all queries failed. X-Git-Tag: collectd-4.10.0~33 X-Git-Url: https://git.verplant.org/?a=commitdiff_plain;h=aa8eb582bd62448362a0146cc4de2fba40d92374;p=collectd.git postgresql plugin: Let the read callback fail if all queries failed. --- diff --git a/src/postgresql.c b/src/postgresql.c index 99e40fec..d390abdf 100644 --- a/src/postgresql.c +++ b/src/postgresql.c @@ -463,6 +463,8 @@ static int c_psql_exec_query (c_psql_database_t *db, udb_query_t *q, static int c_psql_read (user_data_t *ud) { c_psql_database_t *db; + + int success = 0; int i; if ((ud == NULL) || (ud->data == NULL)) { @@ -489,8 +491,12 @@ static int c_psql_read (user_data_t *ud) && (udb_query_check_version (q, db->server_version) <= 0)) continue; - c_psql_exec_query (db, q, prep_area); + if (0 == c_psql_exec_query (db, q, prep_area)) + success = 1; } + + if (! success) + return -1; return 0; } /* c_psql_read */