~vcs-imports/mammoth-replicator/trunk

« back to all changes in this revision

Viewing changes to src/include/utils/guc.h

  • Committer: alvherre
  • Date: 2005-12-16 21:24:52 UTC
  • Revision ID: svn-v4:db760fc0-0f08-0410-9d63-cc6633f64896:trunk:1
Initial import of the REL8_0_3 sources from the Pgsql CVS repository.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*--------------------------------------------------------------------
 
2
 * guc.h
 
3
 *
 
4
 * External declarations pertaining to backend/utils/misc/guc.c and
 
5
 * backend/utils/misc/guc-file.l
 
6
 *
 
7
 * Copyright (c) 2000-2005, PostgreSQL Global Development Group
 
8
 * Written by Peter Eisentraut <peter_e@gmx.net>.
 
9
 *
 
10
 * $PostgreSQL: pgsql/src/include/utils/guc.h,v 1.58.4.1 2005-03-25 16:17:39 tgl Exp $
 
11
 *--------------------------------------------------------------------
 
12
 */
 
13
#ifndef GUC_H
 
14
#define GUC_H
 
15
 
 
16
#include "nodes/pg_list.h"
 
17
#include "tcop/dest.h"
 
18
#include "utils/array.h"
 
19
 
 
20
 
 
21
/*
 
22
 * Certain options can only be set at certain times. The rules are
 
23
 * like this:
 
24
 *
 
25
 * INTERNAL options cannot be set by the user at all, but only through
 
26
 * internal processes ("server_version" is an example).  These are GUC
 
27
 * variables only so they can be shown by SHOW, etc.
 
28
 *
 
29
 * POSTMASTER options can only be set when the postmaster starts,
 
30
 * either from the configuration file or the command line.
 
31
 *
 
32
 * SIGHUP options can only be set at postmaster startup or by changing
 
33
 * the configuration file and sending the HUP signal to the postmaster
 
34
 * or a backend process. (Notice that the signal receipt will not be
 
35
 * evaluated immediately. The postmaster and the backend check it at a
 
36
 * certain point in their main loop. It's safer to wait than to read a
 
37
 * file asynchronously.)
 
38
 *
 
39
 * BACKEND options can only be set at postmaster startup, from the
 
40
 * configuration file, or by client request in the connection startup
 
41
 * packet (e.g., from libpq's PGOPTIONS variable).  Furthermore, an
 
42
 * already-started backend will ignore changes to such an option in the
 
43
 * configuration file.  The idea is that these options are fixed for a
 
44
 * given backend once it's started, but they can vary across backends.
 
45
 *
 
46
 * SUSET options can be set at postmaster startup, with the SIGHUP
 
47
 * mechanism, or from SQL if you're a superuser.
 
48
 *
 
49
 * USERSET options can be set by anyone any time.
 
50
 */
 
51
typedef enum
 
52
{
 
53
        PGC_INTERNAL,
 
54
        PGC_POSTMASTER,
 
55
        PGC_SIGHUP,
 
56
        PGC_BACKEND,
 
57
        PGC_SUSET,
 
58
        PGC_USERSET
 
59
} GucContext;
 
60
 
 
61
/*
 
62
 * The following type records the source of the current setting.  A
 
63
 * new setting can only take effect if the previous setting had the
 
64
 * same or lower level.  (E.g, changing the config file doesn't
 
65
 * override the postmaster command line.)  Tracking the source allows us
 
66
 * to process sources in any convenient order without affecting results.
 
67
 * Sources <= PGC_S_OVERRIDE will set the default used by RESET, as well
 
68
 * as the current value.  Note that source == PGC_S_OVERRIDE should be
 
69
 * used when setting a PGC_INTERNAL option.
 
70
 *
 
71
 * PGC_S_INTERACTIVE isn't actually a source value, but is the
 
72
 * dividing line between "interactive" and "non-interactive" sources for
 
73
 * error reporting purposes.
 
74
 *
 
75
 * PGC_S_TEST is used when testing values to be stored as per-database or
 
76
 * per-user defaults ("doit" will always be false, so this never gets stored
 
77
 * as the actual source of any value).  This is an interactive case, but
 
78
 * it needs its own source value because some assign hooks need to make
 
79
 * different validity checks in this case.
 
80
 */
 
