1
/*--------------------------------------------------------------------
4
* External declarations pertaining to backend/utils/misc/guc.c and
5
* backend/utils/misc/guc-file.l
7
* Copyright (c) 2000-2005, PostgreSQL Global Development Group
8
* Written by Peter Eisentraut <peter_e@gmx.net>.
10
* $PostgreSQL: pgsql/src/include/utils/guc.h,v 1.58.4.1 2005-03-25 16:17:39 tgl Exp $
11
*--------------------------------------------------------------------
16
#include "nodes/pg_list.h"
17
#include "tcop/dest.h"
18
#include "utils/array.h"
22
* Certain options can only be set at certain times. The rules are
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.
29
* POSTMASTER options can only be set when the postmaster starts,
30
* either from the configuration file or the command line.
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.)
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.
46
* SUSET options can be set at postmaster startup, with the SIGHUP
47
* mechanism, or from SQL if you're a superuser.
49
* USERSET options can be set by anyone any time.
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.
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.
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.
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 */
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);
101
typedef const char *(*GucShowHook) (void);
103
#define GUC_QUALIFIER_SEPARATOR '.'
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;
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;
119
extern bool SQL_inheritance;
120
extern bool Australian_timezones;
122
extern bool default_with_oids;
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;
129
extern char *ConfigFileName;
130
extern char *HbaFileName;
131
extern char *IdentFileName;
132
extern char *external_pid_file;
135
extern void SetConfigOption(const char *name, const char *value,
136
GucContext context, GucSource source);
138
extern void DefineCustomBoolVariable(
140
const char *short_desc,
141
const char *long_desc,
144
GucBoolAssignHook assign_hook,
145
GucShowHook show_hook);
147
extern void DefineCustomIntVariable(
149
const char *short_desc,
150
const char *long_desc,
155
GucIntAssignHook assign_hook,
156
GucShowHook show_hook);
158
extern void DefineCustomRealVariable(
160
const char *short_desc,
161
const char *long_desc,
166
GucRealAssignHook assign_hook,
167
GucShowHook show_hook);
169
extern void DefineCustomStringVariable(
171
const char *short_desc,
172
const char *long_desc,
175
GucStringAssignHook assign_hook,
176
GucShowHook show_hook);
178
extern void EmitWarningsOnPlaceholders(const char *className);
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);
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);
202
extern char *flatten_set_variable_args(const char *name, List *args);
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);
209
extern void write_nondefault_variables(GucContext context);
210
extern void read_nondefault_variables(void);
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
219
/* in utils/adt/datetime.c */
220
extern bool ClearDateCache(bool newval, bool doit, GucSource source);
222
/* in commands/tablespace.c */
223
extern const char *assign_default_tablespace(const char *newval,
224
bool doit, GucSource source);
226
/* in utils/adt/regexp.c */
227
extern const char *assign_regex_flavor(const char *value,
228
bool doit, GucSource source);
230
/* in catalog/namespace.c */
231
extern const char *assign_search_path(const char *newval,
232
bool doit, GucSource source);
234
/* in access/transam/xlog.c */
235
extern const char *assign_xlog_sync_method(const char *method,
236
bool doit, GucSource source);