1 /*-------------------------------------------------------------------------
4 * Declarations of tables used by GUC.
6 * See src/backend/utils/misc/README for design notes.
8 * Portions Copyright (c) 1996-2009, PostgreSQL Global Development Group
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
70 CLIENT_CONN_STATEMENT
,
75 COMPAT_OPTIONS_PREVIOUS
,
76 COMPAT_OPTIONS_CLIENT
,
83 * Stack entry for saving the state a variable had prior to an uncommitted
84 * transactional change
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 */
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 */
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
130 int sourceline
; /* line in source file */
133 /* bit values in flags field are defined in guc.h */
135 /* bit values in status field */
136 #define GUC_IS_IN_FILE 0x0001 /* found it in config file */
138 * Caution: the GUC_IS_IN_FILE bit is transient state for ProcessConfigFile.
139 * Do not assume that its value represents useful information elsewhere.
143 /* GUC records for specific variable types */
147 struct config_generic gen
;
148 /* constant fields, must be set correctly in initial value: */
151 GucBoolAssignHook assign_hook
;
152 GucShowHook show_hook
;
153 /* variable fields, initialized at runtime: */
159 struct config_generic gen
;
160 /* constant fields, must be set correctly in initial value: */
165 GucIntAssignHook assign_hook
;
166 GucShowHook show_hook
;
167 /* variable fields, initialized at runtime: */
173 struct config_generic gen
;
174 /* constant fields, must be set correctly in initial value: */
179 GucRealAssignHook assign_hook
;
180 GucShowHook show_hook
;
181 /* variable fields, initialized at runtime: */
187 struct config_generic gen
;
188 /* constant fields, must be set correctly in initial value: */
190 const char *boot_val
;
191 GucStringAssignHook assign_hook
;
192 GucShowHook show_hook
;
193 /* variable fields, initialized at runtime: */
199 struct config_generic gen
;
200 /* constant fields, must be set correctly in initial value: */
203 const struct config_enum_entry
*options
;
204 GucEnumAssignHook assign_hook
;
205 GucShowHook show_hook
;
206 /* variable fields, initialized at runtime: */
210 /* constant tables corresponding to enums above and in guc.h */
211 extern const char *const config_group_names
[];
212 extern const char *const config_type_names
[];
213 extern const char *const GucContext_Names
[];
214 extern const char *const GucSource_Names
[];
216 /* get the current set of variables */
217 extern struct config_generic
**get_guc_variables(void);
219 extern void build_guc_variables(void);
221 /* search in enum options */
222 extern const char *config_enum_lookup_by_value(struct config_enum
* record
, int val
);
223 extern bool config_enum_lookup_by_name(struct config_enum
* record
,
224 const char *value
, int *retval
);
227 #endif /* GUC_TABLES_H */