1/*-------------------------------------------------------------------------
4 * Declarations of tables used by GUC.
6 * See src/backend/utils/misc/README for design notes.
8 * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group
10 * src/include/utils/guc_tables.h
12 *-------------------------------------------------------------------------
21 * GUC supports these types of variables:
42 * The actual value of a GUC variable can include a malloc'd opaque struct
43 * "extra", which is created by its check_hook and used by its assign_hook.
52 * Groupings to help organize all the run-time options for display.
53 * Be sure this agrees with the way the options are categorized in config.sgml!
57 UNGROUPED,
/* use for options not shown in pg_settings */
108 * Stack entry for saving the state a variable had prior to an uncommitted
109 * transactional change
113 /* This is almost GucAction, but we need a fourth state for SET+LOCAL */
114 GUC_SAVE,
/* entry caused by function SET option */
115 GUC_SET,
/* entry caused by plain SET command */
126 /* masked value's source must be PGC_S_SESSION, so no need to store it */
136 * Generic fields applicable to all types of variables
138 * The short description should be less than 80 chars in length. Some
139 * applications may use the long description as well, and will append
140 * it to the short description. (separated by a newline or '. ')
142 * If the GUC accepts a special value like -1 to disable the feature, use a
143 * system default, etc., it should be mentioned in the long description with
144 * the following style:
146 * - Special values should be listed at the end of the long description.
147 * - Descriptions should use numerals (e.g., "0") instead of words (e.g.,
149 * - Special value mentions should be concise and direct (e.g., "0 disables
150 * the timeout.", "An empty string means use the operating system
152 * - Multiple special values should be listed in ascending order.
154 * As an exception, special values should _not_ be mentioned if the description
155 * would be too complex or if the meaning is sufficiently obvious.
157 * srole is the role that set the current value, or BOOTSTRAP_SUPERUSERID
158 * if the value came from an internal source or the config file. Similarly
159 * for reset_srole (which is usually BOOTSTRAP_SUPERUSERID, but not always).
161 * Variables that are currently of active interest for maintenance
162 * operations are linked into various lists using the xxx_link fields.
163 * The link fields are unused/garbage in variables not currently having
164 * the specified properties.
166 * Note that sourcefile/sourceline are kept here, and not pushed into stacked
167 * values, although in principle they belong with some stacked value if the
168 * active value is session- or transaction-local. This is to avoid bloating
169 * stack entries. We know they are only relevant when source == PGC_S_FILE.
173 /* constant fields, must be set correctly in initial value: */
174 const char *
name;
/* name of variable - MUST BE FIRST */
177 const char *
short_desc;
/* short desc. of this variable's purpose */
178 const char *
long_desc;
/* long desc. of this variable's purpose */
179 int flags;
/* flag bits, see guc.h */
180 /* variable fields, initialized at runtime: */
190 void *
extra;
/* "extra" pointer for current actual value */
192 * different from PGC_S_DEFAULT */
196 * GUC_NEEDS_REPORT bit set in status */
198 * to client (NULL if not yet sent) */
199 char *
sourcefile;
/* file current setting is from (NULL if not
200 * set in config file) */
204/* bit values in status field */
205 #define GUC_IS_IN_FILE 0x0001 /* found it in config file */
207 * Caution: the GUC_IS_IN_FILE bit is transient state for ProcessConfigFile.
208 * Do not assume that its value represents useful information elsewhere.
210 #define GUC_PENDING_RESTART 0x0002 /* changed value cannot be applied yet */
211 #define GUC_NEEDS_REPORT 0x0004 /* new value must be reported to client */
214/* GUC records for specific variable types */
219 /* constant fields, must be set correctly in initial value: */
225 /* variable fields, initialized at runtime: */
233 /* constant fields, must be set correctly in initial value: */
241 /* variable fields, initialized at runtime: */
249 /* constant fields, must be set correctly in initial value: */
257 /* variable fields, initialized at runtime: */
263 * A note about string GUCs: the boot_val is allowed to be NULL, which leads
264 * to the reset_val and the actual variable value (*variable) also being NULL.
265 * However, there is no way to set a NULL value subsequently using
266 * set_config_option or any other GUC API. Also, GUC APIs such as SHOW will
267 * display a NULL value as an empty string. Callers that choose to use a NULL
268 * boot_val should overwrite the setting later in startup, or else be careful
269 * that NULL doesn't have semantics that are visibly different from an empty
275 /* constant fields, must be set correctly in initial value: */
281 /* variable fields, initialized at runtime: */
289 /* constant fields, must be set correctly in initial value: */
296 /* variable fields, initialized at runtime: */
301/* constant tables corresponding to enums above and in guc.h */
307/* data arrays defining all the built-in GUC variables */
314/* lookup GUC variables, returning config_generic pointers */
316 bool create_placeholders,
321/* get string value of variable */
324/* get whether or not the GUC variable is visible to current user */
327/* get the current set of variables */
332/* search in enum options */
335 const char *
value,
int *retval);
341#endif /* GUC_TABLES_H */
bool(* GucBoolCheckHook)(bool *newval, void **extra, GucSource source)
bool(* GucRealCheckHook)(double *newval, void **extra, GucSource source)
void(* GucStringAssignHook)(const char *newval, void *extra)
bool(* GucEnumCheckHook)(int *newval, void **extra, GucSource source)
void(* GucBoolAssignHook)(bool newval, void *extra)
void(* GucEnumAssignHook)(int newval, void *extra)
bool(* GucStringCheckHook)(char **newval, void **extra, GucSource source)
void(* GucIntAssignHook)(int newval, void *extra)
void(* GucRealAssignHook)(double newval, void *extra)
bool(* GucIntCheckHook)(int *newval, void **extra, GucSource source)
const char *(* GucShowHook)(void)
PGDLLIMPORT const char *const GucContext_Names[]
PGDLLIMPORT const char *const GucSource_Names[]
bool config_enum_lookup_by_name(struct config_enum *record, const char *value, int *retval)
PGDLLIMPORT struct config_int ConfigureNamesInt[]
struct config_generic ** get_guc_variables(int *num_vars)
PGDLLIMPORT const char *const config_group_names[]
struct guc_stack GucStack
struct config_generic * find_option(const char *name, bool create_placeholders, bool skip_errors, int elevel)
char * config_enum_get_options(struct config_enum *record, const char *prefix, const char *suffix, const char *separator)
PGDLLIMPORT const char *const config_type_names[]
const char * config_enum_lookup_by_value(struct config_enum *record, int val)
void build_guc_variables(void)
bool ConfigOptionIsVisible(struct config_generic *conf)
struct config_generic ** get_explain_guc_options(int *num)
PGDLLIMPORT struct config_real ConfigureNamesReal[]
char * ShowGUCOption(struct config_generic *record, bool use_units)
@ RESOURCES_WORKER_PROCESSES
@ COMPAT_OPTIONS_PREVIOUS
@ REPLICATION_SUBSCRIBERS
PGDLLIMPORT struct config_string ConfigureNamesString[]
PGDLLIMPORT struct config_enum ConfigureNamesEnum[]
struct config_var_value config_var_value
PGDLLIMPORT struct config_bool ConfigureNamesBool[]
struct config_generic gen
GucBoolCheckHook check_hook
GucBoolAssignHook assign_hook
const struct config_enum_entry * options
GucEnumAssignHook assign_hook
struct config_generic gen
GucEnumCheckHook check_hook
GucContext reset_scontext
GucIntAssignHook assign_hook
GucIntCheckHook check_hook
struct config_generic gen
GucRealAssignHook assign_hook
struct config_generic gen
GucRealCheckHook check_hook
struct config_generic gen
GucStringCheckHook check_hook
GucStringAssignHook assign_hook
GucContext masked_scontext