diff --git a/src/bin/pgbench/pgbench.c b/src/bin/pgbench/pgbench.c index cf8dec81eec..e0dfadcf414 100644 --- a/src/bin/pgbench/pgbench.c +++ b/src/bin/pgbench/pgbench.c @@ -716,7 +716,7 @@ usage(void) " -q, --quiet quiet logging (one message each 5 seconds)\n" " -s, --scale=NUM scaling factor\n" " --foreign-keys create foreign key constraints between tables\n" - " --use-unique-keys make the indexes that are created non-unique indexes\n" + " --use-non-unique-keys make the indexes that are created non-unique indexes\n" " (default: unique)\n" " --index-tablespace=TABLESPACE\n" " create indexes in the specified tablespace\n" @@ -4382,7 +4382,11 @@ initCreatePKeys(PGconn *con) int i; PQExpBufferData query; - fprintf(stderr, "creating primary keys...\n"); + if (use_unique_key) + fprintf(stderr, "creating primary keys...\n"); + else + fprintf(stderr, "creating non-unique keys...\n"); + initPQExpBuffer(&query); for (i = 0; i < lengthof(DDLINDEXes); i++) @@ -5837,7 +5841,8 @@ main(int argc, char **argv) {"show-script", required_argument, NULL, 10}, {"partitions", required_argument, NULL, 11}, {"partition-method", required_argument, NULL, 12}, - {"use-unique-keys", no_argument, &use_unique_key, 1}, + /* Cloudberry-specific */ + {"use-non-unique-keys", no_argument, NULL, 13}, {NULL, 0, NULL, 0} }; @@ -6217,6 +6222,9 @@ main(int argc, char **argv) exit(1); } break; + case 13: + use_unique_key = 0; + break; default: fprintf(stderr, _("Try \"%s --help\" for more information.\n"), progname); exit(1); diff --git a/src/bin/pgbench/t/001_pgbench_with_server.pl b/src/bin/pgbench/t/001_pgbench_with_server.pl index 796eb57208d..282ccc24aeb 100644 --- a/src/bin/pgbench/t/001_pgbench_with_server.pl +++ b/src/bin/pgbench/t/001_pgbench_with_server.pl @@ -100,6 +100,19 @@ ], 'pgbench --init-steps'); + +# Test interaction of --init-steps with legacy step-selection options +$node->pgbench( + '--initialize --use-non-unique-keys', + 0, + [qr{^$}], + [ + qr{creating tables}, + qr{creating non-unique keys}, + qr{done in \d+\.\d\d s } + ], + 'pgbench --use-non-unique-keys'); + # Run all builtin scripts, for a few transactions each $node->pgbench( '--transactions=5 -Dfoo=bla --client=2 --protocol=simple --builtin=t'