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.
From 50328d92744f279bf26e72b6dc18c4dd9679e4aa Mon Sep 17 00:00:00 2001
From: Bharath Rupireddy <bharath.rupireddyforpostgres@gmail.com>
Date: Wed, 23 Mar 2022 16:20:56 +0000
Subject: [PATCH v1] Remove an unnecessary errmsg_plural in dependency.c
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

The errmsg_plural for "drop cascades to %d other objects" is
unnecessary as numReportedClient > 1 always and
numNotReportedClient can never be < 0. Therefore plural version of
the error message is sufficient.
---
 src/backend/catalog/dependency.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/src/backend/catalog/dependency.c b/src/backend/catalog/dependency.c
index ab9e42d7d1..2ca4492620 100644
--- a/src/backend/catalog/dependency.c
+++ b/src/backend/catalog/dependency.c
@@ -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)));
 	}
-- 
2.25.1

Reply via email to