Set pg_setting.pending_restart when pertinent config lines are removed
authorAlvaro Herrera
Tue, 27 Jul 2021 19:44:12 +0000 (15:44 -0400)
committerAlvaro Herrera
Tue, 27 Jul 2021 19:44:12 +0000 (15:44 -0400)
This changes the behavior of examining the pg_file_settings view after
changing a config option that requires restart.  The user needs to know
that any change of such options does not take effect until a restart,
and this worked correctly if the line is edited without removing it.
However, for the case where the line is removed altogether, the flag
doesn't get set, because a flag was only set in set_config_option, but
that's not called for lines removed.  Repair.

(Ref.: commits 62d16c7fc561 and a486e35706ea)

Author: Álvaro Herrera 
Reviewed-by: Daniel Gustafsson
Reviewed-by: Tom Lane
Discussion: https://postgr.es/m/202107262302[email protected]

src/backend/utils/misc/guc-file.l

index 268b7455283830f6d4488fffc65cb1246747af7d..e4d115ed739d081fa1dea5ad10c31aa904d8a61d 100644 (file)
@@ -347,6 +347,8 @@ ProcessConfigFileInternal(GucContext context, bool applySettings, int elevel)
            continue;
        if (gconf->context < PGC_SIGHUP)
        {
+           /* The removal can't be effective without a restart */
+           gconf->status |= GUC_PENDING_RESTART;
            ereport(elevel,
                    (errcode(ERRCODE_CANT_CHANGE_RUNTIME_PARAM),
                     errmsg("parameter \"%s\" cannot be changed without restarting the server",