pgbench: Move constant into format string
authorMichael Paquier
Tue, 11 Jul 2023 05:01:00 +0000 (14:01 +0900)
committerMichael Paquier
Tue, 11 Jul 2023 05:01:00 +0000 (14:01 +0900)
As coded, the row data strings generated for pgbench_accounts' COPY in
the client-side data generation were always assigning 0 for one of its
attributes.  This simplifies a bit an upcoming patch to switch
client-side data generation of pgbench to use COPY for the teller and
branch tables, rather than individual INSERTs.

Author: Tristan Partin
Discussion: https://postgr.es/m/CSTU5P82ONZ1.19XFUGHMXHBRY@c3po

src/bin/pgbench/pgbench.c

index 1d1670d4c2b570420011479c260b34ddfd0c19ff..320d348a0fe2db673fb5cc30978e116cd43e4e45 100644 (file)
@@ -4947,8 +4947,8 @@ initGenerateDataClientSide(PGconn *con)
 
        /* "filler" column defaults to blank padded empty string */
        printfPQExpBuffer(&sql,
-                         INT64_FORMAT "\t" INT64_FORMAT "\t%d\t\n",
-                         j, k / naccounts + 1, 0);
+                         INT64_FORMAT "\t" INT64_FORMAT "\t0\t\n",
+                         j, k / naccounts + 1);
        if (PQputline(con, sql.data))
            pg_fatal("PQputline failed");