81
typedef enum
 
82
{
 
83
        PGC_S_DEFAULT,                          /* wired-in default */
 
84
        PGC_S_ENV_VAR,                          /* postmaster environment variable */
 
85
        PGC_S_FILE,                                     /* postgresql.conf */
 
86
        PGC_S_ARGV,                                     /* postmaster command line */
 
87
        PGC_S_DATABASE,                         /* per-database setting */
 
88
        PGC_S_USER,                                     /* per-user setting */
 
89
        PGC_S_CLIENT,                           /* from client connection request */
 
90
        PGC_S_OVERRIDE,                         /* special case to forcibly set default */
 
91
        PGC_S_INTERACTIVE,                      /* dividing line for error reporting */
 
92
        PGC_S_TEST,                                     /* test per-database or per-user setting */
 
93
        PGC_S_SESSION                           /* SET command */
 
94
} GucSource;
 
95
 
 
96
typedef const char *(*GucStringAssignHook) (const char *newval, bool doit, GucSource source);
 
97
typedef bool (*GucBoolAssignHook) (bool newval, bool doit, GucSource source);
 
98
typedef bool (*GucIntAssignHook) (int newval, bool doit, GucSource source);
 
99
typedef bool (*GucRealAssignHook) (double newval, bool doit, GucSource source);
 
100
 
 
101
typedef const char *(*GucShowHook) (void);
 
102
 
 
103
#define GUC_QUALIFIER_SEPARATOR '.'
 
104
 
 
105
/* GUC vars that are actually declared in guc.c, rather than elsewhere */
 
106
extern bool log_duration;
 
107
extern bool Debug_print_plan;
 
108
extern bool Debug_print_parse;
 
109
extern bool Debug_print_rewritten;
 
110
extern bool Debug_pretty_print;
 
111
extern bool Explain_pretty_print;
 
112
 
 
113
extern bool log_parser_stats;
 
114
extern bool log_planner_stats;
 
115
extern bool log_executor_stats;
 
116
extern bool log_statement_stats;
 
117
extern bool log_btree_build_stats;
 
118
 
 
119
extern bool SQL_inheritance;
 
120
extern bool Australian_timezones;
 
121
 
 
122
extern bool default_with_oids;
 
123
 
 
124
extern int      log_min_error_statement;
 
125
extern int      log_min_messages;
 
126
extern int      client_min_messages;
 
127
extern int      log_min_duration_statement;
 
128
 
 
129
extern char *ConfigFileName;
 
130
extern char *HbaFileName;
 
131
extern char *IdentFileName;
 
132
extern char *external_pid_file;
 
133
 
 
134
 
 
135
extern void SetConfigOption(const char *name, const char *value,
 
136
                                GucContext context, GucSource source);
 
137
 
 
138
extern void DefineCustomBoolVariable(
 
139
                                                 const char *name,
 
140
                                                 const char *short_desc,
 
141
                                                 const char *long_desc,
 
142
                                                 bool *valueAddr,
 
143
                                                 GucContext context,
 
144
                                                 GucBoolAssignHook assign_hook,
 
145
                                                 GucShowHook show_hook);
 
146
 
 
147
extern void DefineCustomIntVariable(
 
148
                                                const char *name,
 
149
                                                const char *short_desc,
 
150
                                                const char *long_desc,
 
151
                                                int *valueAddr,
 
152
                                                int minValue,
 
153
                                                int maxValue,
 
154
                                                GucContext context,
 
155
                                                GucIntAssignHook assign_hook,
 
156
                                                GucShowHook show_hook);
 
