guc.h 28.3 KB
Newer Older
1
/*--------------------------------------------------------------------
2 3 4 5 6
 * guc.h
 *
 * External declarations pertaining to backend/utils/misc/guc.c and
 * backend/utils/misc/guc-file.l
 *
7
 * Portions Copyright (c) 2007-2010, Greenplum inc
8
 * Portions Copyright (c) 2012-Present Pivotal Software, Inc.
B
Bruce Momjian 已提交
9
 * Copyright (c) 2000-2014, PostgreSQL Global Development Group
10 11
 * Written by Peter Eisentraut <peter_e@gmx.net>.
 *
12
 * src/include/utils/guc.h
13
 *--------------------------------------------------------------------
14 15 16 17
 */
#ifndef GUC_H
#define GUC_H

18
#include "nodes/parsenodes.h"
19
#include "tcop/dest.h"
20 21
#include "utils/array.h"

22 23
#define MAX_AUTHENTICATION_TIMEOUT (600)
#define MAX_PRE_AUTH_DELAY (60)
24 25 26 27 28
/*
 * One connection must be reserved for FTS to always able to probe
 * primary. So, this acts as lower limit on reserved superuser connections.
*/
#define RESERVED_FTS_CONNECTIONS (1)
29 30 31

struct StringInfoData;                  /* #include "lib/stringinfo.h" */

32

33 34 35 36 37 38 39
/*
 * Automatic configuration file name for ALTER SYSTEM.
 * This file will be used to store values of configuration parameters
 * set by ALTER SYSTEM command.
 */
#define PG_AUTOCONF_FILENAME		"postgresql.auto.conf"

40
/*
41 42 43
 * Certain options can only be set at certain times. The rules are
 * like this:
 *
44 45 46 47
 * INTERNAL options cannot be set by the user at all, but only through
 * internal processes ("server_version" is an example).  These are GUC
 * variables only so they can be shown by SHOW, etc.
 *
48 49 50 51 52
 * POSTMASTER options can only be set when the postmaster starts,
 * either from the configuration file or the command line.
 *
 * SIGHUP options can only be set at postmaster startup or by changing
 * the configuration file and sending the HUP signal to the postmaster
53 54 55 56
 * or a backend process. (Notice that the signal receipt will not be
 * evaluated immediately. The postmaster and the backend check it at a
 * certain point in their main loop. It's safer to wait than to read a
 * file asynchronously.)
57
 *
58
 * BACKEND options can only be set at postmaster startup, from the
59 60 61
 * configuration file, or by client request in the connection startup
 * packet (e.g., from libpq's PGOPTIONS variable).  Furthermore, an
 * already-started backend will ignore changes to such an option in the
B
Bruce Momjian 已提交
62
 * configuration file.  The idea is that these options are fixed for a
63
 * given backend once it's started, but they can vary across backends.
64 65
 *
 * SUSET options can be set at postmaster startup, with the SIGHUP
66
 * mechanism, or from SQL if you're a superuser.
67 68
 *
 * USERSET options can be set by anyone any time.
69
 */
B
Bruce Momjian 已提交
70 71
typedef enum
{
72 73 74 75 76 77
	PGC_INTERNAL,
	PGC_POSTMASTER,
	PGC_SIGHUP,
	PGC_BACKEND,
	PGC_SUSET,
	PGC_USERSET
78 79
} GucContext;

80 81 82 83
/*
 * The following type records the source of the current setting.  A
 * new setting can only take effect if the previous setting had the
 * same or lower level.  (E.g, changing the config file doesn't
84 85 86
 * override the postmaster command line.)  Tracking the source allows us
 * to process sources in any convenient order without affecting results.
 * Sources <= PGC_S_OVERRIDE will set the default used by RESET, as well
87 88
 * as the current value.  Note that source == PGC_S_OVERRIDE should be
 * used when setting a PGC_INTERNAL option.
89
 *
90
 * PGC_S_INTERACTIVE isn't actually a source value, but is the
91 92 93
 * dividing line between "interactive" and "non-interactive" sources for
 * error reporting purposes.
 *
94 95 96 97 98 99 100 101 102
 * PGC_S_TEST is used when testing values to be used later ("doit" will always
 * be false, so this never gets stored as the actual source of any value).
 * For example, ALTER DATABASE/ROLE tests proposed per-database or per-user
 * defaults this way, and CREATE FUNCTION tests proposed function SET clauses
 * this way.  This is an interactive case, but it needs its own source value
 * because some assign hooks need to make different validity checks in this
 * case.  In particular, references to nonexistent database objects generally
 * shouldn't throw hard errors in this case, at most NOTICEs, since the
 * objects might exist by the time the setting is used for real.
103 104
 *
 * NB: see GucSource_Names in guc.c if you change this.
105 106 107
 */
