redundant check of msg in does_not_exist_skipping

From: Ted Yu <yuzhihong(at)gmail(dot)com>
To: peter(at)eisentraut(dot)org, pgsql-hackers(at)lists(dot)postgresql(dot)org
Subject: redundant check of msg in does_not_exist_skipping
Date: 2022-11-17 12:12:47
Message-ID: CALte62yFakR4POxT590JOEN65fhHNXeZg+X879Gy34_2p8UjMQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi,
I was looking at commit aca992040951c7665f1701cd25d48808eda7a809

I think the check of msg after the switch statement is not necessary. The
variable msg is used afterward.
If there is (potential) missing case in switch statement, the compiler
would warn.

How about removing the check ?

Thanks

diff --git a/src/backend/commands/dropcmds.c
b/src/backend/commands/dropcmds.c
index db906f530e..55996940eb 100644
--- a/src/backend/commands/dropcmds.c
+++ b/src/backend/commands/dropcmds.c
@@ -518,9 +518,6 @@ does_not_exist_skipping(ObjectType objtype, Node
*object)

/* no default, to let compiler warn about missing case */
}
- if (!msg)
- elog(ERROR, "unrecognized object type: %d", (int) objtype);
-
if (!args)
ereport(NOTICE, (errmsg(msg, name)));
else

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Daniel Gustafsson 2022-11-17 12:18:36 Re: Typo in SH_LOOKUP and SH_LOOKUP_HASH comments
Previous Message Pavel Borisov 2022-11-17 12:07:37 Re: Lockless queue of waiters in LWLock