Skip to content

Commit f2a3cdb

Browse files
committed
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.
1 parent 6c75384 commit f2a3cdb

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

contrib/pgbench/pgbench.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2299,6 +2299,10 @@ printResults(int ttype, int64 normal_xacts, int nclients,
22992299
normal_xacts);
23002300
}
23012301

2302+
/* Remaining stats are nonsensical if we failed to execute any xacts */
2303+
if (normal_xacts <= 0)
2304+
return;
2305+
23022306
if (throttle_delay || progress)
23032307
{
23042308
/* compute and show latency average and standard deviation */

0 commit comments

Comments
 (0)