typedef enum
{
108 109
	PGC_S_DEFAULT,				/* hard-wired default ("boot_val") */
	PGC_S_DYNAMIC_DEFAULT,		/* default computed during initialization */
110 111 112
	PGC_S_ENV_VAR,				/* postmaster environment variable */
	PGC_S_FILE,					/* postgresql.conf */
	PGC_S_ARGV,					/* postmaster command line */
113
	PGC_S_GLOBAL,				/* global in-database setting */
114 115
	PGC_S_DATABASE,				/* per-database setting */
	PGC_S_USER,					/* per-user setting */
116
	PGC_S_DATABASE_USER,		/* per-user-and-database setting */
117
	PGC_S_CLIENT,				/* from client connection request */
118
	PGC_S_RESGROUP,				/* per-resgroup setting */
119
	PGC_S_OVERRIDE,				/* special case to forcibly set default */
120 121
	PGC_S_INTERACTIVE,			/* dividing line for error reporting */
	PGC_S_TEST,					/* test per-database or per-user setting */
122
	PGC_S_SESSION				/* SET command */
123
} GucSource;
124

125
/*
126
 * Parsing the configuration file(s) will return a list of name-value pairs
127
 * with source location info.
128 129 130
 *
 * If "ignore" is true, don't attempt to apply the item (it might be an item
 * we determined to be duplicate, for instance).
131
 */
132
typedef struct ConfigVariable
133
{
134 135
	char	   *name;
	char	   *value;
136 137
	char	   *filename;
	int			sourceline;
138
	struct ConfigVariable *next;
139
	bool		ignore;
140
} ConfigVariable;
141 142

extern bool ParseConfigFile(const char *config_file, const char *calling_file,
143
				bool strict, int depth, int elevel,
144 145 146 147
				ConfigVariable **head_p, ConfigVariable **tail_p);
extern bool ParseConfigFp(FILE *fp, const char *config_file,
			  int depth, int elevel,
			  ConfigVariable **head_p, ConfigVariable **tail_p);
148 149 150 151 152
extern bool ParseConfigDirectory(const char *includedir,
					 const char *calling_file,
					 int depth, int elevel,
					 ConfigVariable **head_p,
					 ConfigVariable **tail_p);
153 154 155
extern void FreeConfigVariables(ConfigVariable *list);

/*
156 157 158
 * The possible values of an enum variable are specified by an array of
 * name-value pairs.  The "hidden" flag means the value is accepted but
 * won't be displayed when guc.c is asked for a list of acceptable values.
159 160 161 162 163 164 165
 */
struct config_enum_entry
{
	const char *name;
	int			val;
	bool		hidden;
};
166

167 168 169 170 171 172 173 174 175 176 177 178 179 180
/*
 * Signatures for per-variable check/assign/show hook functions
 */
typedef bool (*GucBoolCheckHook) (bool *newval, void **extra, GucSource source);
typedef bool (*GucIntCheckHook) (int *newval, void **extra, GucSource source);
typedef bool (*GucRealCheckHook) (double *newval, void **extra, GucSource source);
typedef bool (*GucStringCheckHook) (char **newval, void **extra, GucSource source);
typedef bool (*GucEnumCheckHook) (int *newval, void **extra, GucSource source);

typedef void (*GucBoolAssignHook) (bool newval, void *extra);
typedef void (*GucIntAssignHook) (int newval, void *extra);
typedef void (*GucRealAssignHook) (double newval, void *extra);
typedef void (*GucStringAssignHook) (const char *newval, void *extra);
typedef void (*GucEnumAssignHook) (int newval, void *extra);
181

B
Bruce Momjian 已提交
182
typedef const char *(*GucShowHook) (void);
183

184 185 186
/*
 * Miscellaneous
 */
187 188 189 190 191
typedef enum
{
	/* Types of set_config_option actions */
	GUC_ACTION_SET,				/* regular SET command */
	GUC_ACTION_LOCAL,			/* SET LOCAL command */
192
	GUC_ACTION_SAVE				/* function SET option, or temp assignment */
193
} GucAction;
194

195 196
#define GUC_QUALIFIER_SEPARATOR '.'

197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220
/*
 * bit values in "flags" of a GUC variable
 */
