Re: PublicationActions - use bit flags.

From: Peter Eisentraut <peter(dot)eisentraut(at)enterprisedb(dot)com>
To: Greg Nancarrow <gregn4422(at)gmail(dot)com>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Alvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org>, Peter Smith <smithpb2250(at)gmail(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: PublicationActions - use bit flags.
Date: 2022-01-25 10:54:29
Message-ID: b0ed6a97-ab8c-4a84-ea12-85445dd5e3d7@enterprisedb.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 25.01.22 07:14, Greg Nancarrow wrote:
>
> On Tue, Jan 25, 2022 at 7:31 AM Peter Eisentraut
> <peter(dot)eisentraut(at)enterprisedb(dot)com
> <mailto:peter(dot)eisentraut(at)enterprisedb(dot)com>> wrote:
> >
> > Why can't GetRelationPublicationActions() have the PublicationActions as
> > a return value, instead of changing it to an output argument?
>
> That would be OK too, for now, for the current (small size, typically
> 4-byte) PublicationActions struct.
> But if that function was extended in the future to return more
> publication information than just the PublicationActions struct (and I'm
> seeing that in the filtering patches [1]), then using return-by-value
> won't be as efficient as pass-by-reference, and I'd tend to stick with
> pass-by-reference in that case.
>
> [1]
> https://postgr.es/m/OS0PR01MB5716B899A66D2997EF28A1B3945F9%40OS0PR01MB5716.jpnprd01.prod.outlook.com
> <https://postgr.es/m/OS0PR01MB5716B899A66D2997EF28A1B3945F9%40OS0PR01MB5716.jpnprd01.prod.outlook.com>

By itself, this refactoring doesn't seem worth it. The code is actually
longer at the end, and we haven't made it any more extensible or
anything. And AFAICT, this is not called in a performance-sensitive way.

The proposed changes in [1] change this function more significantly, so
adopting the present change wouldn't really help there either except
create the need for one more rebase.

So I think we should leave this alone here and let [1] make the changes
it needs.

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Julien Rouhaud 2022-01-25 11:21:01 Re: [PATCH] Full support for index LP_DEAD hint bits on standby
Previous Message Peter Eisentraut 2022-01-25 10:47:14 Re: GUC flags