Prevent overflow in pgbench's percent-done display.
authorTom Lane <tgl@sss.pgh.pa.us>
Sat, 20 Oct 2012 16:44:18 +0000 (12:44 -0400)
committerTom Lane <tgl@sss.pgh.pa.us>
Sat, 20 Oct 2012 16:44:18 +0000 (12:44 -0400)
Per Thom Brown.

contrib/pgbench/pgbench.c

index 5d48aeeae476e1a09acc64497b4adf45e063aadc..090c21019e6dc56d44883284f556fddd8525f332 100644 (file)
@@ -1444,7 +1444,7 @@ init(bool is_no_vacuum)
        if (j % 100000 == 0)
            fprintf(stderr, "%d of %d tuples (%d%%) done.\n",
                    j, naccounts * scale,
-                   j * 100 / (naccounts * scale));
+                   (int) (((int64) j * 100) / (naccounts * scale)));
    }
    if (PQputline(con, "\\.\n"))
    {