#define GUC_LIST_INPUT			0x0001	/* input can be list format */
#define GUC_LIST_QUOTE			0x0002	/* double-quote list elements */
#define GUC_NO_SHOW_ALL			0x0004	/* exclude from SHOW ALL */
#define GUC_NO_RESET_ALL		0x0008	/* exclude from RESET ALL */
#define GUC_REPORT				0x0010	/* auto-report changes to client */
#define GUC_NOT_IN_SAMPLE		0x0020	/* not in postgresql.conf.sample */
#define GUC_DISALLOW_IN_FILE	0x0040	/* can't set in postgresql.conf */
#define GUC_CUSTOM_PLACEHOLDER	0x0080	/* placeholder for custom variable */
#define GUC_SUPERUSER_ONLY		0x0100	/* show only to superusers */
#define GUC_IS_NAME				0x0200	/* limit string to NAMEDATALEN-1 */

#define GUC_UNIT_KB				0x0400	/* value is in kilobytes */
#define GUC_UNIT_BLOCKS			0x0800	/* value is in blocks */
#define GUC_UNIT_XBLOCKS		0x0C00	/* value is in xlog blocks */
#define GUC_UNIT_MEMORY			0x0C00	/* mask for KB, BLOCKS, XBLOCKS */

#define GUC_UNIT_MS				0x1000	/* value is in milliseconds */
#define GUC_UNIT_S				0x2000	/* value is in seconds */
#define GUC_UNIT_MIN			0x4000	/* value is in minutes */
#define GUC_UNIT_TIME			0x7000	/* mask for MS, S, MIN */

221
#define GUC_NOT_WHILE_SEC_REST	0x8000	/* can't set if security restricted */
222
#define GUC_DISALLOW_IN_AUTO_FILE	0x00010000	/* can't set in PG_AUTOCONF_FILENAME */
223

224 225 226
/* GPDB speific */
#define GUC_GPDB_ADDOPT        0x00020000  /* Send by cdbgang */
#define GUC_DISALLOW_USER_SET  0x00040000 /* Do not allow this GUC to be set by the user */
227

228 229 230 231
/* GUC lists for gp_guc_list_show().  (List of struct config_generic) */
extern List    *gp_guc_list_for_explain;
extern List    *gp_guc_list_for_no_plan;

232 233 234 235 236 237 238
/* GUC vars that are actually declared in guc.c, rather than elsewhere */
extern bool log_duration;
extern bool Debug_print_plan;
extern bool Debug_print_parse;
extern bool Debug_print_rewritten;
extern bool Debug_pretty_print;

239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255
extern bool	Debug_print_full_dtm;
extern bool	Debug_print_snapshot_dtm;
extern bool Debug_disable_distributed_snapshot;
extern bool Debug_abort_after_distributed_prepared;
extern bool Debug_abort_after_segment_prepared;
extern bool Debug_appendonly_print_insert;
extern bool Debug_appendonly_print_insert_tuple;
extern bool Debug_appendonly_print_scan;
extern bool Debug_appendonly_print_scan_tuple;
extern bool Debug_appendonly_print_delete;
extern bool Debug_appendonly_print_storage_headers;
extern bool Debug_appendonly_print_verify_write_block;
extern bool Debug_appendonly_use_no_toast;
extern bool Debug_appendonly_print_blockdirectory;
extern bool Debug_appendonly_print_read_block;
extern bool Debug_appendonly_print_append_block;
extern bool Debug_appendonly_print_segfile_choice;
256
extern bool test_AppendOnlyHash_eviction_vs_just_marking_not_inuse;
257 258 259 260 261 262 263 264 265 266 267 268 269 270
extern int  Debug_appendonly_bad_header_print_level;
extern bool Debug_appendonly_print_datumstream;
extern bool Debug_appendonly_print_visimap;
extern bool Debug_appendonly_print_compaction;
extern bool gp_crash_recovery_abort_suppress_fatal;
extern bool Debug_bitmap_print_insert;
extern bool Test_appendonly_override;
extern bool enable_checksum_on_tables;
extern int  Test_compresslevel_override;
extern int  gp_max_local_distributed_cache;
extern bool gp_local_distributed_cache_stats;
extern bool gp_appendonly_verify_block_checksums;
extern bool gp_appendonly_verify_write_block;
extern bool gp_appendonly_compaction;
271

272 273 274 275 276 277 278
/*
 * Threshold of the ratio of dirty data in a segment file
 * over which the segment file will be compacted during
 * lazy vacuum.
 * 0 indicates compact whenever there is hidden data.
 * 10 indicates that a segment should be compacted when more than
 * 10% of the tuples are hidden.
279
 */
