Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 11 additions & 3 deletions src/bin/pgbench/pgbench.c
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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++)
Expand Down Expand Up @@ -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}
};

Expand Down Expand Up @@ -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);
Expand Down
13 changes: 13 additions & 0 deletions src/bin/pgbench/t/001_pgbench_with_server.pl
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down
Loading