]> granicus.if.org Git - postgresql/blob - src/include/utils/guc_tables.h
Whack some sense into the configuration-file-location patch.
[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-2004, PostgreSQL Global Development Group
9  *
10  *        $PostgreSQL: pgsql/src/include/utils/guc_tables.h,v 1.17 2004/10/08 01:36:36 tgl Exp $
11  *
12  *-------------------------------------------------------------------------
13  */
14 #ifndef GUC_TABLES_H
15 #define GUC_TABLES_H 1
16
17 /*
18  * GUC supports these types of variables:
19  */
20 enum config_type
21 {
22         PGC_BOOL,
23         PGC_INT,
24         PGC_REAL,
25         PGC_STRING
26 };
27
28 union config_var_value
29 {
30         bool            boolval;
31         int                     intval;
32         double          realval;
33         char       *stringval;
34 };
35
36 /*
37  * Groupings to help organize all the run-time options for display
38  */
39 enum config_group
40 {
41         UNGROUPED,
42         FILE_LOCATIONS,
43         CONN_AUTH,
44         CONN_AUTH_SETTINGS,
45         CONN_AUTH_SECURITY,
46         RESOURCES,
47         RESOURCES_MEM,
48         RESOURCES_FSM,
49         RESOURCES_KERNEL,
50         WAL,
51         WAL_SETTINGS,
52         WAL_CHECKPOINTS,
53         QUERY_TUNING,
54         QUERY_TUNING_METHOD,
55         QUERY_TUNING_COST,
56         QUERY_TUNING_GEQO,
57         QUERY_TUNING_OTHER,
58         LOGGING,
59         LOGGING_WHERE,
60         LOGGING_WHEN,
61         LOGGING_WHAT,
62         STATS,
63         STATS_MONITORING,
64         STATS_COLLECTOR,
65         CLIENT_CONN,
66         CLIENT_CONN_STATEMENT,
67         CLIENT_CONN_LOCALE,
68         CLIENT_CONN_OTHER,
69         LOCK_MANAGEMENT,
70         COMPAT_OPTIONS,
71         COMPAT_OPTIONS_PREVIOUS,
72         COMPAT_OPTIONS_CLIENT,
73         PRESET_OPTIONS,
74         CUSTOM_OPTIONS,
75         DEVELOPER_OPTIONS
76 };
77
78 /*
79  * Stack entry for saving the state of a variable prior to the current
80  * transaction
81  */
82 typedef struct guc_stack
83 {
84         struct guc_stack *prev;         /* previous stack item, if any */
85         int                     nest_level;             /* nesting depth of cur transaction */
86         int                     status;                 /* previous status bits, see below */
87         GucSource       tentative_source;               /* source of the tentative_value */
88         GucSource       source;                 /* source of the actual value */
89         union config_var_value tentative_val;           /* previous tentative val */
90         union config_var_value value;           /* previous actual value */
91 } GucStack;
92
93 /*
94  * Generic fields applicable to all types of variables
95  *
96  * The short description should be less than 80 chars in length. Some
97  * applications may use the long description as well, and will append
98  * it to the short description. (separated by a newline or '. ')
99  */
100 struct config_generic
101 {
102         /* constant fields, must be set correctly in initial value: */
103         const char *name;                       /* name of variable - MUST BE FIRST */
104         GucContext      context;                /* context required to set the variable */
105         enum config_group group;        /* to help organize variables by function */
106         const char *short_desc;         /* short desc. of this variable's purpose */
107         const char *long_desc;          /* long desc. of this variable's purpose */
108         int                     flags;                  /* flag bits, see below */
109         /* variable fields, initialized at runtime: */
110         enum config_type vartype;       /* type of variable (set only at startup) */
111         int                     status;                 /* status bits, see below */
112         GucSource       reset_source;   /* source of the reset_value */
113         GucSource       tentative_source;               /* source of the tentative_value */
114         GucSource       source;                 /* source of the current actual value */
115         GucStack   *stack;                      /* stacked outside-of-transaction states */
116 };
117
118 /* bit values in flags field */
119 #define GUC_LIST_INPUT                  0x0001  /* input can be list format */
120 #define GUC_LIST_QUOTE                  0x0002  /* double-quote list elements */
121 #define GUC_NO_SHOW_ALL                 0x0004  /* exclude from SHOW ALL */
122 #define GUC_NO_RESET_ALL                0x0008  /* exclude from RESET ALL */
123 #define GUC_REPORT                              0x0010  /* auto-report changes to client */
124 #define GUC_NOT_IN_SAMPLE               0x0020  /* not in postgresql.conf.sample */
125 #define GUC_DISALLOW_IN_FILE    0x0040  /* can't set in postgresql.conf */
126 #define GUC_CUSTOM_PLACEHOLDER  0x0080  /* placeholder for a custom
127                                                                                  * variable */
128
129 /* bit values in status field */
130 #define GUC_HAVE_TENTATIVE      0x0001          /* tentative value is defined */
131 #define GUC_HAVE_LOCAL          0x0002          /* a SET LOCAL has been executed */
132 #define GUC_HAVE_STACK          0x0004          /* we have stacked prior value(s) */
133
134
135 /* GUC records for specific variable types */
136
137 struct config_bool
138 {
139         struct config_generic gen;
140         /* these fields must be set correctly in initial value: */
141         /* (all but reset_val are constants) */
142         bool       *variable;
143         bool            reset_val;
144         GucBoolAssignHook assign_hook;
145         GucShowHook show_hook;
146         /* variable fields, initialized at runtime: */
147         bool            tentative_val;
148 };
149
150 struct config_int
151 {
152         struct config_generic gen;
153         /* these fields must be set correctly in initial value: */
154         /* (all but reset_val are constants) */
155         int                *variable;
156         int                     reset_val;
157         int                     min;
158         int                     max;
159         GucIntAssignHook assign_hook;
160         GucShowHook show_hook;
161         /* variable fields, initialized at runtime: */
162         int                     tentative_val;
163 };
164
165 struct config_real
166 {
167         struct config_generic gen;
168         /* these fields must be set correctly in initial value: */
169         /* (all but reset_val are constants) */
170         double     *variable;
171         double          reset_val;
172         double          min;
173         double          max;
174         GucRealAssignHook assign_hook;
175         GucShowHook show_hook;
176         /* variable fields, initialized at runtime: */
177         double          tentative_val;
178 };
179
180 struct config_string
181 {
182         struct config_generic gen;
183         /* these fields must be set correctly in initial value: */
184         /* (all are constants) */
185         char      **variable;
186         const char *boot_val;
187         GucStringAssignHook assign_hook;
188         GucShowHook show_hook;
189         /* variable fields, initialized at runtime: */
190         char       *reset_val;
191         char       *tentative_val;
192 };
193
194 /* constant tables corresponding to enums above and in guc.h */
195 extern const char *const config_group_names[];
196 extern const char *const config_type_names[];
197 extern const char *const GucContext_Names[];
198 extern const char *const GucSource_Names[];
199
200 /* get the current set of variables */
201 extern struct config_generic **get_guc_variables(void);
202
203 extern void build_guc_variables(void);
204
205 #endif   /* GUC_TABLES_H */