Re: logicalrep_message_type throws an error

Поиск
Список
Период
Сортировка
От Ashutosh Bapat
Тема Re: logicalrep_message_type throws an error
Дата
Msg-id CAExHW5tM-Qpcz1EgT-Pa-cYY+bAAbHUQ9t=hr9zsDYVOAEoW1Q@mail.gmail.com
обсуждение исходный текст
Ответ на Re: logicalrep_message_type throws an error  ("Euler Taveira" <euler@eulerto.com>)
Ответы Re: logicalrep_message_type throws an error  (Ashutosh Bapat <ashutosh.bapat.oss@gmail.com>)
Список pgsql-hackers
Thanks Euler for the patch.

On Mon, Jul 3, 2023 at 6:32 PM Euler Taveira <euler@eulerto.com> wrote:
>
> Masahiko, since abc0910e2e0 is your patch maybe you want to take a look at it.
>

A couple of comments.

-char *
+const char *

Nice improvement.

 logicalrep_message_type(LogicalRepMsgType action)
 {
     switch (action)
@@ -1256,9 +1256,7 @@ logicalrep_message_type(LogicalRepMsgType action)
             return "STREAM ABORT";
         case LOGICAL_REP_MSG_STREAM_PREPARE:
             return "STREAM PREPARE";
+        default:
+            return "???";
     }
-
-    elog(ERROR, "invalid logical replication message type \"%c\"", action);
-
-    return NULL;                /* keep compiler quiet */

The switch is on action which is an enum. So without default it will
provide a compilation warning for missing enums. Adding "default" case
defeats that purpose. I think we should just return "???" from outside
switch block.

--
Best Wishes,
Ashutosh Bapat



В списке pgsql-hackers по дате отправления:

Предыдущее
От: "Tristan Partin"
Дата:
Сообщение: Re: Make uselocale protection more consistent
Следующее
От: Daniel Gustafsson
Дата:
Сообщение: Re: generic plans and "initial" pruning