1 /*-------------------------------------------------------------------------
4 * Declarations of tables used by GUC.
6 * See src/backend/utils/misc/README for design notes.
8 * Portions Copyright (c) 1996-2010, PostgreSQL Global Development Group
10 * $PostgreSQL: pgsql/src/include/utils/guc_tables.h,v 1.48 2010/01/15 09:19:09 heikki Exp $
12 *-------------------------------------------------------------------------
15 #define GUC_TABLES_H 1
17 #include "utils/guc.h"
20 * GUC supports these types of variables:
31 union config_var_value
41 * Groupings to help organize all the run-time options for display
71 CLIENT_CONN_STATEMENT,
76 COMPAT_OPTIONS_PREVIOUS,
77 COMPAT_OPTIONS_CLIENT,
84 * Stack entry for saving the state a variable had prior to an uncommitted
85 * transactional change
89 /* This is almost GucAction, but we need a fourth state for SET+LOCAL */
90 GUC_SAVE, /* entry caused by function SET option */
91 GUC_SET, /* entry caused by plain SET command */
92 GUC_LOCAL, /* entry caused by SET LOCAL command */
93 GUC_SET_LOCAL /* entry caused by SET then SET LOCAL */
96 typedef struct guc_stack
98 struct guc_stack *prev; /* previous stack item, if any */
99 int nest_level; /* nesting depth at which we made entry */
100 GucStackState state; /* see enum above */
101 GucSource source; /* source of the prior value */
102 union config_var_value prior; /* previous value of variable */
103 union config_var_value masked; /* SET value in a GUC_SET_LOCAL entry */
104 /* masked value's source must be PGC_S_SESSION, so no need to store it */
108 * Generic fields applicable to all types of variables
110 * The short description should be less than 80 chars in length. Some
111 * applications may use the long description as well, and will append
112 * it to the short description. (separated by a newline or '. ')
114 struct config_generic
116 /* constant fields, must be set correctly in initial value: */
117 const char *name; /* name of variable - MUST BE FIRST */
118 GucContext context; /* context required to set the variable */
119 enum config_group group; /* to help organize variables by function */
120 const char *short_desc; /* short desc. of this variable's purpose */
121 const char *long_desc; /* long desc. of this variable's purpose */
122 int flags; /* flag bits, see below */
123 /* variable fields, initialized at runtime: */
124 enum config_type vartype; /* type of variable (set only at startup) */
125 int status; /* status bits, see below */
126 GucSource reset_source; /* source of the reset_value */
127 GucSource source; /* source of the current actual value */
128 GucStack *stack; /* stacked prior values */
129 char *sourcefile; /* file this settings is from (NULL if not
131 int sourceline; /* line in source file */
134 /* bit values in flags field are defined in guc.h */
136 /* bit values in status field */
137 #define GUC_IS_IN_FILE 0x0001 /* found it in config file */
139 * Caution: the GUC_IS_IN_FILE bit is transient state for ProcessConfigFile.
140 * Do not assume that its value represents useful information elsewhere.
144 /* GUC records for specific variable types */
148 struct config_generic gen;
149 /* constant fields, must be set correctly in initial value: */
152 GucBoolAssignHook assign_hook;
153 GucShowHook show_hook;
154 /* variable fields, initialized at runtime: */
160 struct config_generic gen;
161 /* constant fields, must be set correctly in initial value: */
166 GucIntAssignHook assign_hook;
167 GucShowHook show_hook;
168 /* variable fields, initialized at runtime: */
174 struct config_generic gen;
175 /* constant fields, must be set correctly in initial value: */
180 GucRealAssignHook assign_hook;
181 GucShowHook show_hook;
182 /* variable fields, initialized at runtime: */
188 struct config_generic gen;
189 /* constant fields, must be set correctly in initial value: */
191 const char *boot_val;
192 GucStringAssignHook assign_hook;
193 GucShowHook show_hook;
194 /* variable fields, initialized at runtime: */
200 struct config_generic gen;
201 /* constant fields, must be set correctly in initial value: */
204 const struct config_enum_entry *options;
205 GucEnumAssignHook assign_hook;
206 GucShowHook show_hook;
207 /* variable fields, initialized at runtime: */
211 /* constant tables corresponding to enums above and in guc.h */
212 extern const char *const config_group_names[];
213 extern const char *const config_type_names[];
214 extern const char *const GucContext_Names[];
215 extern const char *const GucSource_Names[];
217 /* get the current set of variables */
218 extern struct config_generic **get_guc_variables(void);
220 extern void build_guc_variables(void);
222 /* search in enum options */
223 extern const char *config_enum_lookup_by_value(struct config_enum * record, int val);
224 extern bool config_enum_lookup_by_name(struct config_enum * record,
225 const char *value, int *retval);
228 #endif /* GUC_TABLES_H */