Re: Remove an unnecessary errmsg_plural in dependency.c

From: Kyotaro Horiguchi <horikyota(dot)ntt(at)gmail(dot)com>
To: peter(dot)eisentraut(at)enterprisedb(dot)com
Cc: bharath(dot)rupireddyforpostgres(at)gmail(dot)com, pgsql-hackers(at)lists(dot)postgresql(dot)org
Subject: Re: Remove an unnecessary errmsg_plural in dependency.c
Date: 2022-03-24 05:17:03
Message-ID: 20220324.141703.2103906176567480278.horikyota.ntt@gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

At Wed, 23 Mar 2022 17:39:52 +0100, Peter Eisentraut <peter(dot)eisentraut(at)enterprisedb(dot)com> wrote in
> On 23.03.22 17:33, Bharath Rupireddy wrote:
> > It looks like the following errmsg_plural in dependency.c is
> > unnecessary as numReportedClient > 1 always and numNotReportedClient
> > can never be < 0. Therefore plural version of the error message is
> > sufficient. Attached a patch to fix it.
>
> Some languages have more than two forms, so we still need to keep this
> to handle those.

The point seems to be that numReportedClient + numNotReportedClient >=
2 (not 1) there. So the singular form is never used. It doesn't harm
as-is but translation burden decreases a bit by fixing it.

By the way it has a translator-note as follows.

> else if (numReportedClient > 1)
> {
> ereport(msglevel,
> /* translator: %d always has a value larger than 1 */
> (errmsg_plural("drop cascades to %d other object",
> "drop cascades to %d other objects",
> numReportedClient + numNotReportedClient,
> numReportedClient + numNotReportedClient),

The comment and errmsg_plural don't seem to be consistent. When the
code was added by c4f2a0458d, it had only singular form and already
had the comment. After that 8032d76b5 turned it to errmsg_plural
ignoring the comment. It seems like a thinko of 8032d76b5.

regards.

--
Kyotaro Horiguchi
NTT Open Source Software Center

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Laurenz Albe 2022-03-24 05:17:04 Re: [PoC] Let libpq reject unexpected authentication requests
Previous Message Kyotaro Horiguchi 2022-03-24 04:52:46 Re: pg_walinspect - a new extension to get raw WAL data and WAL stats