Re: Remove an unnecessary errmsg_plural in dependency.c

Поиск
Список
Период
Сортировка
От Kyotaro Horiguchi
Тема Re: Remove an unnecessary errmsg_plural in dependency.c
Дата
Msg-id 20220324.141703.2103906176567480278.horikyota.ntt@gmail.com
обсуждение исходный текст
Ответ на Re: Remove an unnecessary errmsg_plural in dependency.c  (Peter Eisentraut <peter.eisentraut@enterprisedb.com>)
Ответы Re: Remove an unnecessary errmsg_plural in dependency.c  (Daniel Gustafsson <daniel@yesql.se>)
Re: Remove an unnecessary errmsg_plural in dependency.c  (Peter Eisentraut <peter.eisentraut@enterprisedb.com>)
Список 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 по дате отправления:

Предыдущее
От: Kyotaro Horiguchi
Дата:
Сообщение: Re: pg_walinspect - a new extension to get raw WAL data and WAL stats
Следующее
От: Laurenz Albe
Дата:
Сообщение: Re: [PoC] Let libpq reject unexpected authentication requests