280 281 282 283 284 285 286 287 288 289 290 291 292
extern int  gp_appendonly_compaction_threshold;
extern bool gp_heap_require_relhasoids_match;
extern bool	debug_xlog_record_read;
extern bool Debug_cancel_print;
extern bool Debug_datumstream_write_print_small_varlena_info;
extern bool Debug_datumstream_write_print_large_varlena_info;
extern bool Debug_datumstream_read_check_large_varlena_integrity;
extern bool Debug_datumstream_block_read_check_integrity;
extern bool Debug_datumstream_block_write_check_integrity;
extern bool Debug_datumstream_read_print_varlena_info;
extern bool Debug_datumstream_write_use_small_initial_buffers;
extern bool	Debug_database_command_print;
extern bool gp_startup_integrity_checks;
293
extern bool Debug_resource_group;
294 295 296
extern bool gp_crash_recovery_suppress_ao_eof;
extern bool gp_create_table_random_default_distribution;
extern bool gp_allow_non_uniform_partitioning_ddl;
297
extern bool gp_enable_exchange_default_partition;
298
extern int  dtx_phase2_retry_count;
299 300 301 302 303 304 305 306 307 308 309 310 311

/* WAL replication debug gucs */
extern bool debug_walrepl_snd;
extern bool debug_walrepl_syncrep;
extern bool debug_walrepl_rcv;
extern bool debug_basebackup;

/* Latch mechanism debug GUCs */
extern bool debug_latch;

extern bool gp_maintenance_mode;
extern bool gp_maintenance_conn;
extern bool allow_segment_DML;
312
extern bool gp_allow_rename_relation_without_lock;
313 314 315

extern bool gp_ignore_window_exclude;

316 317
extern bool gp_ignore_error_table;

318 319 320 321 322 323 324
extern bool rle_type_compression_stats;

extern bool	Debug_print_server_processes;
extern bool Debug_print_control_checkpoints;
extern bool	Debug_dtm_action_primary;

extern bool gp_log_optimization_time;
325 326 327 328
extern bool log_parser_stats;
extern bool log_planner_stats;
extern bool log_executor_stats;
extern bool log_statement_stats;
329
extern bool log_dispatch_stats;
330 331
extern bool log_btree_build_stats;

332
extern PGDLLIMPORT bool check_function_bodies;
333
extern bool default_with_oids;
334
extern bool SQL_inheritance;
335

336
extern int	log_min_error_statement;
R
Robert Haas 已提交
337 338
extern PGDLLIMPORT int log_min_messages;
extern PGDLLIMPORT int client_min_messages;
339
extern int	log_min_duration_statement;
340
extern int	log_temp_files;
341

342 343
extern int	temp_file_limit;

344 345
extern int	num_temp_buffers;

346
extern bool vmem_process_interrupt;
347
extern bool execute_pruned_plan;
348 349 350 351 352 353

extern bool gp_partitioning_dynamic_selection_log;
extern int gp_max_partition_level;

extern bool gp_perfmon_print_packet_info;

354 355
extern bool gp_enable_relsize_collection;

356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383
/* Debug DTM Action */
typedef enum
{
	DEBUG_DTM_ACTION_NONE = 0,
	DEBUG_DTM_ACTION_DELAY = 1,
	DEBUG_DTM_ACTION_FAIL_BEGIN_COMMAND = 2,
	DEBUG_DTM_ACTION_FAIL_END_COMMAND = 3,
	DEBUG_DTM_ACTION_PANIC_BEGIN_COMMAND = 4,

	DEBUG_DTM_ACTION_LAST = 4
}	DebugDtmAction;

/* Debug DTM Action */
typedef enum
{
	DEBUG_DTM_ACTION_TARGET_NONE = 0,
	DEBUG_DTM_ACTION_TARGET_PROTOCOL = 1,
	DEBUG_DTM_ACTION_TARGET_SQL = 2,

	DEBUG_DTM_ACTION_TARGET_LAST = 2
}	DebugDtmActionTarget;

extern int Debug_dtm_action;
extern int Debug_dtm_action_target;
extern int Debug_dtm_action_protocol;
extern int Debug_dtm_action_segment;
extern int Debug_dtm_action_nestinglevel;

384
extern char *data_directory;
R
Robert Haas 已提交
385
extern PGDLLIMPORT char *ConfigFileName;
386 387 388
extern char *HbaFileName;
extern char *IdentFileName;
extern char *external_pid_file;
389

390 391 392 393 394 395 396 397 398
extern char *application_name;

extern char *Debug_dtm_action_sql_command_tag;
extern char *Debug_dtm_action_str;
extern char *Debug_dtm_action_target_str;

/* Enable check for compatibility of encoding and locale in createdb */
extern bool gp_encoding_check_locale_compatibility;

B
Bruce Momjian 已提交
399 400 401
extern int	tcp_keepalives_idle;
extern int	tcp_keepalives_interval;
extern int	tcp_keepalives_count;
402

403 404 405 406
extern int	gp_connection_send_timeout;

