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.34 2007/09/10 00:57:22 tgl 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 kilobytes */
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) */
147 #define GUC_IS_IN_FILE 0x0008 /* found it in config file */
149 * Caution: the GUC_IS_IN_FILE bit is transient state for ProcessConfigFile.
150 * Do not assume that its value represents useful information elsewhere.
154 /* GUC records for specific variable types */
158 struct config_generic gen;
159 /* constant fields, must be set correctly in initial value: */
162 GucBoolAssignHook assign_hook;
163 GucShowHook show_hook;
164 /* variable fields, initialized at runtime: */
171 struct config_generic gen;
172 /* constant fields, must be set correctly in initial value: */
177 GucIntAssignHook assign_hook;
178 GucShowHook show_hook;
179 /* variable fields, initialized at runtime: */
186 struct config_generic gen;
187 /* constant fields, must be set correctly in initial value: */
192 GucRealAssignHook assign_hook;
193 GucShowHook show_hook;
194 /* variable fields, initialized at runtime: */
196 double tentative_val;
201 struct config_generic gen;
202 /* constant fields, must be set correctly in initial value: */
204 const char *boot_val;
205 GucStringAssignHook assign_hook;
206 GucShowHook show_hook;
207 /* variable fields, initialized at runtime: */
212 /* constant tables corresponding to enums above and in guc.h */
213 extern const char *const config_group_names[];
214 extern const char *const config_type_names[];
215 extern const char *const GucContext_Names[];
216 extern const char *const GucSource_Names[];
218 /* get the current set of variables */
219 extern struct config_generic **get_guc_variables(void);
221 extern void build_guc_variables(void);
223 #endif /* GUC_TABLES_H */