Re: Remove an unnecessary errmsg_plural in dependency.c - Mailing list pgsql-hackers

From Kyotaro Horiguchi
Subject Re: Remove an unnecessary errmsg_plural in dependency.c
Date
Msg-id 20220324.141703.2103906176567480278.horikyota.ntt@gmail.com
Whole thread Raw
In response to Re: Remove an unnecessary errmsg_plural in dependency.c  (Peter Eisentraut <peter.eisentraut@enterprisedb.com>)
Responses Re: Remove an unnecessary errmsg_plural in dependency.c
Re: Remove an unnecessary errmsg_plural in dependency.c
List pgsql-hackers
At Wed, 23 Mar 2022 17:39:52 +0100, Peter Eisentraut <peter.eisentraut@enterprisedb.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



pgsql-hackers by date:

Previous
From: Kyotaro Horiguchi
Date:
Subject: Re: pg_walinspect - a new extension to get raw WAL data and WAL stats
Next
From: Laurenz Albe
Date:
Subject: Re: [PoC] Let libpq reject unexpected authentication requests