From: Álvaro Herrera Date: Wed, 11 Feb 2026 15:38:18 +0000 (+0100) Subject: Cleanup for log_min_messages changes in 38e0190ced71 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=1efdd7cc630a963e56f34d44877d2097b98166d6;p=thirdparty%2Fpostgresql.git Cleanup for log_min_messages changes in 38e0190ced71 * Remove an unused variable * Use "default log level" consistently (instead of "generic") * Keep the process types in alphabetical order (missed one place in the SGML docs) * Since log_min_messages type was changed from enum to string, it is a good idea to add single quotes when printing it out. Otherwise it fails if the user copies and pastes from the SHOW output to SET, except in the simplest case. Using single quotes reduces confusion. * Use lowercase string for the burned-in default value, to keep the same output as previous versions. Author: Euler Taveira Author: Man Zeng Author: Noriyoshi Shinoda Reviewed-by: Chao Li Discussion: https://postgr.es/m/202602091250.genyflm2d5dw@alvherre.pgsql --- diff --git a/doc/src/sgml/config.sgml b/doc/src/sgml/config.sgml index 37342986969..61d39fd3366 100644 --- a/doc/src/sgml/config.sgml +++ b/doc/src/sgml/config.sgml @@ -7145,9 +7145,9 @@ local0.* /var/log/postgresql checkpointer ioworker postmaster - syslogger slotsyncworker startup + syslogger walreceiver walsender walsummarizer diff --git a/src/backend/utils/error/elog.c b/src/backend/utils/error/elog.c index 129906e2daa..59315e94e3e 100644 --- a/src/backend/utils/error/elog.c +++ b/src/backend/utils/error/elog.c @@ -2190,7 +2190,7 @@ check_log_min_messages(char **newval, void **extra, GucSource source) char *result; int newlevel[BACKEND_NUM_TYPES]; bool assigned[BACKEND_NUM_TYPES] = {0}; - int genericlevel = -1; /* -1 means not assigned */ + int defaultlevel = -1; /* -1 means not assigned */ const char *const process_types[] = { #define PG_PROCTYPE(bktype, bkcategory, description, main_func, shmem_attach) \ @@ -2228,8 +2228,8 @@ check_log_min_messages(char **newval, void **extra, GucSource source) const struct config_enum_entry *entry; bool found; - /* Reject duplicates for generic log level. */ - if (genericlevel != -1) + /* Reject duplicates for default log level. */ + if (defaultlevel != -1) { GUC_check_errdetail("Redundant specification of default log level."); goto lmm_fail; @@ -2241,7 +2241,7 @@ check_log_min_messages(char **newval, void **extra, GucSource source) { if (pg_strcasecmp(entry->name, elem) == 0) { - genericlevel = entry->val; + defaultlevel = entry->val; found = true; break; } @@ -2331,9 +2331,9 @@ lmm_fail: } /* - * The generic log level must be specified. It is the fallback value. + * The default log level must be specified. It is the fallback value. */ - if (genericlevel == -1) + if (defaultlevel == -1) { GUC_check_errdetail("Default log level was not defined."); guc_free(rawstring); @@ -2345,7 +2345,7 @@ lmm_fail: for (int i = 0; i < BACKEND_NUM_TYPES; i++) { if (!assigned[i]) - newlevel[i] = genericlevel; + newlevel[i] = defaultlevel; } /* diff --git a/src/backend/utils/misc/guc_parameters.dat b/src/backend/utils/misc/guc_parameters.dat index 762b8efe6b0..4b8bd57d1e7 100644 --- a/src/backend/utils/misc/guc_parameters.dat +++ b/src/backend/utils/misc/guc_parameters.dat @@ -1698,7 +1698,7 @@ long_desc => 'Each level includes all the levels that follow it. The later the level, the fewer messages are sent.', flags => 'GUC_LIST_INPUT', variable => 'log_min_messages_string', - boot_val => '"WARNING"', + boot_val => '"warning"', check_hook => 'check_log_min_messages', assign_hook => 'assign_log_min_messages', }, diff --git a/src/backend/utils/misc/postgresql.conf.sample b/src/backend/utils/misc/postgresql.conf.sample index 6e82c8e055d..12183f6996f 100644 --- a/src/backend/utils/misc/postgresql.conf.sample +++ b/src/backend/utils/misc/postgresql.conf.sample @@ -532,7 +532,7 @@ # - When to Log - -#log_min_messages = warning # comma-separated list of +#log_min_messages = 'warning' # comma-separated list of # process_type:level entries, plus # one freestanding level as default. # Valid process types are: diff --git a/src/include/postmaster/proctypelist.h b/src/include/postmaster/proctypelist.h index 4e259e84c2d..feac19ba207 100644 --- a/src/include/postmaster/proctypelist.h +++ b/src/include/postmaster/proctypelist.h @@ -26,7 +26,7 @@ /* * List of process types (symbol, category, description, Main function, - * shmem_attach, message level) entries. + * shmem_attach) entries. */ diff --git a/src/include/utils/guc.h b/src/include/utils/guc.h index 8acbdba7ff5..c46203fabfe 100644 --- a/src/include/utils/guc.h +++ b/src/include/utils/guc.h @@ -329,8 +329,6 @@ extern PGDLLIMPORT bool trace_sort; extern PGDLLIMPORT bool optimize_bounded_sort; #endif -extern PGDLLIMPORT const char *const log_min_messages_process_types[]; - /* * Declarations for options for enum values *