]> git.ipfire.org Git - thirdparty/postgresql.git/commit
Reorganize GUC structs
authorPeter Eisentraut <peter@eisentraut.org>
Fri, 3 Oct 2025 06:27:18 +0000 (08:27 +0200)
committerPeter Eisentraut <peter@eisentraut.org>
Wed, 29 Oct 2025 08:52:29 +0000 (09:52 +0100)
commita13833c35f9e07fe978bf6fad984d6f5f25f59cd
tree4d6dfd2addd1952b374715e39079c8c8d9550189
parent2724830929ba29a5cf95fba6134ca4dcbfdb4109
Reorganize GUC structs

Instead of having five separate GUC structs, one for each type, with
the generic part contained in each of them, flip it around and have
one common struct, with the type-specific part has a subfield.

The very original GUC design had type-specific structs and
type-specific lists, and the membership in one of the lists defined
the type.  But now the structs themselves know the type (from the
.vartype field), and they are all loaded into a common hash table at
run time, and so this original separation no longer makes sense.  It
creates a bunch of inconsistencies in the code about whether the
type-specific or the generic struct is the primary struct, and a lot
of casting in between, which makes certain assumptions about the
struct layouts.

After the change, all these casts are gone and all the data is
accessed via normal field references.  Also, various code is
simplified because only one kind of struct needs to be processed.

Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Heikki Linnakangas <hlinnaka@iki.fi>
Discussion: https://www.postgresql.org/message-id/flat/8fdfb91e-60fb-44fa-8df6-f5dea47353c9@eisentraut.org
src/backend/utils/misc/gen_guc_tables.pl
src/backend/utils/misc/guc.c
src/backend/utils/misc/guc_funcs.c
src/backend/utils/misc/help_config.c
src/include/utils/guc_tables.h
src/tools/pgindent/typedefs.list