extern int  WalSendClientTimeout;

407 408
extern bool create_restartpoint_on_ckpt_record_replay;

409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426
extern char  *data_directory;

/* ORCA related definitions */
#define OPTIMIZER_XFORMS_COUNT 400 /* number of transformation rules */

/* types of optimizer failures */
#define OPTIMIZER_ALL_FAIL 			0  /* all failures */
#define OPTIMIZER_UNEXPECTED_FAIL 	1  /* unexpected failures */
#define OPTIMIZER_EXPECTED_FAIL 	2 /* expected failures */

/* optimizer minidump mode */
#define OPTIMIZER_MINIDUMP_FAIL  	0  /* create optimizer minidump on failure */
#define OPTIMIZER_MINIDUMP_ALWAYS 	1  /* always create optimizer minidump */

/* optimizer cost model */
#define OPTIMIZER_GPDB_LEGACY           0       /* GPDB's legacy cost model */
#define OPTIMIZER_GPDB_CALIBRATED       1       /* GPDB's calibrated cost model */

V
Venkatesh Raghavan 已提交
427
/* Optimizer related gucs */
428
extern bool	optimizer;
V
Venkatesh Raghavan 已提交
429
extern bool optimizer_control;	/* controls whether the user can change the setting of the "optimizer" guc */
430
extern bool	optimizer_log;
V
Venkatesh Raghavan 已提交
431
extern int  optimizer_log_failure;
432
extern bool	optimizer_trace_fallback;
A
Asim R P 已提交
433
extern int optimizer_minidump;
434
extern int  optimizer_cost_model;
V
Venkatesh Raghavan 已提交
435 436 437 438
extern bool optimizer_metadata_caching;
extern int	optimizer_mdcache_size;

/* Optimizer debugging GUCs */
439 440 441 442 443 444 445 446 447 448 449
extern bool optimizer_print_query;
extern bool optimizer_print_plan;
extern bool optimizer_print_xform;
extern bool	optimizer_print_memo_after_exploration;
extern bool	optimizer_print_memo_after_implementation;
extern bool	optimizer_print_memo_after_optimization;
extern bool	optimizer_print_job_scheduler;
extern bool	optimizer_print_expression_properties;
extern bool	optimizer_print_group_properties;
extern bool	optimizer_print_optimization_context;
extern bool optimizer_print_optimization_stats;
V
Venkatesh Raghavan 已提交
450 451 452 453
extern bool optimizer_print_xform_results;

/* array of xforms disable flags */
extern bool optimizer_xforms[OPTIMIZER_XFORMS_COUNT];
454
extern char *optimizer_search_strategy_path;
V
Venkatesh Raghavan 已提交
455 456

/* GUCs to tell Optimizer to enable a physical operator */
457 458 459 460 461 462 463 464 465 466 467 468 469 470
extern bool optimizer_enable_indexjoin;
extern bool optimizer_enable_motions_masteronly_queries;
extern bool optimizer_enable_motions;
extern bool optimizer_enable_motion_broadcast;
extern bool optimizer_enable_motion_gather;
extern bool optimizer_enable_motion_redistribute;
extern bool optimizer_enable_sort;
extern bool optimizer_enable_materialize;
extern bool optimizer_enable_partition_propagation;
extern bool optimizer_enable_partition_selection;
extern bool optimizer_enable_outerjoin_rewrite;
extern bool optimizer_enable_multiple_distinct_aggs;
extern bool optimizer_enable_hashjoin_redistribute_broadcast_children;
extern bool optimizer_enable_broadcast_nestloop_outer_child;
471
extern bool optimizer_enable_streaming_material;
472
extern bool optimizer_enable_gather_on_segment_for_dml;
473
extern bool optimizer_enable_assert_maxonerow;
V
Venkatesh Raghavan 已提交
474 475 476 477 478 479 480 481 482
extern bool optimizer_enable_constant_expression_evaluation;
extern bool optimizer_enable_bitmapscan;
extern bool optimizer_enable_outerjoin_to_unionall_rewrite;
extern bool optimizer_enable_ctas;
extern bool optimizer_enable_partial_index;
extern bool optimizer_enable_dml_triggers;
extern bool	optimizer_enable_dml_constraints;
extern bool optimizer_enable_direct_dispatch;
extern bool optimizer_enable_master_only_queries;
483 484 485
extern bool optimizer_enable_hashjoin;
extern bool optimizer_enable_dynamictablescan;
extern bool optimizer_enable_indexscan;
486
extern bool optimizer_enable_tablescan;
V
Venkatesh Raghavan 已提交
487 488

