On Tue, Dec 21, 2021 at 11:56 AM Tom Lane <t...@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


Reply via email to