Re: GUC values - recommended way to declare the C variables?

From: Peter Smith <smithpb2250(at)gmail(dot)com>
To: Nathan Bossart <nathandbossart(at)gmail(dot)com>
Cc: Michael Paquier <michael(at)paquier(dot)xyz>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: GUC values - recommended way to declare the C variables?
Date: 2022-10-14 02:15:58
Message-ID: CAHut+PtX__sZ8x+kV028rD2+bTHLgskx0hDy=4APJziG79mWBQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Fri, Oct 14, 2022 at 8:26 AM Nathan Bossart <nathandbossart(at)gmail(dot)com> wrote:
>
> On Thu, Oct 13, 2022 at 09:47:25AM +0900, Michael Paquier wrote:
> > So, the initial values of max_wal_senders and max_replication_slots
> > became out of sync with their defaults in guc_tables.c. FWIW, I would
> > argue the opposite way: rather than removing the initializations, I
> > would fix and keep them as these references can be useful when
> > browsing the area of the code related to such GUCs, without having to
> > look at guc_tables.c for this information.
>
> Well, those initializations are only useful when they are kept in sync,
> which, as demonstrated by this patch, isn't always the case. I don't have
> a terribly strong opinion about this, but I'd lean towards reducing the
> number of places that track the default value of GUCs.
>

I agree if constants are used in both places then there will always be
some risk they can get out of sync again.

But probably it is no problem to just add #defines (e.g. in
logicallauncher.h?) to be commonly used for the C variable declaration
and also in the guc_tables. I chose not to do that way only because it
didn't seem to be the typical convention for all the other numeric
GUCs I looked at, but it's fine by me if that way is preferred

------
Kind Regards,
Peter Smith.
Fujitsu Australia

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message shiy.fnst@fujitsu.com 2022-10-14 02:25:58 RE: [PATCH] Use indexes on the subscriber when REPLICA IDENTITY is full on the publisher
Previous Message Richard Guo 2022-10-14 02:14:55 Re: Use LIMIT instead of Unique for DISTINCT when all distinct pathkeys are redundant