/* Optimizer plan enumeration related GUCs */
489 490 491 492
extern bool optimizer_enumerate_plans;
extern bool optimizer_sample_plans;
extern int	optimizer_plan_id;
extern int	optimizer_samples_number;
V
Venkatesh Raghavan 已提交
493 494 495 496 497

/* Cardinality estimation related GUCs used by the Optimizer */
extern bool optimizer_extract_dxl_stats;
extern bool optimizer_extract_dxl_stats_all_nodes;
extern bool optimizer_print_missing_stats;
498 499 500
extern double optimizer_damping_factor_filter;
extern double optimizer_damping_factor_join;
extern double optimizer_damping_factor_groupby;
V
Venkatesh Raghavan 已提交
501 502 503 504
extern bool optimizer_dpe_stats;
extern bool optimizer_enable_derive_stats_all_groups;

/* Costing or tuning related GUCs used by the Optimizer */
505
extern int optimizer_segments;
506
extern int optimizer_penalize_broadcast_threshold;
V
Venkatesh Raghavan 已提交
507 508 509 510 511
extern double optimizer_cost_threshold;
extern double optimizer_nestloop_factor;
extern double optimizer_sort_factor;

/* Optimizer hints */
512
extern int optimizer_array_expansion_threshold;
513
extern int optimizer_join_order_threshold;
514
extern int optimizer_join_order;
V
Venkatesh Raghavan 已提交
515 516 517 518 519
extern int optimizer_join_arity_for_associativity_commutativity;
extern int optimizer_cte_inlining_bound;
extern bool optimizer_force_multistage_agg;
extern bool optimizer_force_three_stage_scalar_dqa;
extern bool optimizer_force_expanded_distinct_aggs;
520
extern bool optimizer_force_agg_skew_avoidance;
V
Venkatesh Raghavan 已提交
521 522 523
extern bool optimizer_prune_computed_columns;
extern bool optimizer_push_requirements_from_consumer_to_producer;
extern bool optimizer_enforce_subplans;
524
extern bool optimizer_apply_left_outer_to_union_all_disregarding_stats;
V
Venkatesh Raghavan 已提交
525
extern bool optimizer_use_external_constant_expression_evaluation_for_ints;
526 527
extern bool optimizer_remove_order_below_dml;
extern bool optimizer_multilevel_partitioning;
528
extern bool optimizer_parallel_union;
529
extern bool optimizer_array_constraints;
V
Venkatesh Raghavan 已提交
530 531
extern bool optimizer_cte_inlining;
extern bool optimizer_enable_space_pruning;
532
extern bool optimizer_enable_associativity;
V
Venkatesh Raghavan 已提交
533 534 535 536 537

/* Analyze related GUCs for Optimizer */
extern bool optimizer_analyze_root_partition;
extern bool optimizer_analyze_midlevel_partition;

538 539
extern bool optimizer_use_gpdb_allocators;

P
Pengzhou Tang 已提交
540 541
/* optimizer GUCs for replicated table */
extern bool optimizer_replicated_table_insert;
542

543 544 545
/* GUCs for slice table*/
extern int	gp_max_slices;

546 547 548 549 550
/**
 * Enable logging of DPE match in optimizer.
 */
extern bool	optimizer_partition_selection_log;

551 552 553 554 555
/* optimizer join heuristic models */
#define JOIN_ORDER_IN_QUERY                 0
#define JOIN_ORDER_GREEDY_SEARCH            1
#define JOIN_ORDER_EXHAUSTIVE_SEARCH        2

556 557 558 559 560
/* Time based authentication GUC */
extern char  *gp_auth_time_override_str;

extern char  *gp_default_storage_options;

561 562 563
/* copy GUC */
extern bool gp_enable_segment_copy_checking;

564 565
extern int writable_external_table_bufsize;

566 567 568
/* Enable passing of query constraints to external table providers */
extern bool gp_external_enable_filter_pushdown;

569 570 571
/* Enable the Global Deadlock Detector */
extern bool gp_enable_global_deadlock_detector;

572 573 574 575 576 577 578 579 580 581
typedef enum
{
	INDEX_CHECK_NONE,
	INDEX_CHECK_SYSTEM,
	INDEX_CHECK_ALL
} IndexCheckType;

extern IndexCheckType gp_indexcheck_insert;
extern IndexCheckType gp_indexcheck_vacuum;

582 583 584 585 586 587 588 589
/* Storage option names */
#define SOPT_FILLFACTOR    "fillfactor"
#define SOPT_APPENDONLY    "appendonly"
#define SOPT_BLOCKSIZE     "blocksize"
#define SOPT_COMPTYPE      "compresstype"
#define SOPT_COMPLEVEL     "compresslevel"
#define SOPT_CHECKSUM      "checksum"
#define SOPT_ORIENTATION   "orientation"
590 591
/* Aliases for storage option names */
#define SOPT_ALIAS_APPENDOPTIMIZED "appendoptimized"
592 593 594
/* Max number of chars needed to hold value of a storage option. */
#define MAX_SOPT_VALUE_LEN 15

