]> granicus.if.org Git - postgresql/blob - src/include/utils/guc_tables.h
Split out documentation of SSL parameters into their own section
[postgresql] / src / include / utils / guc_tables.h
1 /*-------------------------------------------------------------------------
2  *
3  * guc_tables.h
4  *              Declarations of tables used by GUC.
5  *
6  * See src/backend/utils/misc/README for design notes.
7  *
8  * Portions Copyright (c) 1996-2018, PostgreSQL Global Development Group
9  *
10  *        src/include/utils/guc_tables.h
11  *
12  *-------------------------------------------------------------------------
13  */
14 #ifndef GUC_TABLES_H
15 #define GUC_TABLES_H 1
16
17 #include "utils/guc.h"
18
19 /*
20  * GUC supports these types of variables:
21  */
22 enum config_type
23 {
24         PGC_BOOL,
25         PGC_INT,
26         PGC_REAL,
27         PGC_STRING,
28         PGC_ENUM
29 };
30
31 union config_var_val
32 {
33         bool            boolval;
34         int                     intval;
35         double          realval;
36         char       *stringval;
37         int                     enumval;
38 };
39
40 /*
41  * The actual value of a GUC variable can include a malloc'd opaque struct
42  * "extra", which is created by its check_hook and used by its assign_hook.
43  */
44 typedef struct config_var_value
45 {
46         union config_var_val val;
47         void       *extra;
48 } config_var_value;
49
50 /*
51  * Groupings to help organize all the run-time options for display
52  */
53 enum config_group
54 {
55         UNGROUPED,
56         FILE_LOCATIONS,
57         CONN_AUTH,
58         CONN_AUTH_SETTINGS,
59         CONN_AUTH_AUTH,
60         CONN_AUTH_SSL,
61         RESOURCES,
62         RESOURCES_MEM,
63         RESOURCES_DISK,
64         RESOURCES_KERNEL,
65         RESOURCES_VACUUM_DELAY,
66         RESOURCES_BGWRITER,
67         RESOURCES_ASYNCHRONOUS,
68         WAL,
69         WAL_SETTINGS,
70         WAL_CHECKPOINTS,
71         WAL_ARCHIVING,
72         REPLICATION,
73         REPLICATION_SENDING,
74         REPLICATION_MASTER,
75         REPLICATION_STANDBY,
76         REPLICATION_SUBSCRIBERS,
77         QUERY_TUNING,
78         QUERY_TUNING_METHOD,
79         QUERY_TUNING_COST,
80         QUERY_TUNING_GEQO,
81         QUERY_TUNING_OTHER,
82         LOGGING,
83         LOGGING_WHERE,
84         LOGGING_WHEN,
85         LOGGING_WHAT,
86         PROCESS_TITLE,
87         STATS,
88         STATS_MONITORING,
89         STATS_COLLECTOR,
90         AUTOVACUUM,
91         CLIENT_CONN,
92         CLIENT_CONN_STATEMENT,
93         CLIENT_CONN_LOCALE,
94         CLIENT_CONN_PRELOAD,
95         CLIENT_CONN_OTHER,
96         LOCK_MANAGEMENT,
97         COMPAT_OPTIONS,
98         COMPAT_OPTIONS_PREVIOUS,
99         COMPAT_OPTIONS_CLIENT,
100         ERROR_HANDLING_OPTIONS,
101         PRESET_OPTIONS,
102         CUSTOM_OPTIONS,
103         DEVELOPER_OPTIONS
104 };
105
106 /*
107  * Stack entry for saving the state a variable had prior to an uncommitted
108  * transactional change
109  */
110 typedef enum
111 {
112         /* This is almost GucAction, but we need a fourth state for SET+LOCAL */
113         GUC_SAVE,                                       /* entry caused by function SET option */
114         GUC_SET,                                        /* entry caused by plain SET command */
115         GUC_LOCAL,                                      /* entry caused by SET LOCAL command */
116         GUC_SET_LOCAL                           /* entry caused by SET then SET LOCAL */
117 } GucStackState;
118
119 typedef struct guc_stack
120 {
121         struct guc_stack *prev;         /* previous stack item, if any */
122         int                     nest_level;             /* nesting depth at which we made entry */
123         GucStackState state;            /* see enum above */
124         GucSource       source;                 /* source of the prior value */
125         /* masked value's source must be PGC_S_SESSION, so no need to store it */
126         GucContext      scontext;               /* context that set the prior value */
127         GucContext      masked_scontext;        /* context that set the masked value */
128         config_var_value prior;         /* previous value of variable */
129         config_var_value masked;        /* SET value in a GUC_SET_LOCAL entry */
130 } GucStack;
131
132 /*
133  * Generic fields applicable to all types of variables
134  *
135  * The short description should be less than 80 chars in length. Some
136  * applications may use the long description as well, and will append
137  * it to the short description. (separated by a newline or '. ')
138  *
139  * Note that sourcefile/sourceline are kept here, and not pushed into stacked
140  * values, although in principle they belong with some stacked value if the
141  * active value is session- or transaction-local.  This is to avoid bloating
142  * stack entries.  We know they are only relevant when source == PGC_S_FILE.
143  */
144 struct config_generic
145 {
146         /* constant fields, must be set correctly in initial value: */
147         const char *name;                       /* name of variable - MUST BE FIRST */
148         GucContext      context;                /* context required to set the variable */
149         enum config_group group;        /* to help organize variables by function */
150         const char *short_desc;         /* short desc. of this variable's purpose */
151         const char *long_desc;          /* long desc. of this variable's purpose */
152         int                     flags;                  /* flag bits, see guc.h */
153         /* variable fields, initialized at runtime: */
154         enum config_type vartype;       /* type of variable (set only at startup) */
155         int                     status;                 /* status bits, see below */
156         GucSource       source;                 /* source of the current actual value */
157         GucSource       reset_source;   /* source of the reset_value */
158         GucContext      scontext;               /* context that set the current value */
159         GucContext      reset_scontext; /* context that set the reset value */
160         GucStack   *stack;                      /* stacked prior values */
161         void       *extra;                      /* "extra" pointer for current actual value */
162         char       *sourcefile;         /* file current setting is from (NULL if not
163                                                                  * set in config file) */
164         int                     sourceline;             /* line in source file */
165 };
166
167 /* bit values in status field */
168 #define GUC_IS_IN_FILE          0x0001  /* found it in config file */
169 /*
170  * Caution: the GUC_IS_IN_FILE bit is transient state for ProcessConfigFile.
171  * Do not assume that its value represents useful information elsewhere.
172  */
173 #define GUC_PENDING_RESTART 0x0002
174
175
176 /* GUC records for specific variable types */
177
178 struct config_bool
179 {
180         struct config_generic gen;
181         /* constant fields, must be set correctly in initial value: */
182         bool       *variable;
183         bool            boot_val;
184         GucBoolCheckHook check_hook;
185         GucBoolAssignHook assign_hook;
186         GucShowHook show_hook;
187         /* variable fields, initialized at runtime: */
188         bool            reset_val;
189         void       *reset_extra;
190 };
191
192 struct config_int
193 {
194         struct config_generic gen;
195         /* constant fields, must be set correctly in initial value: */
196         int                *variable;
197         int                     boot_val;
198         int                     min;
199         int                     max;
200         GucIntCheckHook check_hook;
201         GucIntAssignHook assign_hook;
202         GucShowHook show_hook;
203         /* variable fields, initialized at runtime: */
204         int                     reset_val;
205         void       *reset_extra;
206 };
207
208 struct config_real
209 {
210         struct config_generic gen;
211         /* constant fields, must be set correctly in initial value: */
212         double     *variable;
213         double          boot_val;
214         double          min;
215         double          max;
216         GucRealCheckHook check_hook;
217         GucRealAssignHook assign_hook;
218         GucShowHook show_hook;
219         /* variable fields, initialized at runtime: */
220         double          reset_val;
221         void       *reset_extra;
222 };
223
224 struct config_string
225 {
226         struct config_generic gen;
227         /* constant fields, must be set correctly in initial value: */
228         char      **variable;
229         const char *boot_val;
230         GucStringCheckHook check_hook;
231         GucStringAssignHook assign_hook;
232         GucShowHook show_hook;
233         /* variable fields, initialized at runtime: */
234         char       *reset_val;
235         void       *reset_extra;
236 };
237
238 struct config_enum
239 {
240         struct config_generic gen;
241         /* constant fields, must be set correctly in initial value: */
242         int                *variable;
243         int                     boot_val;
244         const struct config_enum_entry *options;
245         GucEnumCheckHook check_hook;
246         GucEnumAssignHook assign_hook;
247         GucShowHook show_hook;
248         /* variable fields, initialized at runtime: */
249         int                     reset_val;
250         void       *reset_extra;
251 };
252
253 /* constant tables corresponding to enums above and in guc.h */
254 extern const char *const config_group_names[];
255 extern const char *const config_type_names[];
256 extern const char *const GucContext_Names[];
257 extern const char *const GucSource_Names[];
258
259 /* get the current set of variables */
260 extern struct config_generic **get_guc_variables(void);
261
262 extern void build_guc_variables(void);
263
264 /* search in enum options */
265 extern const char *config_enum_lookup_by_value(struct config_enum *record, int val);
266 extern bool config_enum_lookup_by_name(struct config_enum *record,
267                                                    const char *value, int *retval);
268
269 #endif                                                  /* GUC_TABLES_H */