aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMichael Paquier <michael@paquier.xyz>2023-12-24 11:49:14 +0900
committerMichael Paquier <michael@paquier.xyz>2023-12-24 11:49:14 +0900
commit64e77b496af61ee31189ba69b40e785e11e9967f (patch)
tree02c9f4512a8661d7032d9af124ddbb7fb65978fc /src
parentda44ff312ea3b2868b8fab68944017cb56427709 (diff)
downloadpostgresql-64e77b496af61ee31189ba69b40e785e11e9967f.tar.gz
postgresql-64e77b496af61ee31189ba69b40e785e11e9967f.zip
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 e35cc3b3f2d0 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
Diffstat (limited to 'src')
-rw-r--r--src/bin/pgbench/pgbench.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/bin/pgbench/pgbench.c b/src/bin/pgbench/pgbench.c
index 2e1650d0ad3..1253f1989e6 100644
--- a/src/bin/pgbench/pgbench.c
+++ b/src/bin/pgbench/pgbench.c
@@ -4908,7 +4908,7 @@ initPopulateTable(PGconn *con, const char *table, int64 base,
initRowMethod init_row)
{
int n;
- int k;
+ int64 k;
int chars = 0;
PGresult *res;
PQExpBufferData sql;