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