]> granicus.if.org Git - postgresql/blob - src/include/utils/guc_tables.h
Update CVS HEAD for 2007 copyright. Back branches are typically not
[postgresql] / src / include / utils / guc_tables.h
1 /*-------------------------------------------------------------------------
2  *
3  * guc_tables.h
4  *              Declarations of tables used by GUC.
5  *
6  * See src/backend/utils/misc/README for design notes.
7  *
8  * Portions Copyright (c) 1996-2007, PostgreSQL Global Development Group
9  *
10  *        $PostgreSQL: pgsql/src/include/utils/guc_tables.h,v 1.30 2007/01/05 22:19:59 momjian Exp $
11  *
12  *-------------------------------------------------------------------------
13  */
14 #ifndef GUC_TABLES_H
15 #define GUC_TABLES_H 1
16
17 #include "utils/guc.h"
18
19 /*
20  * GUC supports these types of variables:
21  */
22 enum config_type
23 {
24         PGC_BOOL,
25         PGC_INT,
26         PGC_REAL,
27         PGC_STRING
28 };
29
30 union config_var_value
31 {
32         bool            boolval;
33         int                     intval;
34         double          realval;
35         char       *stringval;
36 };
37
38 /*
39  * Groupings to help organize all the run-time options for display
40  */
41 enum config_group
42 {
43         UNGROUPED,
44         FILE_LOCATIONS,
45         CONN_AUTH,
46         CONN_AUTH_SETTINGS,
47         CONN_AUTH_SECURITY,
48         RESOURCES,
49         RESOURCES_MEM,
50         RESOURCES_FSM,
51         RESOURCES_KERNEL,
52         WAL,
53         WAL_SETTINGS,
54         WAL_CHECKPOINTS,
55         QUERY_TUNING,
56         QUERY_TUNING_METHOD,
57         QUERY_TUNING_COST,
58         QUERY_TUNING_GEQO,
59         QUERY_TUNING_OTHER,
60         LOGGING,
61         LOGGING_WHERE,
62         LOGGING_WHEN,
63         LOGGING_WHAT,
64         STATS,
65         STATS_MONITORING,
66         STATS_COLLECTOR,
67         AUTOVACUUM,
68         CLIENT_CONN,
69         CLIENT_CONN_STATEMENT,
70         CLIENT_CONN_LOCALE,
71         CLIENT_CONN_OTHER,
72         LOCK_MANAGEMENT,
73         COMPAT_OPTIONS,
74         COMPAT_OPTIONS_PREVIOUS,
75         COMPAT_OPTIONS_CLIENT,
76         PRESET_OPTIONS,
77         CUSTOM_OPTIONS,
78         DEVELOPER_OPTIONS
79 };
80
81 /*
82  * Stack entry for saving the state of a variable prior to the current
83  * transaction
84  */
85 typedef struct guc_stack
86 {
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 */
94 } GucStack;
95
96 /*
97  * Generic fields applicable to all types of variables
98  *
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 '. ')
102  */
103 struct config_generic
104 {
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 */
119 };
120
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 */
132
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 */
137
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 */
142
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
148
149 /* GUC records for specific variable types */
150
151 struct config_bool
152 {
153         struct config_generic gen;
154         /* these fields must be set correctly in initial value: */
155         /* (all but reset_val are constants) */
156         bool       *variable;
157         bool            reset_val;
158         GucBoolAssignHook assign_hook;
159         GucShowHook show_hook;
160         /* variable fields, initialized at runtime: */
161         bool            tentative_val;
162 };
163
164 struct config_int
165 {
166         struct config_generic gen;
167         /* these fields must be set correctly in initial value: */
168         /* (all but reset_val are constants) */
169         int                *variable;
170         int                     reset_val;
171         int                     min;
172         int                     max;
173         GucIntAssignHook assign_hook;
174         GucShowHook show_hook;
175         /* variable fields, initialized at runtime: */
176         int                     tentative_val;
177 };
178
179 struct config_real
180 {
181         struct config_generic gen;
182         /* these fields must be set correctly in initial value: */
183         /* (all but reset_val are constants) */
184         double     *variable;
185         double          reset_val;
186         double          min;
187         double          max;
188         GucRealAssignHook assign_hook;
189         GucShowHook show_hook;
190         /* variable fields, initialized at runtime: */
191         double          tentative_val;
192 };
193
194 struct config_string
195 {
196         struct config_generic gen;
197         /* these fields must be set correctly in initial value: */
198         /* (all are constants) */
199         char      **variable;
200         const char *boot_val;
201         GucStringAssignHook assign_hook;
202         GucShowHook show_hook;
203         /* variable fields, initialized at runtime: */
204         char       *reset_val;
205         char       *tentative_val;
206 };
207
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[];
213
214 /* get the current set of variables */
215 extern struct config_generic **get_guc_variables(void);
216
217 extern void build_guc_variables(void);
218
219 #endif   /* GUC_TABLES_H */