595 596 597
/*
 * Functions exported by guc.c
 */
598
extern void SetConfigOption(const char *name, const char *value,
599
				GucContext context, GucSource source);
600 601

extern void DefineCustomBoolVariable(
B
Bruce Momjian 已提交
602 603 604 605
						 const char *name,
						 const char *short_desc,
						 const char *long_desc,
						 bool *valueAddr,
606
						 bool bootValue,
B
Bruce Momjian 已提交
607
						 GucContext context,
608
						 int flags,
609
						 GucBoolCheckHook check_hook,
B
Bruce Momjian 已提交
610 611
						 GucBoolAssignHook assign_hook,
						 GucShowHook show_hook);
612 613

extern void DefineCustomIntVariable(
B
Bruce Momjian 已提交
614 615 616 617
						const char *name,
						const char *short_desc,
						const char *long_desc,
						int *valueAddr,
618
						int bootValue,
619 620
						int minValue,
						int maxValue,
B
Bruce Momjian 已提交
621
						GucContext context,
622
						int flags,
623
						GucIntCheckHook check_hook,
B
Bruce Momjian 已提交
624 625
						GucIntAssignHook assign_hook,
						GucShowHook show_hook);
626 627

extern void DefineCustomRealVariable(
B
Bruce Momjian 已提交
628 629 630 631
						 const char *name,
						 const char *short_desc,
						 const char *long_desc,
						 double *valueAddr,
632
						 double bootValue,
633 634
						 double minValue,
						 double maxValue,
B
Bruce Momjian 已提交
635
						 GucContext context,
636
						 int flags,
637
						 GucRealCheckHook check_hook,
B
Bruce Momjian 已提交
638 639
						 GucRealAssignHook assign_hook,
						 GucShowHook show_hook);
640 641

extern void DefineCustomStringVariable(
B
Bruce Momjian 已提交
642 643 644 645
						   const char *name,
						   const char *short_desc,
						   const char *long_desc,
						   char **valueAddr,
646
						   const char *bootValue,
B
Bruce Momjian 已提交
647
						   GucContext context,
648
						   int flags,
649
						   GucStringCheckHook check_hook,
B
Bruce Momjian 已提交
650 651
						   GucStringAssignHook assign_hook,
						   GucShowHook show_hook);
652

653
extern void DefineCustomEnumVariable(
654 655 656 657 658 659 660 661
						 const char *name,
						 const char *short_desc,
						 const char *long_desc,
						 int *valueAddr,
						 int bootValue,
						 const struct config_enum_entry * options,
						 GucContext context,
						 int flags,
662
						 GucEnumCheckHook check_hook,
663 664
						 GucEnumAssignHook assign_hook,
						 GucShowHook show_hook);
665

B
Bruce Momjian 已提交
666
extern void EmitWarningsOnPlaceholders(const char *className);
667

668 669
extern const char *GetConfigOption(const char *name, bool missing_ok,
				bool restrict_superuser);
670
extern const char *GetConfigOptionResetString(const char *name);
671
extern int	GetConfigOptionFlags(const char *name, bool missing_ok);
672
extern void ProcessConfigFile(GucContext context);
673
extern void InitializeGUCOptions(void);
674
extern bool SelectConfigFiles(const char *userDoption, const char *progname);
675
extern void ResetAllOptions(void);
676 677 678
extern void AtStart_GUC(void);
extern int	NewGUCNestLevel(void);
extern void AtEOXact_GUC(bool isCommit, int nestLevel);
679
extern void BeginReportingGUCOptions(void);
680
extern void ParseLongOption(const char *string, char **name, char **value);
681
extern bool parse_int(const char *value, int *result, int flags,
682
		  const char **hintmsg);
683
extern bool parse_real(const char *value, double *result);
684
extern int set_config_option(const char *name, const char *value,
B
Bruce Momjian 已提交
685
				  GucContext context, GucSource source,
686
				  GucAction action, bool changeVal, int elevel);
B
Bruce Momjian 已提交
687
extern void AlterSystemSetConfigFile(AlterSystemStmt *setstmt);
688
extern char *GetConfigOptionByName(const char *name, const char **varname);
689
extern void GetConfigOptionByNum(int varnum, const char **values, bool *noshow);
B
Bruce Momjian 已提交
690
extern int	GetNumConfigOptions(void);
691

