Re: PublicationActions - use bit flags.

Поиск
Список
Период
Сортировка
От Greg Nancarrow
Тема Re: PublicationActions - use bit flags.
Дата
Msg-id CAJcOf-cXspVxTe7pe6QGyCOq6tmftgrxXZ_yRe53mx8L9wqXPw@mail.gmail.com
обсуждение исходный текст
Ответ на Re: PublicationActions - use bit flags.  (Tom Lane <tgl@sss.pgh.pa.us>)
Ответы Re: PublicationActions - use bit flags.  (Greg Nancarrow <gregn4422@gmail.com>)
Список pgsql-hackers
On Tue, Dec 21, 2021 at 11:56 AM Tom Lane <tgl@sss.pgh.pa.us> wrote:
>
> Removing this is not good:
>
>         if (relation->rd_pubactions)
> -       {
>                 pfree(relation->rd_pubactions);
> -               relation->rd_pubactions = NULL;
> -       }
>
> If the subsequent palloc fails, you've created a problem where
> there was none before.
>

Oops, yeah, I got carried away; if palloc() failed and called exit(),
then it would end up crashing when trying to use/pfree rd_pubactions
again.
Better leave that line in ...

> I do wonder why we have to palloc a constant-size substructure in
> the first place, especially one that is likely smaller than the
> pointer that points to it.  Maybe the struct definition should be
> moved so that we can just declare it in-line in the relcache entry?
>

I think currently it's effectively using the rd_pubactions pointer as
a boolean flag to indicate whether the publication membership info has
been fetched (so the bool flags are valid).
I guess you'd need another bool flag if you wanted to make that struct
in-line in the relcache entry.


Regards,
Greg Nancarrow
Fujitsu Australia



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

Предыдущее
От: Kyotaro Horiguchi
Дата:
Сообщение: Re: Emit a warning if the extension's GUC is set incorrectly
Следующее
От: Corey Huinker
Дата:
Сообщение: Re: simplifying foreign key/RI checks