1 /*-------------------------------------------------------------------------
4 * Declarations of tables used by GUC.
6 * See src/backend/utils/misc/README for design notes.
8 * Portions Copyright (c) 1996-2007, PostgreSQL Global Development Group
10 * $PostgreSQL: pgsql/src/include/utils/guc_tables.h,v 1.30 2007/01/05 22:19:59 momjian Exp $
12 *-------------------------------------------------------------------------
15 #define GUC_TABLES_H 1
17 #include "utils/guc.h"
20 * GUC supports these types of variables:
30 union config_var_value
39 * Groupings to help organize all the run-time options for display
69 CLIENT_CONN_STATEMENT,
74 COMPAT_OPTIONS_PREVIOUS,
75 COMPAT_OPTIONS_CLIENT,
82 * Stack entry for saving the state of a variable prior to the current
85 typedef struct guc_stack
87 struct guc_stack *prev; /* previous stack item, if any */
88 int nest_level; /* nesting depth of cur transaction */
89 int status; /* previous status bits, see below */
90 GucSource tentative_source; /* source of the tentative_value */
91 GucSource source; /* source of the actual value */
92 union config_var_value tentative_val; /* previous tentative val */
93 union config_var_value value; /* previous actual value */
97 * Generic fields applicable to all types of variables
99 * The short description should be less than 80 chars in length. Some
100 * applications may use the long description as well, and will append
101 * it to the short description. (separated by a newline or '. ')
103 struct config_generic
105 /* constant fields, must be set correctly in initial value: */
106 const char *name; /* name of variable - MUST BE FIRST */
107 GucContext context; /* context required to set the variable */
108 enum config_group group; /* to help organize variables by function */
109 const char *short_desc; /* short desc. of this variable's purpose */
110 const char *long_desc; /* long desc. of this variable's purpose */
111 int flags; /* flag bits, see below */
112 /* variable fields, initialized at runtime: */
113 enum config_type vartype; /* type of variable (set only at startup) */
114 int status; /* status bits, see below */
115 GucSource reset_source; /* source of the reset_value */
116 GucSource tentative_source; /* source of the tentative_value */
117 GucSource source; /* source of the current actual value */
118 GucStack *stack; /* stacked outside-of-transaction states */
121 /* bit values in flags field */
122 #define GUC_LIST_INPUT 0x0001 /* input can be list format */
123 #define GUC_LIST_QUOTE 0x0002 /* double-quote list elements */
124 #define GUC_NO_SHOW_ALL 0x0004 /* exclude from SHOW ALL */
125 #define GUC_NO_RESET_ALL 0x0008 /* exclude from RESET ALL */
126 #define GUC_REPORT 0x0010 /* auto-report changes to client */
127 #define GUC_NOT_IN_SAMPLE 0x0020 /* not in postgresql.conf.sample */
128 #define GUC_DISALLOW_IN_FILE 0x0040 /* can't set in postgresql.conf */
129 #define GUC_CUSTOM_PLACEHOLDER 0x0080 /* placeholder for custom variable */
130 #define GUC_SUPERUSER_ONLY 0x0100 /* show only to superusers */
131 #define GUC_IS_NAME 0x0200 /* limit string to NAMEDATALEN-1 */
133 #define GUC_UNIT_KB 0x0400 /* value is in 1 kB */
134 #define GUC_UNIT_BLOCKS 0x0800 /* value is in blocks */
135 #define GUC_UNIT_XBLOCKS 0x0C00 /* value is in xlog blocks */
136 #define GUC_UNIT_MEMORY 0x0C00 /* mask for KB, BLOCKS, XBLOCKS */
138 #define GUC_UNIT_MS 0x1000 /* value is in milliseconds */
139 #define GUC_UNIT_S 0x2000 /* value is in seconds */
140 #define GUC_UNIT_MIN 0x4000 /* value is in minutes */
141 #define GUC_UNIT_TIME 0x7000 /* mask for MS, S, MIN */
143 /* bit values in status field */
144 #define GUC_HAVE_TENTATIVE 0x0001 /* tentative value is defined */
145 #define GUC_HAVE_LOCAL 0x0002 /* a SET LOCAL has been executed */
146 #define GUC_HAVE_STACK 0x0004 /* we have stacked prior value(s) */
149 /* GUC records for specific variable types */
153 struct config_generic gen;
154 /* these fields must be set correctly in initial value: */
155 /* (all but reset_val are constants) */
158 GucBoolAssignHook assign_hook;
159 GucShowHook show_hook;
160 /* variable fields, initialized at runtime: */
166 struct config_generic gen;
167 /* these fields must be set correctly in initial value: */
168 /* (all but reset_val are constants) */
173 GucIntAssignHook assign_hook;
174 GucShowHook show_hook;
175 /* variable fields, initialized at runtime: */
181 struct config_generic gen;
182 /* these fields must be set correctly in initial value: */
183 /* (all but reset_val are constants) */
188 GucRealAssignHook assign_hook;
189 GucShowHook show_hook;
190 /* variable fields, initialized at runtime: */
191 double tentative_val;
196 struct config_generic gen;
197 /* these fields must be set correctly in initial value: */
198 /* (all are constants) */
200 const char *boot_val;
201 GucStringAssignHook assign_hook;
202 GucShowHook show_hook;
203 /* variable fields, initialized at runtime: */
208 /* constant tables corresponding to enums above and in guc.h */
209 extern const char *const config_group_names[];
210 extern const char *const config_type_names[];
211 extern const char *const GucContext_Names[];
212 extern const char *const GucSource_Names[];
214 /* get the current set of variables */
215 extern struct config_generic **get_guc_variables(void);
217 extern void build_guc_variables(void);
219 #endif /* GUC_TABLES_H */