Re: Reorganize GUC structs

Peter Eisentraut <peter@eisentraut.org>

From: Peter Eisentraut <peter@eisentraut.org>
To: Álvaro Herrera <alvherre@kurilemu.de>, John Naylor <johncnaylorls@gmail.com>
Cc: pgsql-hackers <pgsql-hackers@postgresql.org>
Date: 2025-10-15T12:46:55Z
Lists: pgsql-hackers
On 13.10.25 13:39, Álvaro Herrera wrote:
> I agree that keeping the guc_parameters.dat file alphabetically sorted
> by default would keep the maintenance cost lowest, because we won't have
> to make any subjective decisions for new entries.  However, automatically
> generating the .sample file sounds impractical, considering the
> free-form comments that we currently have there.

Yes, I'm not sure if it's practical in the fullest extent.  But there 
were at various points discussions about alternative layouts and 
contents for postgresql.conf.sample, with a lot of opinions.  With this 
new framework, I think it might be interesting to experiment.  Which is 
why I mentioned it.

> I think instead of that mess, maybe we can simply keep the sample file
> as-is, cross-check that a line for each non-hidden GUC variable exists,
> and perhaps that the commented-out default value matches the data file.

Those would certainly be reasonable near-term steps.



Commits

  1. Remove extraneous newlines from guc_parameters.dat

  2. Fix NLS for incorrect GUC enum value hint message

  3. Clean up qsort comparison function for GUC entries

  4. Sort guc_parameters.dat alphabetically by name

  5. Reorganize GUC structs

  6. Change config_generic.vartype to be initialized at compile time

  7. Use designated initializers for guc_tables

  8. Change reset_extra into a config_generic common field

  9. Add some const qualifiers

  10. Modernize some for loops