157
 
 
158
extern void DefineCustomRealVariable(
 
159
                                                 const char *name,
 
160
                                                 const char *short_desc,
 
161
                                                 const char *long_desc,
 
162
                                                 double *valueAddr,
 
163
                                                 double minValue,
 
164
                                                 double maxValue,
 
165
                                                 GucContext context,
 
166
                                                 GucRealAssignHook assign_hook,
 
167
                                                 GucShowHook show_hook);
 
168
 
 
169
extern void DefineCustomStringVariable(
 
170
                                                   const char *name,
 
171
                                                   const char *short_desc,
 
172
                                                   const char *long_desc,
 
173
                                                   char **valueAddr,
 
174
                                                   GucContext context,
 
175
                                                   GucStringAssignHook assign_hook,
 
176
                                                   GucShowHook show_hook);
 
177
 
 
178
extern void EmitWarningsOnPlaceholders(const char *className);
 
179
 
 
180
extern const char *GetConfigOption(const char *name);
 
181
extern const char *GetConfigOptionResetString(const char *name);
 
182
extern bool IsSuperuserConfigOption(const char *name);
 
183
extern void ProcessConfigFile(GucContext context);
 
184
extern void InitializeGUCOptions(void);
 
185
extern bool SelectConfigFiles(const char *userDoption, const char *progname);
 
186
extern void ResetAllOptions(void);
 
187
extern void AtEOXact_GUC(bool isCommit, bool isSubXact);
 
188
extern void BeginReportingGUCOptions(void);
 
189
extern void ParseLongOption(const char *string, char **name, char **value);
 
190
extern bool set_config_option(const char *name, const char *value,
 
191
                                  GucContext context, GucSource source,
 
192
                                  bool isLocal, bool changeVal);
 
193
extern char *GetConfigOptionByName(const char *name, const char **varname);
 
194
extern void GetConfigOptionByNum(int varnum, const char **values, bool *noshow);
 
195
extern int      GetNumConfigOptions(void);
 
196
 
 
197
extern void SetPGVariable(const char *name, List *args, bool is_local);
 
198
extern void GetPGVariable(const char *name, DestReceiver *dest);
 
199
extern TupleDesc GetPGVariableResultDesc(const char *name);
 
200
extern void ResetPGVariable(const char *name);
 
201
 
 
202
extern char *flatten_set_variable_args(const char *name, List *args);
 
203
 
 
204
extern void ProcessGUCArray(ArrayType *array, GucSource source);
 
205
extern ArrayType *GUCArrayAdd(ArrayType *array, const char *name, const char *value);
 
206
extern ArrayType *GUCArrayDelete(ArrayType *array, const char *name);
 
207
 
 
208
#ifdef EXEC_BACKEND
 
209
extern void write_nondefault_variables(GucContext context);
 
210
extern void read_nondefault_variables(void);
 
211
#endif
 
212
 
 
213
/*
 
214
 * The following functions are not in guc.c, but are declared here to avoid
 
215
 * having to include guc.h in some widely used headers that it really doesn't
 
216
 * belong in.
 
217
 */
 
218
 
 
219
/* in utils/adt/datetime.c */
 
220
extern bool ClearDateCache(bool newval, bool doit, GucSource source);
 
221
 
 
222
/* in commands/tablespace.c */
 
223
extern const char *assign_default_tablespace(const char *newval,
 
224
                                   bool doit, GucSource source);
 
225
 
 
226
/* in utils/adt/regexp.c */
 
227
extern const char *assign_regex_flavor(const char *value,
 
228
                                        bool doit, GucSource source);
 
229
 
 
230
/* in catalog/namespace.c */
 
231
extern const char *assign_search_path(const char *newval,
 
232
                                   bool doit, GucSource source);
 
233
 
 
234
/* in access/transam/xlog.c */
 
235
extern const char *assign_xlog_sync_method(const char *method,
 
236
                                                bool doit, GucSource source);
 
237
 
 
238
#endif   /* GUC_H */