⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 guc.c

📁 PostgreSQL 8.1.4的源码 适用于Linux下的开源数据库系统
💻 C
📖 第 1 页 / 共 5 页
字号:
/*-------------------------------------------------------------------- * guc.c * * Support for grand unified configuration scheme, including SET * command, configuration file, and command line options. * See src/backend/utils/misc/README for more information. * * * Copyright (c) 2000-2005, PostgreSQL Global Development Group * Written by Peter Eisentraut <peter_e@gmx.net>. * * IDENTIFICATION *	  $PostgreSQL: pgsql/src/backend/utils/misc/guc.c,v 1.299.2.3 2006/05/21 20:11:02 tgl Exp $ * *-------------------------------------------------------------------- */#include "postgres.h"#include <ctype.h>#include <float.h>#include <limits.h>#include <unistd.h>#include <sys/stat.h>#ifdef HAVE_SYSLOG#include <syslog.h>#endif#include "utils/guc.h"#include "utils/guc_tables.h"#include "access/twophase.h"#include "catalog/namespace.h"#include "catalog/pg_type.h"#include "commands/async.h"#include "commands/variable.h"#include "commands/vacuum.h"#include "executor/executor.h"#include "fmgr.h"#include "funcapi.h"#include "libpq/auth.h"#include "libpq/pqcomm.h"#include "libpq/pqformat.h"#include "mb/pg_wchar.h"#include "miscadmin.h"#include "optimizer/cost.h"#include "optimizer/geqo.h"#include "optimizer/paths.h"#include "optimizer/prep.h"#include "parser/gramparse.h"#include "parser/parse_expr.h"#include "parser/parse_relation.h"#include "parser/scansup.h"#include "postmaster/autovacuum.h"#include "postmaster/bgwriter.h"#include "postmaster/syslogger.h"#include "postmaster/postmaster.h"#include "storage/bufmgr.h"#include "storage/fd.h"#include "storage/freespace.h"#include "storage/lock.h"#include "storage/proc.h"#include "tcop/tcopprot.h"#include "utils/array.h"#include "utils/builtins.h"#include "utils/memutils.h"#include "utils/pg_locale.h"#include "pgstat.h"#ifndef PG_KRB_SRVTAB#define PG_KRB_SRVTAB ""#endif#ifndef PG_KRB_SRVNAM#define PG_KRB_SRVNAM ""#endif#define CONFIG_FILENAME "postgresql.conf"#define HBA_FILENAME	"pg_hba.conf"#define IDENT_FILENAME	"pg_ident.conf"#ifdef EXEC_BACKEND#define CONFIG_EXEC_PARAMS "global/config_exec_params"#define CONFIG_EXEC_PARAMS_NEW "global/config_exec_params.new"#endif/* upper limit for GUC variables measured in kilobytes of memory */#if SIZEOF_SIZE_T > 4#define MAX_KILOBYTES	INT_MAX#else#define MAX_KILOBYTES	(INT_MAX / 1024)#endif/* XXX these should appear in other modules' header files */extern bool Log_disconnections;extern DLLIMPORT bool check_function_bodies;extern int	CommitDelay;extern int	CommitSiblings;extern char *default_tablespace;extern bool fullPageWrites;#ifdef TRACE_SORTextern bool trace_sort;#endifstatic const char *assign_log_destination(const char *value,					   bool doit, GucSource source);#ifdef HAVE_SYSLOGstatic int	syslog_facility = LOG_LOCAL0;static const char *assign_syslog_facility(const char *facility,					   bool doit, GucSource source);static const char *assign_syslog_ident(const char *ident,					bool doit, GucSource source);#endifstatic const char *assign_defaultxactisolevel(const char *newval, bool doit,						   GucSource source);static const char *assign_log_min_messages(const char *newval, bool doit,						GucSource source);static const char *assign_client_min_messages(const char *newval,						   bool doit, GucSource source);static const char *assign_min_error_statement(const char *newval, bool doit,						   GucSource source);static const char *assign_msglvl(int *var, const char *newval, bool doit,			  GucSource source);static const char *assign_log_error_verbosity(const char *newval, bool doit,						   GucSource source);static const char *assign_log_statement(const char *newval, bool doit,					 GucSource source);static const char *show_num_temp_buffers(void);static bool assign_phony_autocommit(bool newval, bool doit, GucSource source);static const char *assign_custom_variable_classes(const char *newval, bool doit,							   GucSource source);static bool assign_stage_log_stats(bool newval, bool doit, GucSource source);static bool assign_log_stats(bool newval, bool doit, GucSource source);static bool assign_transaction_read_only(bool newval, bool doit, GucSource source);static const char *assign_canonical_path(const char *newval, bool doit, GucSource source);static const char *assign_backslash_quote(const char *newval, bool doit, GucSource source);static bool assign_tcp_keepalives_idle(int newval, bool doit, GucSource source);static bool assign_tcp_keepalives_interval(int newval, bool doit, GucSource source);static bool assign_tcp_keepalives_count(int newval, bool doit, GucSource source);static const char *show_tcp_keepalives_idle(void);static const char *show_tcp_keepalives_interval(void);static const char *show_tcp_keepalives_count(void);/* * GUC option variables that are exported from this module */#ifdef USE_ASSERT_CHECKINGbool		assert_enabled = true;#endifbool		log_duration = false;bool		Debug_print_plan = false;bool		Debug_print_parse = false;bool		Debug_print_rewritten = false;bool		Debug_pretty_print = false;bool		Explain_pretty_print = true;bool		log_parser_stats = false;bool		log_planner_stats = false;bool		log_executor_stats = false;bool		log_statement_stats = false;		/* this is sort of all three												 * above together */bool		log_btree_build_stats = false;bool		SQL_inheritance = true;bool		Australian_timezones = false;bool		Password_encryption = true;bool		default_with_oids = false;int			log_min_error_statement = PANIC;int			log_min_messages = NOTICE;int			client_min_messages = NOTICE;int			log_min_duration_statement = -1;int			num_temp_buffers = 1000;char	   *ConfigFileName;char	   *HbaFileName;char	   *IdentFileName;char	   *external_pid_file;int			tcp_keepalives_idle;int			tcp_keepalives_interval;int			tcp_keepalives_count;/* * These variables are all dummies that don't do anything, except in some * cases provide the value for SHOW to display.  The real state is elsewhere * and is kept in sync by assign_hooks. */static char *client_min_messages_str;static char *log_min_messages_str;static char *log_error_verbosity_str;static char *log_statement_str;static char *log_min_error_statement_str;static char *log_destination_string;static char *syslog_facility_str;static char *syslog_ident_str;static bool phony_autocommit;static bool session_auth_is_superuser;static double phony_random_seed;static char *backslash_quote_string;static char *client_encoding_string;static char *datestyle_string;static char *default_iso_level_string;static char *locale_collate;static char *locale_ctype;static char *regex_flavor_string;static char *server_encoding_string;static char *server_version_string;static char *timezone_string;static char *XactIsoLevel_string;static char *data_directory;static char *custom_variable_classes;static int	max_function_args;static int	max_index_keys;static int	max_identifier_length;static int	block_size;static bool integer_datetimes;static bool standard_conforming_strings;/* should be static, but commands/variable.c needs to get at these */char	   *role_string;char	   *session_authorization_string;/* * Displayable names for context types (enum GucContext) * * Note: these strings are deliberately not localized. */const char *const GucContext_Names[] ={	 /* PGC_INTERNAL */ "internal",	 /* PGC_POSTMASTER */ "postmaster",	 /* PGC_SIGHUP */ "sighup",	 /* PGC_BACKEND */ "backend",	 /* PGC_SUSET */ "superuser",	 /* PGC_USERSET */ "user"};/* * Displayable names for source types (enum GucSource) * * Note: these strings are deliberately not localized. */const char *const GucSource_Names[] ={	 /* PGC_S_DEFAULT */ "default",	 /* PGC_S_ENV_VAR */ "environment variable",	 /* PGC_S_FILE */ "configuration file",	 /* PGC_S_ARGV */ "command line",	 /* PGC_S_DATABASE */ "database",	 /* PGC_S_USER */ "user",	 /* PGC_S_CLIENT */ "client",	 /* PGC_S_OVERRIDE */ "override",	 /* PGC_S_INTERACTIVE */ "interactive",	 /* PGC_S_TEST */ "test",	 /* PGC_S_SESSION */ "session"};/* * Displayable names for the groupings defined in enum config_group */const char *const config_group_names[] ={	/* UNGROUPED */	gettext_noop("Ungrouped"),	/* FILE_LOCATIONS */	gettext_noop("File Locations"),	/* CONN_AUTH */	gettext_noop("Connections and Authentication"),	/* CONN_AUTH_SETTINGS */	gettext_noop("Connections and Authentication / Connection Settings"),	/* CONN_AUTH_SECURITY */	gettext_noop("Connections and Authentication / Security and Authentication"),	/* RESOURCES */	gettext_noop("Resource Usage"),	/* RESOURCES_MEM */	gettext_noop("Resource Usage / Memory"),	/* RESOURCES_FSM */	gettext_noop("Resource Usage / Free Space Map"),	/* RESOURCES_KERNEL */	gettext_noop("Resource Usage / Kernel Resources"),	/* WAL */	gettext_noop("Write-Ahead Log"),	/* WAL_SETTINGS */	gettext_noop("Write-Ahead Log / Settings"),	/* WAL_CHECKPOINTS */	gettext_noop("Write-Ahead Log / Checkpoints"),	/* QUERY_TUNING */	gettext_noop("Query Tuning"),	/* QUERY_TUNING_METHOD */	gettext_noop("Query Tuning / Planner Method Configuration"),	/* QUERY_TUNING_COST */	gettext_noop("Query Tuning / Planner Cost Constants"),	/* QUERY_TUNING_GEQO */	gettext_noop("Query Tuning / Genetic Query Optimizer"),	/* QUERY_TUNING_OTHER */	gettext_noop("Query Tuning / Other Planner Options"),	/* LOGGING */	gettext_noop("Reporting and Logging"),	/* LOGGING_WHERE */	gettext_noop("Reporting and Logging / Where to Log"),	/* LOGGING_WHEN */	gettext_noop("Reporting and Logging / When to Log"),	/* LOGGING_WHAT */	gettext_noop("Reporting and Logging / What to Log"),	/* STATS */	gettext_noop("Statistics"),	/* STATS_MONITORING */	gettext_noop("Statistics / Monitoring"),	/* STATS_COLLECTOR */	gettext_noop("Statistics / Query and Index Statistics Collector"),	/* AUTOVACUUM */	gettext_noop("Auto Vacuum"),	/* CLIENT_CONN */	gettext_noop("Client Connection Defaults"),	/* CLIENT_CONN_STATEMENT */	gettext_noop("Client Connection Defaults / Statement Behavior"),	/* CLIENT_CONN_LOCALE */	gettext_noop("Client Connection Defaults / Locale and Formatting"),	/* CLIENT_CONN_OTHER */	gettext_noop("Client Connection Defaults / Other Defaults"),	/* LOCK_MANAGEMENT */	gettext_noop("Lock Management"),	/* COMPAT_OPTIONS */	gettext_noop("Version and Platform Compatibility"),	/* COMPAT_OPTIONS_PREVIOUS */	gettext_noop("Version and Platform Compatibility / Previous PostgreSQL Versions"),	/* COMPAT_OPTIONS_CLIENT */	gettext_noop("Version and Platform Compatibility / Other Platforms and Clients"),	/* PRESET_OPTIONS */	gettext_noop("Preset Options"),	/* CUSTOM_OPTIONS */	gettext_noop("Customized Options"),	/* DEVELOPER_OPTIONS */	gettext_noop("Developer Options"),	/* help_config wants this array to be null-terminated */	NULL};/* * Displayable names for GUC variable types (enum config_type) * * Note: these strings are deliberately not localized. */const char *const config_type_names[] ={	 /* PGC_BOOL */ "bool",	 /* PGC_INT */ "integer",	 /* PGC_REAL */ "real",	 /* PGC_STRING */ "string"};/* * Contents of GUC tables * * See src/backend/utils/misc/README for design notes. * * TO ADD AN OPTION: * * 1. Declare a global variable of type bool, int, double, or char* *	  and make use of it. * * 2. Decide at what times it's safe to set the option. See guc.h for *	  details. * * 3. Decide on a name, a default value, upper and lower bounds (if *	  applicable), etc. * * 4. Add a record below. * * 5. Add it to src/backend/utils/misc/postgresql.conf.sample, if *	  appropriate * * 6. Add it to src/bin/psql/tab-complete.c, if it's a USERSET option. * * 7. Don't forget to document the option. * * 8. If it's a new GUC_LIST option you must edit pg_dumpall.c to ensure *	  it is not single quoted at dump time. *//******** option records follow ********/static struct config_bool ConfigureNamesBool[] ={	{		{"enable_seqscan", PGC_USERSET, QUERY_TUNING_METHOD,			gettext_noop("Enables the planner's use of sequential-scan plans."),			NULL		},		&enable_seqscan,		true, NULL, NULL	},	{		{"enable_indexscan", PGC_USERSET, QUERY_TUNING_METHOD,			gettext_noop("Enables the planner's use of index-scan plans."),			NULL		},		&enable_indexscan,		true, NULL, NULL	},	{		{"enable_bitmapscan", PGC_USERSET, QUERY_TUNING_METHOD,			gettext_noop("Enables the planner's use of bitmap-scan plans."),			NULL		},		&enable_bitmapscan,		true, NULL, NULL	},	{		{"enable_tidscan", PGC_USERSET, QUERY_TUNING_METHOD,			gettext_noop("Enables the planner's use of TID scan plans."),			NULL		},		&enable_tidscan,		true, NULL, NULL	},	{		{"enable_sort", PGC_USERSET, QUERY_TUNING_METHOD,			gettext_noop("Enables the planner's use of explicit sort steps."),			NULL		},		&enable_sort,		true, NULL, NULL	},	{		{"enable_hashagg", PGC_USERSET, QUERY_TUNING_METHOD,			gettext_noop("Enables the planner's use of hashed aggregation plans."),			NULL		},		&enable_hashagg,		true, NULL, NULL	},	{		{"enable_nestloop", PGC_USERSET, QUERY_TUNING_METHOD,			gettext_noop("Enables the planner's use of nested-loop join plans."),			NULL		},		&enable_nestloop,		true, NULL, NULL	},	{		{"enable_mergejoin", PGC_USERSET, QUERY_TUNING_METHOD,			gettext_noop("Enables the planner's use of merge join plans."),			NULL		},		&enable_mergejoin,		true, NULL, NULL	},	{		{"enable_hashjoin", PGC_USERSET, QUERY_TUNING_METHOD,			gettext_noop("Enables the planner's use of hash join plans."),			NULL		},		&enable_hashjoin,		true, NULL, NULL	},	{		{"constraint_exclusion", PGC_USERSET, QUERY_TUNING_OTHER,			gettext_noop("Enables the planner to use constraints to optimize queries."),			gettext_noop("Child table scans will be skipped if their "					   "constraints guarantee that no rows match the query.")		},		&constraint_exclusion,		false, NULL, NULL	},	{		{"geqo", PGC_USERSET, QUERY_TUNING_GEQO,			gettext_noop("Enables genetic query optimization."),			gettext_noop("This algorithm attempts to do planning without "						 "exhaustive searching.")		},		&enable_geqo,		true, NULL, NULL	},	{		/* Not for general use --- used by SET SESSION AUTHORIZATION */

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -