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

Michael Paquier <michael@paquier.xyz>

From: Michael Paquier <michael@paquier.xyz>
To: Peter Smith <smithpb2250@gmail.com>
Cc: Justin Pryzby <pryzby@telsasoft.com>, Tom Lane <tgl@sss.pgh.pa.us>, Nathan Bossart <nathandbossart@gmail.com>, pgsql-hackers@lists.postgresql.org
Date: 2022-10-28T07:05:12Z
Lists: pgsql-hackers

Attachments

On Fri, Oct 28, 2022 at 11:48:13AM +0900, Michael Paquier wrote:
> Thanks.  I have not looked at the checkup logic yet, but the central
> declarations seem rather sane, and I have a few comments about the
> latter.

So, I've had the energy to look at the check logic today, and noticed
that, while the proposed patch is doing the job when loading the
in-core GUCs, nothing is happening for the custom GUCs that could be
loaded through shared_preload_libraries or just from a LOAD command.

After adding an extra check in define_custom_variable() (reworking a
bit the interface proposed while on it), I have found a few more
issues than what's been already found on this thread:
- 5 missing spots in pg_stat_statements.
- 3 float rounding issues in pg_trgm.
- 1 spot in pg_prewarm.
- A few more that had no initialization, but these had a default of
false/0/0.0 so it does not influence the end result but I have added
some initializations anyway.

With all that addressed, I am finishing with the attached.  I have
added some comments for the default definitions depending on the
CFLAGS, explaining the reasons behind the choices made.  The CI has
produced a green run, which is not the same as the buildfarm, still
gives some confidence.

Thoughts?
--
Michael

Commits

  1. Add check on initial and boot values when loading GUCs

  2. Clean up some inconsistencies with GUC declarations

  3. Clean up some GUC declarations and comments