Re: row filtering for logical replication

Поиск
Список
Период
Сортировка
От Greg Nancarrow
Тема Re: row filtering for logical replication
Дата
Msg-id CAJcOf-fR_BKHNuz7AXCWuk40ESVOr=DkXf3evbNNi4M4V_5agQ@mail.gmail.com
обсуждение исходный текст
Ответ на RE: row filtering for logical replication  ("houzj.fnst@fujitsu.com" <houzj.fnst@fujitsu.com>)
Ответы Re: row filtering for logical replication  (Andres Freund <andres@anarazel.de>)
Список pgsql-hackers
On Mon, Jan 31, 2022 at 1:12 PM houzj.fnst@fujitsu.com
<houzj.fnst@fujitsu.com> wrote:
>
> > > +   /*
> > > +    * We need this map to avoid relying on ReorderBufferChangeType
> > enums
> > > +    * having specific values.
> > > +    */
> > > +   static int map_changetype_pubaction[] = {
> > > +           [REORDER_BUFFER_CHANGE_INSERT] = PUBACTION_INSERT,
> > > +           [REORDER_BUFFER_CHANGE_UPDATE] = PUBACTION_UPDATE,
> > > +           [REORDER_BUFFER_CHANGE_DELETE] = PUBACTION_DELETE
> > > +   };
> >
> > Why is this "static"? Function-local statics only really make sense for variables
> > that are changed and should survive between calls to a function.
>
> Removed the "static" label.
>

This array was only ever meant to be read-only, and visible only to
that function.
IMO removing "static" makes things worse because now that array gets
initialized each call to the function, which is unnecessary.
I think it should just be: "static const int map_changetype_pubaction[] = ..."

Regards,
Greg Nancarrow
Fujitsu Australia



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

Предыдущее
От: Tom Lane
Дата:
Сообщение: Latest LLVM breaks our code again
Следующее
От: Dilip Kumar
Дата:
Сообщение: Re: [BUG]Update Toast data failure in logical replication