From 3a78625fbe62ae78279357e534825a53cb11051a Mon Sep 17 00:00:00 2001 From: Peter Eisentraut Date: Wed, 27 Nov 2019 16:34:27 +0100 Subject: [PATCH v3 2/3] Make allow_system_table_mods settable at run time Make allow_system_table_mods settable at run time by superusers. It was previously postmaster start only. We don't want to make system catalog DDL wide-open, but there are occasionally useful things to do like setting reloptions or statistics on a busy system table, and blocking those doesn't help anyone. Also, this enables the possibility of writing a test suite for this setting. Discussion: https://www.postgresql.org/message-id/flat/8b00ea5e-28a7-88ba-e848-21528b632354%402ndquadrant.com --- doc/src/sgml/config.sgml | 9 ++++++--- src/backend/utils/misc/guc.c | 2 +- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/doc/src/sgml/config.sgml b/doc/src/sgml/config.sgml index d4d1fe45cc..34fd759862 100644 --- a/doc/src/sgml/config.sgml +++ b/doc/src/sgml/config.sgml @@ -9501,9 +9501,12 @@ Developer Options - Allows modification of the structure of system tables. - This is used by initdb. - This parameter can only be set at server start. + Allows modification of the structure of system tables as well as + certain other risky actions on system tables. This is otherwise not + allowed even for superusers. This is used by + initdb. Inconsiderate use of this setting can + cause irretrievable data loss or seriously corrupt the database + system. Only superusers can change this setting. diff --git a/src/backend/utils/misc/guc.c b/src/backend/utils/misc/guc.c index ba4edde71a..5fccc9683e 100644 --- a/src/backend/utils/misc/guc.c +++ b/src/backend/utils/misc/guc.c @@ -1777,7 +1777,7 @@ static struct config_bool ConfigureNamesBool[] = }, { - {"allow_system_table_mods", PGC_POSTMASTER, DEVELOPER_OPTIONS, + {"allow_system_table_mods", PGC_SUSET, DEVELOPER_OPTIONS, gettext_noop("Allows modifications of the structure of system tables."), NULL, GUC_NOT_IN_SAMPLE -- 2.24.0