692
extern void SetPGVariable(const char *name, List *args, bool is_local);
693
extern void SetPGVariableOptDispatch(const char *name, List *args, bool is_local, bool gp_dispatch);
694 695
extern void GetPGVariable(const char *name, DestReceiver *dest);
extern TupleDesc GetPGVariableResultDesc(const char *name);
696

697
extern void ExecSetVariableStmt(VariableSetStmt *stmt, bool isTopLevel);
698
extern char *ExtractSetVariableArgs(VariableSetStmt *stmt);
699

700
extern void ProcessGUCArray(ArrayType *array,
701
				GucContext context, GucSource source, GucAction action);
702 703
extern ArrayType *GUCArrayAdd(ArrayType *array, const char *name, const char *value);
extern ArrayType *GUCArrayDelete(ArrayType *array, const char *name);
704
extern ArrayType *GUCArrayReset(ArrayType *array);
705

706
extern void pg_timezone_abbrev_initialize(void);
707

708
extern List *gp_guc_list_show(GucSource excluding, List *guclist);
709

710 711 712
extern struct config_generic *find_option(const char *name,
				bool create_placeholders, int elevel);

713 714
extern bool select_gp_replication_config_files(const char *configdir, const char *progname);

715
extern void set_gp_replication_config(const char *name, const char *value);
716

717 718
extern bool parse_real(const char *value, double *result);

B
Bruce Momjian 已提交
719
#ifdef EXEC_BACKEND
720 721
extern void write_nondefault_variables(GucContext context);
extern void read_nondefault_variables(void);
B
Bruce Momjian 已提交
722 723
#endif

724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744
/* Support for messages reported from GUC check hooks */

extern PGDLLIMPORT char *GUC_check_errmsg_string;
extern PGDLLIMPORT char *GUC_check_errdetail_string;
extern PGDLLIMPORT char *GUC_check_errhint_string;

extern void GUC_check_errcode(int sqlerrcode);

#define GUC_check_errmsg \
	pre_format_elog_string(errno, TEXTDOMAIN), \
	GUC_check_errmsg_string = format_elog_string

#define GUC_check_errdetail \
	pre_format_elog_string(errno, TEXTDOMAIN), \
	GUC_check_errdetail_string = format_elog_string

#define GUC_check_errhint \
	pre_format_elog_string(errno, TEXTDOMAIN), \
	GUC_check_errhint_string = format_elog_string


745 746 747 748 749 750
/*
 * The following functions are not in guc.c, but are declared here to avoid
 * having to include guc.h in some widely used headers that it really doesn't
 * belong in.
 */

751
/* in commands/tablespace.c */
752 753 754
extern bool check_default_tablespace(char **newval, void **extra, GucSource source);
extern bool check_temp_tablespaces(char **newval, void **extra, GucSource source);
extern void assign_temp_tablespaces(const char *newval, void *extra);
755

756
/* in catalog/namespace.c */
757 758
extern bool check_search_path(char **newval, void **extra, GucSource source);
extern void assign_search_path(const char *newval, void *extra);
B
Bruce Momjian 已提交
759

760
/* in access/transam/xlog.c */
761 762
extern bool check_wal_buffers(int *newval, void **extra, GucSource source);
extern void assign_xlog_sync_method(int new_sync_method, void *extra);
763

A
Asim R P 已提交
764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780
/* in cdb/cdbvars.c */
extern bool check_gp_session_role(char **newval, void **extra, GucSource source);
extern void assign_gp_session_role(const char *newval, void *extra);
extern const char *show_gp_session_role(void);
extern bool check_gp_role(char **newval, void **extra, GucSource source);
extern void assign_gp_role(const char *newval, void *extra);
extern const char *show_gp_role(void);
extern void assign_gp_write_shared_snapshot(bool newval, void *extra);
extern bool gpvars_check_gp_resource_manager_policy(char **newval, void **extra, GucSource source);
extern void gpvars_assign_gp_resource_manager_policy(const char *newval, void *extra);
extern const char *gpvars_show_gp_resource_manager_policy(void);
extern const char *gpvars_assign_gp_resqueue_memory_policy(const char *newval, bool doit, GucSource source);
extern const char *gpvars_show_gp_resqueue_memory_policy(void);
extern bool gpvars_check_statement_mem(int *newval, void **extra, GucSource source);
extern bool gpvars_check_gp_enable_gpperfmon(bool *newval, void **extra, GucSource source);
extern bool gpvars_check_gp_gpperfmon_send_interval(int *newval, void **extra, GucSource source);

781

782 783
extern StdRdOptions *defaultStdRdOptions(char relkind);

784
#endif   /* GUC_H */