00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013 #ifndef GUC_H
00014 #define GUC_H
00015
00016 #include "nodes/parsenodes.h"
00017 #include "tcop/dest.h"
00018 #include "utils/array.h"
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051 typedef enum
00052 {
00053 PGC_INTERNAL,
00054 PGC_POSTMASTER,
00055 PGC_SIGHUP,
00056 PGC_BACKEND,
00057 PGC_SUSET,
00058 PGC_USERSET
00059 } GucContext;
00060
00061
00062
00063
00064
00065
00066
00067
00068
00069
00070
00071
00072
00073
00074
00075
00076
00077
00078
00079
00080
00081
00082
00083 typedef enum
00084 {
00085 PGC_S_DEFAULT,
00086 PGC_S_DYNAMIC_DEFAULT,
00087 PGC_S_ENV_VAR,
00088 PGC_S_FILE,
00089 PGC_S_ARGV,
00090 PGC_S_GLOBAL,
00091 PGC_S_DATABASE,
00092 PGC_S_USER,
00093 PGC_S_DATABASE_USER,
00094 PGC_S_CLIENT,
00095 PGC_S_OVERRIDE,
00096 PGC_S_INTERACTIVE,
00097 PGC_S_TEST,
00098 PGC_S_SESSION
00099 } GucSource;
00100
00101
00102
00103
00104
00105 typedef struct ConfigVariable
00106 {
00107 char *name;
00108 char *value;
00109 char *filename;
00110 int sourceline;
00111 struct ConfigVariable *next;
00112 } ConfigVariable;
00113
00114 extern bool ParseConfigFile(const char *config_file, const char *calling_file,
00115 bool strict, int depth, int elevel,
00116 ConfigVariable **head_p, ConfigVariable **tail_p);
00117 extern bool ParseConfigFp(FILE *fp, const char *config_file,
00118 int depth, int elevel,
00119 ConfigVariable **head_p, ConfigVariable **tail_p);
00120 extern bool ParseConfigDirectory(const char *includedir,
00121 const char *calling_file,
00122 int depth, int elevel,
00123 ConfigVariable **head_p,
00124 ConfigVariable **tail_p);
00125 extern void FreeConfigVariables(ConfigVariable *list);
00126
00127
00128
00129
00130
00131
00132 struct config_enum_entry
00133 {
00134 const char *name;
00135 int val;
00136 bool hidden;
00137 };
00138
00139
00140
00141
00142 typedef bool (*GucBoolCheckHook) (bool *newval, void **extra, GucSource source);
00143 typedef bool (*GucIntCheckHook) (int *newval, void **extra, GucSource source);
00144 typedef bool (*GucRealCheckHook) (double *newval, void **extra, GucSource source);
00145 typedef bool (*GucStringCheckHook) (char **newval, void **extra, GucSource source);
00146 typedef bool (*GucEnumCheckHook) (int *newval, void **extra, GucSource source);
00147
00148 typedef void (*GucBoolAssignHook) (bool newval, void *extra);
00149 typedef void (*GucIntAssignHook) (int newval, void *extra);
00150 typedef void (*GucRealAssignHook) (double newval, void *extra);
00151 typedef void (*GucStringAssignHook) (const char *newval, void *extra);
00152 typedef void (*GucEnumAssignHook) (int newval, void *extra);
00153
00154 typedef const char *(*GucShowHook) (void);
00155
00156
00157
00158
00159 typedef enum
00160 {
00161
00162 GUC_ACTION_SET,
00163 GUC_ACTION_LOCAL,
00164 GUC_ACTION_SAVE
00165 } GucAction;
00166
00167 #define GUC_QUALIFIER_SEPARATOR '.'
00168
00169
00170
00171
00172 #define GUC_LIST_INPUT 0x0001
00173 #define GUC_LIST_QUOTE 0x0002
00174 #define GUC_NO_SHOW_ALL 0x0004
00175 #define GUC_NO_RESET_ALL 0x0008
00176 #define GUC_REPORT 0x0010
00177 #define GUC_NOT_IN_SAMPLE 0x0020
00178 #define GUC_DISALLOW_IN_FILE 0x0040
00179 #define GUC_CUSTOM_PLACEHOLDER 0x0080
00180 #define GUC_SUPERUSER_ONLY 0x0100
00181 #define GUC_IS_NAME 0x0200
00182
00183 #define GUC_UNIT_KB 0x0400
00184 #define GUC_UNIT_BLOCKS 0x0800
00185 #define GUC_UNIT_XBLOCKS 0x0C00
00186 #define GUC_UNIT_MEMORY 0x0C00
00187
00188 #define GUC_UNIT_MS 0x1000
00189 #define GUC_UNIT_S 0x2000
00190 #define GUC_UNIT_MIN 0x4000
00191 #define GUC_UNIT_TIME 0x7000
00192
00193 #define GUC_NOT_WHILE_SEC_REST 0x8000
00194
00195
00196 extern bool log_duration;
00197 extern bool Debug_print_plan;
00198 extern bool Debug_print_parse;
00199 extern bool Debug_print_rewritten;
00200 extern bool Debug_pretty_print;
00201
00202 extern bool log_parser_stats;
00203 extern bool log_planner_stats;
00204 extern bool log_executor_stats;
00205 extern bool log_statement_stats;
00206 extern bool log_btree_build_stats;
00207
00208 extern PGDLLIMPORT bool check_function_bodies;
00209 extern bool default_with_oids;
00210 extern bool SQL_inheritance;
00211
00212 extern int log_min_error_statement;
00213 extern int log_min_messages;
00214 extern int client_min_messages;
00215 extern int log_min_duration_statement;
00216 extern int log_temp_files;
00217
00218 extern int temp_file_limit;
00219
00220 extern int num_temp_buffers;
00221
00222 extern char *data_directory;
00223 extern char *ConfigFileName;
00224 extern char *HbaFileName;
00225 extern char *IdentFileName;
00226 extern char *external_pid_file;
00227
00228 extern char *application_name;
00229
00230 extern int tcp_keepalives_idle;
00231 extern int tcp_keepalives_interval;
00232 extern int tcp_keepalives_count;
00233
00234
00235
00236
00237 extern void SetConfigOption(const char *name, const char *value,
00238 GucContext context, GucSource source);
00239
00240 extern void DefineCustomBoolVariable(
00241 const char *name,
00242 const char *short_desc,
00243 const char *long_desc,
00244 bool *valueAddr,
00245 bool bootValue,
00246 GucContext context,
00247 int flags,
00248 GucBoolCheckHook check_hook,
00249 GucBoolAssignHook assign_hook,
00250 GucShowHook show_hook);
00251
00252 extern void DefineCustomIntVariable(
00253 const char *name,
00254 const char *short_desc,
00255 const char *long_desc,
00256 int *valueAddr,
00257 int bootValue,
00258 int minValue,
00259 int maxValue,
00260 GucContext context,
00261 int flags,
00262 GucIntCheckHook check_hook,
00263 GucIntAssignHook assign_hook,
00264 GucShowHook show_hook);
00265
00266 extern void DefineCustomRealVariable(
00267 const char *name,
00268 const char *short_desc,
00269 const char *long_desc,
00270 double *valueAddr,
00271 double bootValue,
00272 double minValue,
00273 double maxValue,
00274 GucContext context,
00275 int flags,
00276 GucRealCheckHook check_hook,
00277 GucRealAssignHook assign_hook,
00278 GucShowHook show_hook);
00279
00280 extern void DefineCustomStringVariable(
00281 const char *name,
00282 const char *short_desc,
00283 const char *long_desc,
00284 char **valueAddr,
00285 const char *bootValue,
00286 GucContext context,
00287 int flags,
00288 GucStringCheckHook check_hook,
00289 GucStringAssignHook assign_hook,
00290 GucShowHook show_hook);
00291
00292 extern void DefineCustomEnumVariable(
00293 const char *name,
00294 const char *short_desc,
00295 const char *long_desc,
00296 int *valueAddr,
00297 int bootValue,
00298 const struct config_enum_entry * options,
00299 GucContext context,
00300 int flags,
00301 GucEnumCheckHook check_hook,
00302 GucEnumAssignHook assign_hook,
00303 GucShowHook show_hook);
00304
00305 extern void EmitWarningsOnPlaceholders(const char *className);
00306
00307 extern const char *GetConfigOption(const char *name, bool missing_ok,
00308 bool restrict_superuser);
00309 extern const char *GetConfigOptionResetString(const char *name);
00310 extern void ProcessConfigFile(GucContext context);
00311 extern void InitializeGUCOptions(void);
00312 extern bool SelectConfigFiles(const char *userDoption, const char *progname);
00313 extern void ResetAllOptions(void);
00314 extern void AtStart_GUC(void);
00315 extern int NewGUCNestLevel(void);
00316 extern void AtEOXact_GUC(bool isCommit, int nestLevel);
00317 extern void BeginReportingGUCOptions(void);
00318 extern void ParseLongOption(const char *string, char **name, char **value);
00319 extern bool parse_int(const char *value, int *result, int flags,
00320 const char **hintmsg);
00321 extern bool parse_real(const char *value, double *result);
00322 extern int set_config_option(const char *name, const char *value,
00323 GucContext context, GucSource source,
00324 GucAction action, bool changeVal, int elevel);
00325 extern char *GetConfigOptionByName(const char *name, const char **varname);
00326 extern void GetConfigOptionByNum(int varnum, const char **values, bool *noshow);
00327 extern int GetNumConfigOptions(void);
00328
00329 extern void SetPGVariable(const char *name, List *args, bool is_local);
00330 extern void GetPGVariable(const char *name, DestReceiver *dest);
00331 extern TupleDesc GetPGVariableResultDesc(const char *name);
00332
00333 extern void ExecSetVariableStmt(VariableSetStmt *stmt);
00334 extern char *ExtractSetVariableArgs(VariableSetStmt *stmt);
00335
00336 extern void ProcessGUCArray(ArrayType *array,
00337 GucContext context, GucSource source, GucAction action);
00338 extern ArrayType *GUCArrayAdd(ArrayType *array, const char *name, const char *value);
00339 extern ArrayType *GUCArrayDelete(ArrayType *array, const char *name);
00340 extern ArrayType *GUCArrayReset(ArrayType *array);
00341
00342 #ifdef EXEC_BACKEND
00343 extern void write_nondefault_variables(GucContext context);
00344 extern void read_nondefault_variables(void);
00345 #endif
00346
00347
00348
00349 extern PGDLLIMPORT char *GUC_check_errmsg_string;
00350 extern PGDLLIMPORT char *GUC_check_errdetail_string;
00351 extern PGDLLIMPORT char *GUC_check_errhint_string;
00352
00353 extern void GUC_check_errcode(int sqlerrcode);
00354
00355 #define GUC_check_errmsg \
00356 pre_format_elog_string(errno, TEXTDOMAIN), \
00357 GUC_check_errmsg_string = format_elog_string
00358
00359 #define GUC_check_errdetail \
00360 pre_format_elog_string(errno, TEXTDOMAIN), \
00361 GUC_check_errdetail_string = format_elog_string
00362
00363 #define GUC_check_errhint \
00364 pre_format_elog_string(errno, TEXTDOMAIN), \
00365 GUC_check_errhint_string = format_elog_string
00366
00367
00368
00369
00370
00371
00372
00373
00374
00375 extern bool check_default_tablespace(char **newval, void **extra, GucSource source);
00376 extern bool check_temp_tablespaces(char **newval, void **extra, GucSource source);
00377 extern void assign_temp_tablespaces(const char *newval, void *extra);
00378
00379
00380 extern bool check_search_path(char **newval, void **extra, GucSource source);
00381 extern void assign_search_path(const char *newval, void *extra);
00382
00383
00384 extern bool check_wal_buffers(int *newval, void **extra, GucSource source);
00385 extern void assign_xlog_sync_method(int new_sync_method, void *extra);
00386
00387 #endif