From: Tom Lane Date: Tue, 16 Dec 2014 19:53:55 +0000 (-0500) Subject: Suppress bogus statistics when pgbench failed to complete any transactions. X-Git-Tag: REL9_5_ALPHA1~1047 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=de8e46f5f5785f4016aabf2aa231faa89a0746fb;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 397403f221..d69036a2f5 100644 --- a/contrib/pgbench/pgbench.c +++ b/contrib/pgbench/pgbench.c @@ -2541,6 +2541,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 && latency_limit) printf("number of transactions skipped: " INT64_FORMAT " (%.3f %%)\n", throttle_latency_skipped,