Re: GUC values - recommended way to declare the C variables? - Mailing list pgsql-hackers

From Tom Lane
Subject Re: GUC values - recommended way to declare the C variables?
Date
Msg-id 1113448.1665717297@sss.pgh.pa.us
Whole thread Raw
In response to Re: GUC values - recommended way to declare the C variables?  (Peter Smith <smithpb2250@gmail.com>)
Responses Re: GUC values - recommended way to declare the C variables?  (Michael Paquier <michael@paquier.xyz>)
List pgsql-hackers
Peter Smith <smithpb2250@gmail.com> writes:
> I agree if constants are used in both places then there will always be
> some risk they can get out of sync again.

Yeah.

> 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.

The problem is exactly that there's no great place to put those #define's,
at least not without incurring a lot of fresh #include bloat.

Also, if you did it like that, then it doesn't really address Michael's
desire to see the default value in the variable declaration.

I do lean towards having the data available, mainly because of the
fear I mentioned upthread that some GUCs may be accessed before
InitializeGUCOptions runs.

Could we fix the out-of-sync risk by having InitializeGUCOptions insist
that the pre-existing value of the variable match what is in guc_tables.c?
That may not work for string values but I think we could insist on it
for other GUC data types.  For strings, maybe the rule could be "the
old value must be NULL or strcmp-equal to the boot_val".

            regards, tom lane



pgsql-hackers by date:

Previous
From: bt22nakamorit
Date:
Subject: Fix error message for MERGE foreign tables
Next
From: "shiy.fnst@fujitsu.com"
Date:
Subject: RE: [RFC] building postgres with meson - v13