Confusing error message in pgbench

Started by Tatsuo Ishiiover 8 years ago7 messageshackers
Jump to latest
#1Tatsuo Ishii
t-ishii@sra.co.jp

I found an error message in pgbench is quite confusing.

pgbench -S -M extended -c 1 -T 30 test
query mode (-M) should be specified before any transaction scripts (-f or -b)

Since there's no -f or -b option is specified, users will be
confused. Actually the error occurs because pgbench implicitly
introduces a built in script for -S. To eliminate the confusion, I
think the error message should be fixed like this:

query mode (-M) should be specified before transaction type (-S or -N) or any transaction scripts (-f or -b)

Patch attached.

Best regards,
--
Tatsuo Ishii
SRA OSS, Inc. Japan
English: http://www.sraoss.co.jp/index_en.php
Japanese:http://www.sraoss.co.jp

Attachments:

pgbench.difftext/x-patch; charset=us-asciiDownload+1-1
#2Robert Haas
robertmhaas@gmail.com
In reply to: Tatsuo Ishii (#1)
Re: Confusing error message in pgbench

On Tue, Aug 1, 2017 at 10:03 PM, Tatsuo Ishii <ishii@sraoss.co.jp> wrote:

I found an error message in pgbench is quite confusing.

pgbench -S -M extended -c 1 -T 30 test
query mode (-M) should be specified before any transaction scripts (-f or -b)

Since there's no -f or -b option is specified, users will be
confused. Actually the error occurs because pgbench implicitly
introduces a built in script for -S. To eliminate the confusion, I
think the error message should be fixed like this:

query mode (-M) should be specified before transaction type (-S or -N) or any transaction scripts (-f or -b)

Patch attached.

Not really objecting, but an even better fix might be to remove the
restriction on the order in which the options can be specified.

--
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company

--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

#3Fabien COELHO
coelho@cri.ensmp.fr
In reply to: Tatsuo Ishii (#1)
Re: Confusing error message in pgbench

Hello Tatsuo-san,

I found an error message in pgbench is quite confusing.

pgbench -S -M extended -c 1 -T 30 test
query mode (-M) should be specified before any transaction scripts (-f or -b)

Since there's no -f or -b option is specified, users will be
confused.

Indeed.

Actually the error occurs because pgbench implicitly introduces a built
in script for -S. To eliminate the confusion, I think the error message
should be fixed like this:

The idea is that -S/-N documentations say that it is just a shortcut for
-b, but the explanation (eg --help) is too far away.

query mode (-M) should be specified before transaction type (-S or -N)
or any transaction scripts (-f or -b)

I would suggest to make it even shorter, see attached:

query mode (-M) should be specified before any transaction scripts (-f,
-b, -S or -N).

I'm wondering whether it could/should be "any transaction script". My
English level does not allow to decide.

--
Fabien.

Attachments:

pgbench-query-mode-error-2.patchtext/x-diff; name=pgbench-query-mode-error-2.patchDownload+1-1
#4Tom Lane
tgl@sss.pgh.pa.us
In reply to: Robert Haas (#2)
Re: Confusing error message in pgbench

Robert Haas <robertmhaas@gmail.com> writes:

On Tue, Aug 1, 2017 at 10:03 PM, Tatsuo Ishii <ishii@sraoss.co.jp> wrote:

I found an error message in pgbench is quite confusing.

Not really objecting, but an even better fix might be to remove the
restriction on the order in which the options can be specified.

Indeed. It doesn't look that hard: AFAICS the problem is just that
process_sql_command() is making premature decisions about whether to
extract parameters from the SQL commands. Proposed patch attached.

regards, tom lane

Attachments:

remove-pgbench-option-ordering-constraint.patchtext/x-diff; charset=us-ascii; name=remove-pgbench-option-ordering-constraint.patchDownload+38-33
#5Tatsuo Ishii
t-ishii@sra.co.jp
In reply to: Robert Haas (#2)
Re: Confusing error message in pgbench

Not really objecting, but an even better fix might be to remove the
restriction on the order in which the options can be specified.

+100 :-)

Best regards,
--
Tatsuo Ishii
SRA OSS, Inc. Japan
English: http://www.sraoss.co.jp/index_en.php
Japanese:http://www.sraoss.co.jp

--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

#6Tatsuo Ishii
t-ishii@sra.co.jp
In reply to: Tom Lane (#4)
Re: Confusing error message in pgbench

Not really objecting, but an even better fix might be to remove the
restriction on the order in which the options can be specified.

Indeed. It doesn't look that hard: AFAICS the problem is just that
process_sql_command() is making premature decisions about whether to
extract parameters from the SQL commands. Proposed patch attached.

Great. Patch looks good to me.

Best regards,
--
Tatsuo Ishii
SRA OSS, Inc. Japan
English: http://www.sraoss.co.jp/index_en.php
Japanese:http://www.sraoss.co.jp

--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

#7Fabien COELHO
coelho@cri.ensmp.fr
In reply to: Tatsuo Ishii (#6)
Re: Confusing error message in pgbench

Indeed. It doesn't look that hard: AFAICS the problem is just that
process_sql_command() is making premature decisions about whether to
extract parameters from the SQL commands. Proposed patch attached.

Great. Patch looks good to me.

Too me as well: code looks ok, patch applies, compiles, make check
ok, manual tests with pgbench ok.

That is one more patch about pgbench in the queue.

--
Fabien.

--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers