Re: logicalrep_message_type throws an error
Amit Kapila <amit.kapila16@gmail.com>
From: Amit Kapila <amit.kapila16@gmail.com>
To: Ashutosh Bapat <ashutosh.bapat.oss@gmail.com>
Cc: Masahiko Sawada <sawada.mshk@gmail.com>,
Alvaro Herrera <alvherre@alvh.no-ip.org>, Euler Taveira <euler@eulerto.com>, pgsql-hackers@lists.postgresql.org
Date: 2023-07-20T03:41:40Z
Lists: pgsql-hackers
Attachments
- v3-0001-Fix-the-display-of-UNKNOWN-message-type-in-apply-.patch (application/octet-stream) patch v3-0001
On Thu, Jul 20, 2023 at 9:10 AM Amit Kapila <amit.kapila16@gmail.com> wrote: > > On Wed, Jul 19, 2023 at 10:08 AM Ashutosh Bapat > <ashutosh.bapat.oss@gmail.com> wrote: > > > > On Wed, Jul 19, 2023 at 9:01 AM Amit Kapila <amit.kapila16@gmail.com> wrote: > > > > > > On Tue, Jul 18, 2023 at 10:27 AM Masahiko Sawada <sawada.mshk@gmail.com> wrote: > > > > > > > > Or can we use snprintf() writing "??? (%d)" to a fixed length char[8 + > > > > 11] allocated on the stack instead? > > > > > > > > > > In the above size calculation, shouldn't it be 7 + 11 where 7 is for > > > (3 (???) + 1 for space + 2 for () + 1 for terminating null char) and > > > 11 is for %d? BTW, this avoids dynamic allocation of the err string in > > > logicalrep_message_type() but we can't return a locally allocated > > > string, so do you think we should change the prototype of the function > > > to get this as an argument and then use it both for valid and invalid > > > cases? > > > > There are other places in the code which do something similar by using > > statically allocated buffers like static char xya[SIZE]. We could do > > that here. The caller may decide whether to pstrdup this buffer > > further or just use it one time e.g. as an elog or printf argument. > > > > Okay, changed it accordingly. > oops, forgot to attach the patch. -- With Regards, Amit Kapila.
Commits
-
Fix the display of UNKNOWN message type in apply worker.
- d38ad8e31dee 17.0 landed
- ad486b0eaef4 16.0 landed
- 2864eb977a6e 15.4 landed