Remove an unnecessary errmsg_plural in dependency.c

From: Bharath Rupireddy <bharath(dot)rupireddyforpostgres(at)gmail(dot)com>
To: PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Remove an unnecessary errmsg_plural in dependency.c
Date: 2022-03-23 16:33:55
Message-ID: CALj2ACUfJKTmK5v=vF+H2iLkqM9Yvjsp6iXaCqAks6gDpzZh6g@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi,

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.

@@ -1200,10 +1200,8 @@ reportDependentObjects(const ObjectAddresses
*targetObjects,
{
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),
+ (errmsg("drop cascades to %d other objects",
+ numReportedClient +
numNotReportedClient),
errdetail("%s", clientdetail.data),
errdetail_log("%s", logdetail.data)));

Regards,
Bharath Rupireddy.

Attachment Content-Type Size
v1-0001-Remove-an-unnecessary-errmsg_plural-in-dependency.patch application/x-patch 1.4 KB

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Peter Eisentraut 2022-03-23 16:39:52 Re: Remove an unnecessary errmsg_plural in dependency.c
Previous Message Dilip Kumar 2022-03-23 16:19:38 Re: [Proposal] Fully WAL logged CREATE DATABASE - No Checkpoints