From: Marc Fournier Date: Wed, 8 Nov 2017 16:26:51 +0000 (+0100) Subject: postgresql: fix last sum() related parse errors X-Git-Tag: collectd-5.8.0~1^2~6 X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=19b51c4abd9dbff16fb69d7eb84422f31c6130bc;p=collectd.git postgresql: fix last sum() related parse errors These queries return empty values when a database doesn't have any tables yet, which results in collectd logging this error every Interval: ``` db query utils: udb_result_submit: Parsing `' as derive failed. ``` Related to #1905 --- diff --git a/src/postgresql_default.conf b/src/postgresql_default.conf index 0aac41e2..50799013 100644 --- a/src/postgresql_default.conf +++ b/src/postgresql_default.conf @@ -38,9 +38,9 @@ - Statement "SELECT sum(n_tup_ins) AS ins, \ - sum(n_tup_upd) AS upd, \ - sum(n_tup_del) AS del \ + Statement "SELECT coalesce(sum(n_tup_ins), 0) AS ins, \ + coalesce(sum(n_tup_upd), 0) AS upd, \ + coalesce(sum(n_tup_del), 0) AS del \ FROM pg_stat_user_tables;" @@ -63,10 +63,10 @@ - Statement "SELECT sum(n_tup_ins) AS ins, \ - sum(n_tup_upd) AS upd, \ - sum(n_tup_del) AS del, \ - sum(n_tup_hot_upd) AS hot_upd \ + Statement "SELECT coalesce(sum(n_tup_ins), 0) AS ins, \ + coalesce(sum(n_tup_upd), 0) AS upd, \ + coalesce(sum(n_tup_del), 0) AS del, \ + coalesce(sum(n_tup_hot_upd), 0) AS hot_upd \ FROM pg_stat_user_tables;" @@ -188,7 +188,8 @@ - Statement "SELECT sum(n_live_tup) AS live, sum(n_dead_tup) AS dead \ + Statement "SELECT coalesce(sum(n_live_tup), 0) AS live, \ + coalesce(sum(n_dead_tup), 0) AS dead \ FROM pg_stat_user_tables;"