Update FSM on WAL replay. This is a bit limited; the FSM is only updated
[PostgreSQL.git] / src / include / utils / guc_tables.h
blob8791660653fbd69f2a23804ae030523f1f9b8cd3
1 /*-------------------------------------------------------------------------
3 * guc_tables.h
4 * Declarations of tables used by GUC.
6 * See src/backend/utils/misc/README for design notes.
8 * Portions Copyright (c) 1996-2008, PostgreSQL Global Development Group
10 * $PostgreSQL$
12 *-------------------------------------------------------------------------
14 #ifndef GUC_TABLES_H
15 #define GUC_TABLES_H 1
17 #include "utils/guc.h"
20 * GUC supports these types of variables:
22 enum config_type
24 PGC_BOOL,
25 PGC_INT,
26 PGC_REAL,
27 PGC_STRING,
28 PGC_ENUM
31 union config_var_value
33 bool boolval;
34 int intval;
35 double realval;
36 char *stringval;
37 int enumval;
41 * Groupings to help organize all the run-time options for display
43 enum config_group
45 UNGROUPED,
46 FILE_LOCATIONS,
47 CONN_AUTH,
48 CONN_AUTH_SETTINGS,
49 CONN_AUTH_SECURITY,
50 RESOURCES,
51 RESOURCES_MEM,
52 RESOURCES_KERNEL,
53 WAL,
54 WAL_SETTINGS,
55 WAL_CHECKPOINTS,
56 QUERY_TUNING,
57 QUERY_TUNING_METHOD,
58 QUERY_TUNING_COST,
59 QUERY_TUNING_GEQO,
60 QUERY_TUNING_OTHER,
61 LOGGING,
62 LOGGING_WHERE,
63 LOGGING_WHEN,
64 LOGGING_WHAT,
65 STATS,
66 STATS_MONITORING,
67 STATS_COLLECTOR,
68 AUTOVACUUM,
69 CLIENT_CONN,
70 CLIENT_CONN_STATEMENT,
71 CLIENT_CONN_LOCALE,
72 CLIENT_CONN_OTHER,
73 LOCK_MANAGEMENT,
74 COMPAT_OPTIONS,
75 COMPAT_OPTIONS_PREVIOUS,
76 COMPAT_OPTIONS_CLIENT,
77 PRESET_OPTIONS,
78 CUSTOM_OPTIONS,
79 DEVELOPER_OPTIONS
83 * Stack entry for saving the state a variable had prior to an uncommitted
84 * transactional change
86 typedef enum
88 /* This is almost GucAction, but we need a fourth state for SET+LOCAL */
89 GUC_SAVE, /* entry caused by function SET option */
90 GUC_SET, /* entry caused by plain SET command */
91 GUC_LOCAL, /* entry caused by SET LOCAL command */
92 GUC_SET_LOCAL /* entry caused by SET then SET LOCAL */
93 } GucStackState;
95 typedef struct guc_stack
97 struct guc_stack *prev; /* previous stack item, if any */
98 int nest_level; /* nesting depth at which we made entry */
99 GucStackState state; /* see enum above */
100 GucSource source; /* source of the prior value */
101 union config_var_value prior; /* previous value of variable */
102 union config_var_value masked; /* SET value in a GUC_SET_LOCAL entry */
103 /* masked value's source must be PGC_S_SESSION, so no need to store it */
104 } GucStack;
107 * Generic fields applicable to all types of variables
109 * The short description should be less than 80 chars in length. Some
110 * applications may use the long description as well, and will append
111 * it to the short description. (separated by a newline or '. ')
113 struct config_generic
115 /* constant fields, must be set correctly in initial value: */
116 const char *name; /* name of variable - MUST BE FIRST */
117 GucContext context; /* context required to set the variable */
118 enum config_group group; /* to help organize variables by function */
119 const char *short_desc; /* short desc. of this variable's purpose */
120 const char *long_desc; /* long desc. of this variable's purpose */
121 int flags; /* flag bits, see below */
122 /* variable fields, initialized at runtime: */
123 enum config_type vartype; /* type of variable (set only at startup) */
124 int status; /* status bits, see below */
125 GucSource reset_source; /* source of the reset_value */
126 GucSource source; /* source of the current actual value */
127 GucStack *stack; /* stacked prior values */
128 char *sourcefile; /* file this settings is from (NULL if not file) */
129 int sourceline; /* line in source file */
132 /* bit values in flags field */
133 #define GUC_LIST_INPUT 0x0001 /* input can be list format */
134 #define GUC_LIST_QUOTE 0x0002 /* double-quote list elements */
135 #define GUC_NO_SHOW_ALL 0x0004 /* exclude from SHOW ALL */
136 #define GUC_NO_RESET_ALL 0x0008 /* exclude from RESET ALL */
137 #define GUC_REPORT 0x0010 /* auto-report changes to client */
138 #define GUC_NOT_IN_SAMPLE 0x0020 /* not in postgresql.conf.sample */
139 #define GUC_DISALLOW_IN_FILE 0x0040 /* can't set in postgresql.conf */
140 #define GUC_CUSTOM_PLACEHOLDER 0x0080 /* placeholder for custom variable */
141 #define GUC_SUPERUSER_ONLY 0x0100 /* show only to superusers */
142 #define GUC_IS_NAME 0x0200 /* limit string to NAMEDATALEN-1 */
144 #define GUC_UNIT_KB 0x0400 /* value is in kilobytes */
145 #define GUC_UNIT_BLOCKS 0x0800 /* value is in blocks */
146 #define GUC_UNIT_XBLOCKS 0x0C00 /* value is in xlog blocks */
147 #define GUC_UNIT_MEMORY 0x0C00 /* mask for KB, BLOCKS, XBLOCKS */
149 #define GUC_UNIT_MS 0x1000 /* value is in milliseconds */
150 #define GUC_UNIT_S 0x2000 /* value is in seconds */
151 #define GUC_UNIT_MIN 0x4000 /* value is in minutes */
152 #define GUC_UNIT_TIME 0x7000 /* mask for MS, S, MIN */
154 /* bit values in status field */
155 #define GUC_IS_IN_FILE 0x0001 /* found it in config file */
157 * Caution: the GUC_IS_IN_FILE bit is transient state for ProcessConfigFile.
158 * Do not assume that its value represents useful information elsewhere.
162 /* GUC records for specific variable types */
164 struct config_bool
166 struct config_generic gen;
167 /* constant fields, must be set correctly in initial value: */
168 bool *variable;
169 bool boot_val;
170 GucBoolAssignHook assign_hook;
171 GucShowHook show_hook;
172 /* variable fields, initialized at runtime: */
173 bool reset_val;
176 struct config_int
178 struct config_generic gen;
179 /* constant fields, must be set correctly in initial value: */
180 int *variable;
181 int boot_val;
182 int min;
183 int max;
184 GucIntAssignHook assign_hook;
185 GucShowHook show_hook;
186 /* variable fields, initialized at runtime: */
187 int reset_val;
190 struct config_real
192 struct config_generic gen;
193 /* constant fields, must be set correctly in initial value: */
194 double *variable;
195 double boot_val;
196 double min;
197 double max;
198 GucRealAssignHook assign_hook;
199 GucShowHook show_hook;
200 /* variable fields, initialized at runtime: */
201 double reset_val;
204 struct config_string
206 struct config_generic gen;
207 /* constant fields, must be set correctly in initial value: */
208 char **variable;
209 const char *boot_val;
210 GucStringAssignHook assign_hook;
211 GucShowHook show_hook;
212 /* variable fields, initialized at runtime: */
213 char *reset_val;
216 struct config_enum
218 struct config_generic gen;
219 /* constant fields, must be set correctly in initial value: */
220 int *variable;
221 int boot_val;
222 const struct config_enum_entry *options;
223 GucEnumAssignHook assign_hook;
224 GucShowHook show_hook;
225 /* variable fields, initialized at runtime: */
226 int reset_val;
229 /* constant tables corresponding to enums above and in guc.h */
230 extern const char *const config_group_names[];
231 extern const char *const config_type_names[];
232 extern const char *const GucContext_Names[];
233 extern const char *const GucSource_Names[];
235 /* get the current set of variables */
236 extern struct config_generic **get_guc_variables(void);
238 extern void build_guc_variables(void);
240 /* search in enum options */
241 extern const char *config_enum_lookup_by_value(struct config_enum *record, int val);
242 extern bool config_enum_lookup_by_name(struct config_enum *record,
243 const char *value, int *retval);
246 #endif /* GUC_TABLES_H */