redundant check of msg in does_not_exist_skipping - Mailing list pgsql-hackers

From Ted Yu
Subject redundant check of msg in does_not_exist_skipping
Date
Msg-id CALte62yFakR4POxT590JOEN65fhHNXeZg+X879Gy34_2p8UjMQ@mail.gmail.com
Whole thread Raw
Responses Re: redundant check of msg in does_not_exist_skipping
List 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

pgsql-hackers by date:

Previous
From: Pavel Borisov
Date:
Subject: Re: Lockless queue of waiters in LWLock
Next
From: Daniel Gustafsson
Date:
Subject: Re: Typo in SH_LOOKUP and SH_LOOKUP_HASH comments