1 /*-------------------------------------------------------------------------
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
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 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 */
166 struct config_generic gen
;
167 /* constant fields, must be set correctly in initial value: */
170 GucBoolAssignHook assign_hook
;
171 GucShowHook show_hook
;
172 /* variable fields, initialized at runtime: */
178 struct config_generic gen
;
179 /* constant fields, must be set correctly in initial value: */
184 GucIntAssignHook assign_hook
;
185 GucShowHook show_hook
;
186 /* variable fields, initialized at runtime: */
192 struct config_generic gen
;
193 /* constant fields, must be set correctly in initial value: */
198 GucRealAssignHook assign_hook
;
199 GucShowHook show_hook
;
200 /* variable fields, initialized at runtime: */
206 struct config_generic gen
;
207 /* constant fields, must be set correctly in initial value: */
209 const char *boot_val
;
210 GucStringAssignHook assign_hook
;
211 GucShowHook show_hook
;
212 /* variable fields, initialized at runtime: */
218 struct config_generic gen
;
219 /* constant fields, must be set correctly in initial value: */
222 const struct config_enum_entry
*options
;
223 GucEnumAssignHook assign_hook
;
224 GucShowHook show_hook
;
225 /* variable fields, initialized at runtime: */
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 */