Re: PublicationActions - use bit flags. - Mailing list pgsql-hackers

From Peter Eisentraut
Subject Re: PublicationActions - use bit flags.
Date
Msg-id 6b8191a0-e0f6-b204-e6c0-f7f1a5f349c0@enterprisedb.com
Whole thread Raw
In response to Re: PublicationActions - use bit flags.  (Greg Nancarrow <gregn4422@gmail.com>)
Responses Re: PublicationActions - use bit flags.
List pgsql-hackers
On 21.01.22 01:05, Greg Nancarrow wrote:
> On Tue, Dec 21, 2021 at 12:55 PM Greg Nancarrow <gregn4422@gmail.com> wrote:
>>
>> 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 ...
>>
> 
> Attaching an updated patch to fix that oversight.
> This patch thus fixes the original palloc issue in a minimal way,
> keeping the same relcache structure.

Why can't GetRelationPublicationActions() have the PublicationActions as 
a return value, instead of changing it to an output argument?



pgsql-hackers by date:

Previous
From: Robert Haas
Date:
Subject: Re: fairywren is generating bogus BASE_BACKUP commands
Next
From: Robert Haas
Date:
Subject: Re: CREATEROLE and role ownership hierarchies