pgsql plugin: avoid parsing error from query_plans
authorBernd Zeimetz <bernd@bzed.de>
Fri, 2 Sep 2016 11:23:40 +0000 (13:23 +0200)
committerMarc Fournier <marc.fournier@camptocamp.com>
Mon, 5 Sep 2016 06:59:11 +0000 (08:59 +0200)
idx_scan/idx_tup_fetch can be NULL, avoid trying to parse that into a number.

This should fix #1905.

src/postgresql_default.conf

index f905eb2..7ec971a 100644 (file)
 </Query>
 
 <Query query_plans>
-       Statement "SELECT sum(seq_scan) AS seq, \
-                       sum(seq_tup_read) AS seq_tup_read, \
-                       sum(idx_scan) AS idx, \
-                       sum(idx_tup_fetch) AS idx_tup_fetch \
+       Statement "SELECT coalesce(sum(seq_scan), 0) AS seq, \
+                         coalesce(sum(seq_tup_read), 0) AS seq_tup_read, \
+                         coalesce(sum(idx_scan), 0) AS idx, \
+                         coalesce(sum(idx_tup_fetch), 0) AS idx_tup_fetch \
                FROM pg_stat_user_tables;"
 
        <Result>