From: Sebastian Harl Date: Sat, 7 Mar 2009 16:43:54 +0000 (+0100) Subject: postgresql_default.conf: Make sure the "disk_io" query does not return NULLs. X-Git-Tag: collectd-4.6.2~5^2 X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=54fb57fbc5658fc3d150219d07d840178d64d087;p=collectd.git postgresql_default.conf: Make sure the "disk_io" query does not return NULLs. Starting with some version between 8.3.3 and 8.3.6, pg_statio_*_tables returns NULL instead of 0 for statistics if no instance of the appropriate relation exists. PQgetvalue() returns an empty string in that case which would then result in error messages when udb_result_submit() tries to convert that to a number. Now, the "disk_io" query uses PostgreSQL's coalesce() function to make sure 0 is returned instead of NULL. --- diff --git a/src/postgresql_default.conf b/src/postgresql_default.conf index 61844a02..5b024ca1 100644 --- a/src/postgresql_default.conf +++ b/src/postgresql_default.conf @@ -67,10 +67,14 @@ - Query "SELECT sum(heap_blks_read), sum(heap_blks_hit), \ - sum(idx_blks_read), sum(idx_blks_hit), \ - sum(toast_blks_read), sum(toast_blks_hit), \ - sum(tidx_blks_read), sum(tidx_blks_hit) \ + Query "SELECT coalesce(sum(heap_blks_read), 0), \ + coalesce(sum(heap_blks_hit), 0), \ + coalesce(sum(idx_blks_read), 0), \ + coalesce(sum(idx_blks_hit), 0), \ + coalesce(sum(toast_blks_read), 0), \ + coalesce(sum(toast_blks_hit), 0), \ + coalesce(sum(tidx_blks_read), 0), \ + coalesce(sum(tidx_blks_hit), 0) \ FROM pg_statio_user_tables;" Column pg_blks heap_read @@ -91,3 +95,5 @@ Column pg_db_size +# vim: set ft=config : +