From: Tom Lane Date: Tue, 16 Dec 2014 19:53:58 +0000 (-0500) Subject: Suppress bogus statistics when pgbench failed to complete any transactions. X-Git-Tag: REL9_4_1~100 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=f2a3cdb6dbe4984c7b5461ed4ece789eab2faf4a;p=postgresql Suppress bogus statistics when pgbench failed to complete any transactions. Code added in 9.4 would attempt to divide by zero in such cases. Noted while testing fix for missing-pclose problem. --- diff --git a/contrib/pgbench/pgbench.c b/contrib/pgbench/pgbench.c index bd5e265b84..ed7fc1946e 100644 --- a/contrib/pgbench/pgbench.c +++ b/contrib/pgbench/pgbench.c @@ -2299,6 +2299,10 @@ printResults(int ttype, int64 normal_xacts, int nclients, normal_xacts); } + /* Remaining stats are nonsensical if we failed to execute any xacts */ + if (normal_xacts <= 0) + return; + if (throttle_delay || progress) { /* compute and show latency average and standard deviation */