aboutsummaryrefslogtreecommitdiff
path: root/src/include
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2022-06-08 13:26:18 -0400
committerTom Lane <tgl@sss.pgh.pa.us>2022-06-08 13:26:18 -0400
commit7ab5b4eb483478bc85ad45ef5405b4a70c3f4c94 (patch)
treeb38269a10a11233db2f1ae91d17d17eeaea3650d /src/include
parentabed46aea4739c78802ab2ce5e93dc9a7e23c113 (diff)
downloadpostgresql-7ab5b4eb483478bc85ad45ef5405b4a70c3f4c94.tar.gz
postgresql-7ab5b4eb483478bc85ad45ef5405b4a70c3f4c94.zip
Be more careful about GucSource for internally-driven GUC settings.
The original advice for hard-wired SetConfigOption calls was to use PGC_S_OVERRIDE, particularly for PGC_INTERNAL GUCs. However, that's really overkill for PGC_INTERNAL GUCs, since there is no possibility that we need to override a user-provided setting. Instead use PGC_S_DYNAMIC_DEFAULT in most places, so that the value will appear with source = 'default' in pg_settings and thereby not be shown by psql's new \dconfig command. The one exception is that when changing in_hot_standby in a hot-standby session, we still use PGC_S_OVERRIDE, because people felt that seeing that in \dconfig would be a good thing. Similarly use PGC_S_DYNAMIC_DEFAULT for the auto-tune value of wal_buffers (if possible, that is if wal_buffers wasn't explicitly set to -1), and for the typical 2MB value of max_stack_depth. In combination these changes remove four not-very-interesting entries from the typical output of \dconfig, all of which people fingered as "why is that showing up?" in the discussion thread. Discussion: https://postgr.es/m/3118455.1649267333@sss.pgh.pa.us
Diffstat (limited to 'src/include')
-rw-r--r--src/include/utils/guc.h8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/include/utils/guc.h b/src/include/utils/guc.h
index efcbad78423..d5976ecbfb9 100644
--- a/src/include/utils/guc.h
+++ b/src/include/utils/guc.h
@@ -83,8 +83,7 @@ typedef enum
* override the postmaster command line.) Tracking the source allows us
* to process sources in any convenient order without affecting results.
* Sources <= PGC_S_OVERRIDE will set the default used by RESET, as well
- * as the current value. Note that source == PGC_S_OVERRIDE should be
- * used when setting a PGC_INTERNAL option.
+ * as the current value.
*
* PGC_S_INTERACTIVE isn't actually a source value, but is the
* dividing line between "interactive" and "non-interactive" sources for
@@ -99,6 +98,11 @@ typedef enum
* shouldn't throw hard errors in this case, at most NOTICEs, since the
* objects might exist by the time the setting is used for real.
*
+ * When setting the value of a non-compile-time-constant PGC_INTERNAL option,
+ * source == PGC_S_DYNAMIC_DEFAULT should typically be used so that the value
+ * will show as "default" in pg_settings. If there is a specific reason not
+ * to want that, use source == PGC_S_OVERRIDE.
+ *
* NB: see GucSource_Names in guc.c if you change this.
*/
typedef enum