Make allow_system_table_mods settable at run time
authorPeter Eisentraut <peter@eisentraut.org>
Fri, 29 Nov 2019 09:04:45 +0000 (10:04 +0100)
committerPeter Eisentraut <peter@eisentraut.org>
Fri, 29 Nov 2019 09:22:13 +0000 (10:22 +0100)
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.

Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us>
Discussion: https://www.postgresql.org/message-id/flat/8b00ea5e-28a7-88ba-e848-21528b632354%402ndquadrant.com

doc/src/sgml/config.sgml
src/backend/utils/misc/guc.c

index d4d1fe45cc11559d5d0d984f63af918c8b5ad67c..4ec13f3311cc84f345f78f804fab9b277006a864 100644 (file)
@@ -9501,9 +9501,11 @@ dynamic_library_path = 'C:\tools\postgresql;H:\my_project\lib;$libdir'
       </term>
       <listitem>
        <para>
-        Allows modification of the structure of system tables.
-        This is used by <command>initdb</command>.
-        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.  Ill-advised use of this setting can
+        cause irretrievable data loss or seriously corrupt the database
+        system.  Only superusers can change this setting.
        </para>
       </listitem>
      </varlistentry>
index ba4edde71a38c96d3112c5fd998d8ebb87ab00f2..5fccc9683ee967e9ea72db43bbcc3485974853d6 100644 (file)
@@ -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