Suppress bogus statistics when pgbench failed to complete any transactions.
authorTom Lane <tgl@sss.pgh.pa.us>
Tue, 16 Dec 2014 19:53:58 +0000 (14:53 -0500)
committerTom Lane <tgl@sss.pgh.pa.us>
Tue, 16 Dec 2014 19:53:58 +0000 (14:53 -0500)
Code added in 9.4 would attempt to divide by zero in such cases.
Noted while testing fix for missing-pclose problem.

contrib/pgbench/pgbench.c

index bd5e265b84bb58dc323ddf7a9ba8c501a33becaf..ed7fc1946ebd62adb0848dbec05e9c23cae2a012 100644 (file)
@@ -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 */