Обсуждение: pgsql: Reorganize GUC structs

Поиск
Список
Период
Сортировка

pgsql: Reorganize GUC structs

От
Peter Eisentraut
Дата:
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

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/a13833c35f9e07fe978bf6fad984d6f5f25f59cd

Modified Files
--------------
src/backend/utils/misc/gen_guc_tables.pl |  53 +-
src/backend/utils/misc/guc.c             | 847 ++++++++++++++-----------------
src/backend/utils/misc/guc_funcs.c       |  14 +-
src/backend/utils/misc/help_config.c     |  59 +--
src/include/utils/guc_tables.h           | 180 +++----
src/tools/pgindent/typedefs.list         |   1 -
6 files changed, 525 insertions(+), 629 deletions(-)