Re: logicalrep_message_type throws an error

From: Ashutosh Bapat <ashutosh(dot)bapat(dot)oss(at)gmail(dot)com>
To: Euler Taveira <euler(at)eulerto(dot)com>
Cc: pgsql-hackers(at)lists(dot)postgresql(dot)org, Masahiko Sawada <sawada(dot)mshk(at)gmail(dot)com>
Subject: Re: logicalrep_message_type throws an error
Date: 2023-07-03 13:57:50
Message-ID: CAExHW5v=uqHrZ1ik5dsEHPnFSM2=cMkB3LJSiQwUG+1U1MAUbg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Mon, Jul 3, 2023 at 6:52 PM Ashutosh Bapat
<ashutosh(dot)bapat(dot)oss(at)gmail(dot)com> wrote:
>
> Thanks Euler for the patch.
>
> On Mon, Jul 3, 2023 at 6:32 PM Euler Taveira <euler(at)eulerto(dot)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.
>

PFA patch.

--
Best Wishes,
Ashutosh Bapat

Attachment Content-Type Size
0001-uncover-logical-change-details-20230703.patch text/x-patch 2.3 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Peter Eisentraut 2023-07-03 14:02:37 Re: cataloguing NOT NULL constraints
Previous Message Tomas Vondra 2023-07-03 13:45:52 Is a pg_stat_force_next_flush() call sufficient for regression tests?