Eneboo - Documentación para desarrolladores
src/libpq/include/utils/guc.h
Ir a la documentación de este archivo.
00001 /*--------------------------------------------------------------------
00002  * guc.h
00003  *
00004  * External declarations pertaining to backend/utils/misc/guc.c and
00005  * backend/utils/misc/guc-file.l
00006  *
00007  * Copyright (c) 2000-2005, PostgreSQL Global Development Group
00008  * Written by Peter Eisentraut <peter_e@gmx.net>.
00009  *
00010  * $PostgreSQL: pgsql/src/include/utils/guc.h,v 1.63.2.1 2006/05/21 20:11:02 tgl Exp $
00011  *--------------------------------------------------------------------
00012  */
00013 #ifndef GUC_H
00014 #define GUC_H
00015 
00016 #include "nodes/pg_list.h"
00017 #include "tcop/dest.h"
00018 #include "utils/array.h"
00019 
00020 
00021 /*
00022  * Certain options can only be set at certain times. The rules are
00023  * like this:
00024  *
00025  * INTERNAL options cannot be set by the user at all, but only through
00026  * internal processes ("server_version" is an example).  These are GUC
00027  * variables only so they can be shown by SHOW, etc.
00028  *
00029  * POSTMASTER options can only be set when the postmaster starts,
00030  * either from the configuration file or the command line.
00031  *
00032  * SIGHUP options can only be set at postmaster startup or by changing
00033  * the configuration file and sending the HUP signal to the postmaster
00034  * or a backend process. (Notice that the signal receipt will not be
00035  * evaluated immediately. The postmaster and the backend check it at a
00036  * certain point in their main loop. It's safer to wait than to read a
00037  * file asynchronously.)
00038  *
00039  * BACKEND options can only be set at postmaster startup, from the
00040  * configuration file, or by client request in the connection startup
00041  * packet (e.g., from libpq's PGOPTIONS variable).  Furthermore, an
00042  * already-started backend will ignore changes to such an option in the
00043  * configuration file.  The idea is that these options are fixed for a
00044  * given backend once it's started, but they can vary across backends.
00045  *
00046  * SUSET options can be set at postmaster startup, with the SIGHUP
00047  * mechanism, or from SQL if you're a superuser.
00048  *
00049  * USERSET options can be set by anyone any time.
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  * The following type records the source of the current setting.  A
00063  * new setting can only take effect if the previous setting had the
00064  * same or lower level.  (E.g, changing the config file doesn't
00065  * override the postmaster command line.)  Tracking the source allows us
00066  * to process sources in any convenient order without affecting results.
00067  * Sources <= PGC_S_OVERRIDE will set the default used by RESET, as well
00068  * as the current value.  Note that source == PGC_S_OVERRIDE should be
00069  * used when setting a PGC_INTERNAL option.
00070  *
00071  * PGC_S_INTERACTIVE isn't actually a source value, but is the
00072  * dividing line between "interactive" and "non-interactive" sources for
00073  * error reporting purposes.
00074  *
00075  * PGC_S_TEST is used when testing values to be stored as per-database or
00076  * per-user defaults ("doit" will always be false, so this never gets stored
00077  * as the actual source of any value).  This is an interactive case, but
00078  * it needs its own source value because some assign hooks need to make
00079  * different validity checks in this case.
00080  */
00081 typedef enum
00082 {
00083         PGC_S_DEFAULT,                          /* wired-in default */
00084         PGC_S_ENV_VAR,                          /* postmaster environment variable */
00085         PGC_S_FILE,                                     /* postgresql.conf */
00086         PGC_S_ARGV,                                     /* postmaster command line */
00087         PGC_S_DATABASE,                         /* per-database setting */
00088         PGC_S_USER,                                     /* per-user setting */
00089         PGC_S_CLIENT,                           /* from client connection request */
00090         PGC_S_OVERRIDE,                         /* special case to forcibly set default */
00091         PGC_S_INTERACTIVE,                      /* dividing line for error reporting */
00092         PGC_S_TEST,                                     /* test per-database or per-user setting */
00093         PGC_S_SESSION                           /* SET command */
00094 } GucSource;
00095 
00096 typedef const char *(*GucStringAssignHook) (const char *newval, bool doit, GucSource source);
00097 typedef bool (*GucBoolAssignHook) (bool newval, bool doit, GucSource source);
00098 typedef bool (*GucIntAssignHook) (int newval, bool doit, GucSource source);
00099 typedef bool (*GucRealAssignHook) (double newval, bool doit, GucSource source);
00100 
00101 typedef const char *(*GucShowHook) (void);
00102 
00103 #define GUC_QUALIFIER_SEPARATOR '.'
00104 
00105 /* GUC vars that are actually declared in guc.c, rather than elsewhere */
00106 extern bool log_duration;
00107 extern bool Debug_print_plan;
00108 extern bool Debug_print_parse;
00109 extern bool Debug_print_rewritten;
00110 extern bool Debug_pretty_print;
00111 extern bool Explain_pretty_print;
00112 
00113 extern bool log_parser_stats;
00114 extern bool log_planner_stats;
00115 extern bool log_executor_stats;
00116 extern bool log_statement_stats;
00117 extern bool log_btree_build_stats;
00118 
00119 extern bool SQL_inheritance;
00120 extern bool Australian_timezones;
00121 
00122 extern bool default_with_oids;
00123 
00124 extern int      log_min_error_statement;
00125 extern int      log_min_messages;
00126 extern int      client_min_messages;
00127 extern int      log_min_duration_statement;
00128 
00129 extern int      num_temp_buffers;
00130 
00131 extern char *ConfigFileName;
00132 extern char *HbaFileName;
00133 extern char *IdentFileName;
00134 extern char *external_pid_file;
00135 
00136 extern int      tcp_keepalives_idle;
00137 extern int      tcp_keepalives_interval;
00138 extern int      tcp_keepalives_count;
00139 
00140 extern void SetConfigOption(const char *name, const char *value,
00141                                 GucContext context, GucSource source);
00142 
00143 extern void DefineCustomBoolVariable(
00144                                                  const char *name,
00145                                                  const char *short_desc,
00146                                                  const char *long_desc,
00147                                                  bool *valueAddr,
00148                                                  GucContext context,
00149                                                  GucBoolAssignHook assign_hook,
00150                                                  GucShowHook show_hook);
00151 
00152 extern void DefineCustomIntVariable(
00153                                                 const char *name,
00154                                                 const char *short_desc,
00155                                                 const char *long_desc,
00156                                                 int *valueAddr,
00157                                                 int minValue,
00158                                                 int maxValue,
00159                                                 GucContext context,
00160                                                 GucIntAssignHook assign_hook,
00161                                                 GucShowHook show_hook);
00162 
00163 extern void DefineCustomRealVariable(
00164                                                  const char *name,
00165                                                  const char *short_desc,
00166                                                  const char *long_desc,
00167                                                  double *valueAddr,
00168                                                  double minValue,
00169                                                  double maxValue,
00170                                                  GucContext context,
00171                                                  GucRealAssignHook assign_hook,
00172                                                  GucShowHook show_hook);
00173 
00174 extern void DefineCustomStringVariable(
00175                                                    const char *name,
00176                                                    const char *short_desc,
00177                                                    const char *long_desc,
00178                                                    char **valueAddr,
00179                                                    GucContext context,
00180                                                    GucStringAssignHook assign_hook,
00181                                                    GucShowHook show_hook);
00182 
00183 extern void EmitWarningsOnPlaceholders(const char *className);
00184 
00185 extern const char *GetConfigOption(const char *name);
00186 extern const char *GetConfigOptionResetString(const char *name);
00187 extern bool IsSuperuserConfigOption(const char *name);
00188 extern void ProcessConfigFile(GucContext context);
00189 extern void InitializeGUCOptions(void);
00190 extern bool SelectConfigFiles(const char *userDoption, const char *progname);
00191 extern void ResetAllOptions(void);
00192 extern void AtEOXact_GUC(bool isCommit, bool isSubXact);
00193 extern void BeginReportingGUCOptions(void);
00194 extern void ParseLongOption(const char *string, char **name, char **value);
00195 extern bool set_config_option(const char *name, const char *value,
00196                                   GucContext context, GucSource source,
00197                                   bool isLocal, bool changeVal);
00198 extern char *GetConfigOptionByName(const char *name, const char **varname);
00199 extern void GetConfigOptionByNum(int varnum, const char **values, bool *noshow);
00200 extern int      GetNumConfigOptions(void);
00201 
00202 extern void SetPGVariable(const char *name, List *args, bool is_local);
00203 extern void GetPGVariable(const char *name, DestReceiver *dest);
00204 extern TupleDesc GetPGVariableResultDesc(const char *name);
00205 extern void ResetPGVariable(const char *name);
00206 
00207 extern char *flatten_set_variable_args(const char *name, List *args);
00208 
00209 extern void ProcessGUCArray(ArrayType *array, GucSource source);
00210 extern ArrayType *GUCArrayAdd(ArrayType *array, const char *name, const char *value);
00211 extern ArrayType *GUCArrayDelete(ArrayType *array, const char *name);
00212 
00213 #ifdef EXEC_BACKEND
00214 extern void write_nondefault_variables(GucContext context);
00215 extern void read_nondefault_variables(void);
00216 #endif
00217 
00218 /*
00219  * The following functions are not in guc.c, but are declared here to avoid
00220  * having to include guc.h in some widely used headers that it really doesn't
00221  * belong in.
00222  */
00223 
00224 /* in utils/adt/datetime.c */
00225 extern bool ClearDateCache(bool newval, bool doit, GucSource source);
00226 
00227 /* in commands/tablespace.c */
00228 extern const char *assign_default_tablespace(const char *newval,
00229                                                   bool doit, GucSource source);
00230 
00231 /* in utils/adt/regexp.c */
00232 extern const char *assign_regex_flavor(const char *value,
00233                                         bool doit, GucSource source);
00234 
00235 /* in catalog/namespace.c */
00236 extern const char *assign_search_path(const char *newval,
00237                                    bool doit, GucSource source);
00238 
00239 /* in access/transam/xlog.c */
00240 extern const char *assign_xlog_sync_method(const char *method,
00241                                                 bool doit, GucSource source);
00242 
00243 #endif   /* GUC_H */
 Todo Clases Namespaces Archivos Funciones Variables 'typedefs' Enumeraciones Valores de enumeraciones Propiedades Amigas 'defines'