Skip to content

Commit 64e77b4

Browse files
committed
pgbench: Fix overflow in table populating when rows >= 2^31-1
Using a scale factor large enough so as the number of rows to insert gets larger than INT32_MAX would cause an infinite loop in initPopulateTable(), preventing pgbench to finish its initialization. Oversight in e35cc3b that has refactored the data generation logic. Author: John Hsu Reviewed-by: Tatsuo Ishii, Japin Li Discussion: https://postgr.es/m/CA+-JvFvHsOafjHcuFPfkyouHNZvbOXhBNhwZxKm3WNgYz9bwzA@mail.gmail.com
1 parent da44ff3 commit 64e77b4

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/bin/pgbench/pgbench.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4908,7 +4908,7 @@ initPopulateTable(PGconn *con, const char *table, int64 base,
49084908
initRowMethod init_row)
49094909
{
49104910
int n;
4911-
int k;
4911+
int64 k;
49124912
int chars = 0;
49134913
PGresult *res;
49144914
PQExpBufferData sql;

0 commit comments

Comments
 (0)