pgbench --partitions=0

From: Amit Langote <amitlangote09(at)gmail(dot)com>
To: PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Cc: Michael Paquier <michael(at)paquier(dot)xyz>
Subject: pgbench --partitions=0
Date: 2022-05-16 02:34:41
Message-ID: CA+HiwqGAGobiiHR8nH382HJxqm1mzZs8=3oKPXnXivWoFSZmNA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi,

I noticed that $subject causes an error in HEAD:

$ pgbench -i --partitions=0
pgbench: error: --partitions must be in range 1..2147483647

However, it works in v13 and v14, assuming no partitions.

I think the commit 6f164e6d17 may have unintentionally broken it, by
introducing this hunk:

@@ -6135,12 +6116,9 @@ main(int argc, char **argv)
break;
case 11: /* partitions */
initialization_option_set = true;
- partitions = atoi(optarg);
- if (partitions < 0)
- {
- pg_log_fatal("invalid number of partitions:
\"%s\"", optarg);
+ if (!option_parse_int(optarg, "--partitions", 1, INT_MAX,
+ &partitions))
exit(1);
- }

Attached a patch to fix with a test added. cc'ing Michael who
authored that commit.

--
Thanks, Amit Langote
EDB: http://www.enterprisedb.com

Attachment Content-Type Size
pgbench-accept-0-partitions.patch application/octet-stream 479 bytes

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Amit Kapila 2022-05-16 02:58:14 Re: PostgreSQL 15 Beta 1 release announcement draft
Previous Message Amit Kapila 2022-05-16 02:28:37 Re: list of TransactionIds