Re: Inaccurate error message when set fdw batch_size to 0

From: Fujii Masao <masao(dot)fujii(at)oss(dot)nttdata(dot)com>
To: Bharath Rupireddy <bharath(dot)rupireddyforpostgres(at)gmail(dot)com>
Cc: Kyotaro Horiguchi <horikyota(dot)ntt(at)gmail(dot)com>, Amit Kapila <amit(dot)kapila16(at)gmail(dot)com>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, "Tsunakawa, Takayuki" <tsunakawa(dot)takay(at)fujitsu(dot)com>, houzj(dot)fnst(at)fujitsu(dot)com, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: Inaccurate error message when set fdw batch_size to 0
Date: 2021-07-12 15:49:58
Message-ID: af620ca0-bdf8-fab7-71d0-bb7e1c29e55a@oss.nttdata.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 2021/07/09 11:41, Bharath Rupireddy wrote:
> PSA v6 patch.

Thanks for updating the patch!

+ <simplesect>
+ <title>Avoid Using <quote>non-negative</quote> Word in Error Messages</title>
+
+ <para>
+ Do not use <quote>non-negative</quote> word in error messages as it looks
+ ambiguous. Instead, use <quote>foo must be an integer value greater than zero</quote>
+ or <quote>foo must be an integer value greater than or equal to zero</quote>
+ if option <quote>foo</quote> expects an integer value.
+ </para>
+ </simplesect>

It seems suitable to put this guide under "Tricky Words to Avoid"
rather than adding it as separate section. Thought?

- if (nworkers < 1)
+ if (nworkers <= 0)
ereport(ERROR,
(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
- errmsg("number of workers must be a positive integer")));
+ errmsg("number of workers must be an integer value greater than zero")));

You replaced "positve" with "greater than zero". So the error message
style guide should mention not only "non-negative" but also "positive"
(probably also "negative") keyword?

If this is true, there are still many messages using "positive" or "negative"
keyword as follows. We should also fix them at all? Of course,
which would increase the change too big unnecessarily, I'm afraid, though..

src/backend/storage/ipc/signalfuncs.c: errmsg("\"timeout\" must not be negative")));
src/backend/commands/functioncmds.c: errmsg("COST must be positive")));

Regards,

--
Fujii Masao
Advanced Computing Technology Center
Research and Development Headquarters
NTT DATA CORPORATION

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Bharath Rupireddy 2021-07-12 15:56:19 Use WaitLatch for {pre, post}_auth_delay instead of pg_usleep
Previous Message Andy Fan 2021-07-12 15:42:35 Re: Zedstore - compressed in-core columnar storage