guc.h 28.0 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 32 33 34 35 36 37
/*
 * 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"

38
/*
39 40 41
 * Certain options can only be set at certain times. The rules are
 * like this:
 *
42 43 44 45
 * 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.
 *
46 47 48 49 50
 * 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
51 52 53 54
 * 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.)
55
 *
56
 * BACKEND options can only be set at postmaster startup, from the
57 58 59
 * 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 已提交
60
 * configuration file.  The idea is that these options are fixed for a
61
 * given backend once it's started, but they can vary across backends.
62 63
 *
 * SUSET options can be set at postmaster startup, with the SIGHUP
64
 * mechanism, or from SQL if you're a superuser.
65 66
 *
 * USERSET options can be set by anyone any time.
67
 */
B
Bruce Momjian 已提交
68 69
typedef enum
{
70 71 72 73 74 75
	PGC_INTERNAL,
	PGC_POSTMASTER,
	PGC_SIGHUP,
	PGC_BACKEND,
	PGC_SUSET,
	PGC_USERSET
76 77
} GucContext;

78 79 80 81
/*
 * 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
82 83 84
 * 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
85 86
 * as the current value.  Note that source == PGC_S_OVERRIDE should be
 * used when setting a PGC_INTERNAL option.
87
 *
88
 * PGC_S_INTERACTIVE isn't actually a source value, but is the
89 90 91
 * dividing line between "interactive" and "non-interactive" sources for
 * error reporting purposes.
 *
92 93 94 95 96 97 98 99 100
 * 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.
101 102
 *
 * NB: see GucSource_Names in guc.c if you change this.
103 104 105
 */
typedef enum
{
106 107
	PGC_S_DEFAULT,				/* hard-wired default ("boot_val") */
	PGC_S_DYNAMIC_DEFAULT,		/* default computed during initialization */
108 109 110
	PGC_S_ENV_VAR,				/* postmaster environment variable */
	PGC_S_FILE,					/* postgresql.conf */
	PGC_S_ARGV,					/* postmaster command line */
111
	PGC_S_GLOBAL,				/* global in-database setting */
112 113
	PGC_S_DATABASE,				/* per-database setting */
	PGC_S_USER,					/* per-user setting */
114
	PGC_S_DATABASE_USER,		/* per-user-and-database setting */
115
	PGC_S_CLIENT,				/* from client connection request */
116
	PGC_S_RESGROUP,				/* per-resgroup setting */
117
	PGC_S_OVERRIDE,				/* special case to forcibly set default */
118 119
	PGC_S_INTERACTIVE,			/* dividing line for error reporting */
	PGC_S_TEST,					/* test per-database or per-user setting */
120
	PGC_S_SESSION				/* SET command */
121
} GucSource;
122

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

extern bool ParseConfigFile(const char *config_file, const char *calling_file,
141
				bool strict, int depth, int elevel,
142 143 144 145
				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);
146 147 148 149 150
extern bool ParseConfigDirectory(const char *includedir,
					 const char *calling_file,
					 int depth, int elevel,
					 ConfigVariable **head_p,
					 ConfigVariable **tail_p);
151 152 153
extern void FreeConfigVariables(ConfigVariable *list);

/*
154 155 156
 * 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.
157 158 159 160 161 162 163
 */
struct config_enum_entry
{
	const char *name;
	int			val;
	bool		hidden;
};
164

165 166 167 168 169 170 171 172 173 174 175 176 177 178
/*
 * 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);
179

B
Bruce Momjian 已提交
180
typedef const char *(*GucShowHook) (void);
181

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

193 194
#define GUC_QUALIFIER_SEPARATOR '.'

195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218
/*
 * 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 */

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

222 223 224
/* 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 */
225

226 227 228 229
/* 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;

230 231 232 233 234 235 236
/* 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;

237 238 239 240 241 242 243 244 245 246 247 248 249 250 251
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_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_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;
252
extern bool test_AppendOnlyHash_eviction_vs_just_marking_not_inuse;
253 254 255 256 257 258 259 260 261 262
extern bool Debug_appendonly_print_datumstream;
extern bool Debug_appendonly_print_visimap;
extern bool Debug_appendonly_print_compaction;
extern bool Debug_bitmap_print_insert;
extern bool enable_checksum_on_tables;
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;
263

264 265 266 267 268 269 270
/*
 * 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.
271
 */
272 273 274 275 276 277 278 279 280 281 282 283
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;
284
extern bool Debug_resource_group;
285 286
extern bool gp_create_table_random_default_distribution;
extern bool gp_allow_non_uniform_partitioning_ddl;
287
extern bool gp_enable_exchange_default_partition;
288
extern int  dtx_phase2_retry_count;
289 290 291 292 293 294 295 296 297 298 299 300 301

/* 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;
302
extern bool gp_allow_rename_relation_without_lock;
303 304 305

extern bool gp_ignore_window_exclude;

306 307
extern bool gp_ignore_error_table;

308 309 310
extern bool	Debug_dtm_action_primary;

extern bool gp_log_optimization_time;
311 312 313 314
extern bool log_parser_stats;
extern bool log_planner_stats;
extern bool log_executor_stats;
extern bool log_statement_stats;
315
extern bool log_dispatch_stats;
316 317
extern bool log_btree_build_stats;

318
extern PGDLLIMPORT bool check_function_bodies;
319
extern bool default_with_oids;
320
extern bool SQL_inheritance;
321

322
extern int	log_min_error_statement;
R
Robert Haas 已提交
323 324
extern PGDLLIMPORT int log_min_messages;
extern PGDLLIMPORT int client_min_messages;
325
extern int	log_min_duration_statement;
326
extern int	log_temp_files;
327

328 329
extern int	temp_file_limit;

330 331
extern int	num_temp_buffers;

332
extern bool vmem_process_interrupt;
333
extern bool execute_pruned_plan;
334 335 336 337 338 339

extern bool gp_partitioning_dynamic_selection_log;
extern int gp_max_partition_level;

extern bool gp_perfmon_print_packet_info;

340 341
extern bool gp_enable_relsize_collection;

342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369
/* 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;

370
extern char *data_directory;
R
Robert Haas 已提交
371
extern PGDLLIMPORT char *ConfigFileName;
372 373 374
extern char *HbaFileName;
extern char *IdentFileName;
extern char *external_pid_file;
375

376 377 378 379 380 381 382 383 384
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 已提交
385 386 387
extern int	tcp_keepalives_idle;
extern int	tcp_keepalives_interval;
extern int	tcp_keepalives_count;
388

389 390
extern int	gp_connection_send_timeout;

391 392
extern bool create_restartpoint_on_ckpt_record_replay;

393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410
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 已提交
411
/* Optimizer related gucs */
412
extern bool	optimizer;
V
Venkatesh Raghavan 已提交
413
extern bool optimizer_control;	/* controls whether the user can change the setting of the "optimizer" guc */
414
extern bool	optimizer_log;
V
Venkatesh Raghavan 已提交
415
extern int  optimizer_log_failure;
416
extern bool	optimizer_trace_fallback;
A
Asim R P 已提交
417
extern int optimizer_minidump;
418
extern int  optimizer_cost_model;
V
Venkatesh Raghavan 已提交
419 420 421 422
extern bool optimizer_metadata_caching;
extern int	optimizer_mdcache_size;

/* Optimizer debugging GUCs */
423 424 425 426 427 428 429 430 431 432 433
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 已提交
434 435 436 437
extern bool optimizer_print_xform_results;

/* array of xforms disable flags */
extern bool optimizer_xforms[OPTIMIZER_XFORMS_COUNT];
438
extern char *optimizer_search_strategy_path;
V
Venkatesh Raghavan 已提交
439 440

/* GUCs to tell Optimizer to enable a physical operator */
441 442 443 444 445 446 447 448 449 450 451 452 453 454
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;
455
extern bool optimizer_enable_streaming_material;
456
extern bool optimizer_enable_gather_on_segment_for_dml;
457
extern bool optimizer_enable_assert_maxonerow;
V
Venkatesh Raghavan 已提交
458 459 460 461 462
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;
463
extern bool optimizer_enable_dml;
V
Venkatesh Raghavan 已提交
464 465 466 467
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;
468 469 470
extern bool optimizer_enable_hashjoin;
extern bool optimizer_enable_dynamictablescan;
extern bool optimizer_enable_indexscan;
471
extern bool optimizer_enable_tablescan;
472
extern bool optimizer_enable_eageragg;
473
extern bool optimizer_expand_fulljoin;
474 475
extern bool optimizer_enable_hashagg;
extern bool optimizer_enable_groupagg;
V
Venkatesh Raghavan 已提交
476 477

/* Optimizer plan enumeration related GUCs */
478 479 480 481
extern bool optimizer_enumerate_plans;
extern bool optimizer_sample_plans;
extern int	optimizer_plan_id;
extern int	optimizer_samples_number;
V
Venkatesh Raghavan 已提交
482 483 484 485 486

/* 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;
487 488 489
extern double optimizer_damping_factor_filter;
extern double optimizer_damping_factor_join;
extern double optimizer_damping_factor_groupby;
V
Venkatesh Raghavan 已提交
490 491 492 493
extern bool optimizer_dpe_stats;
extern bool optimizer_enable_derive_stats_all_groups;

/* Costing or tuning related GUCs used by the Optimizer */
494
extern int optimizer_segments;
495
extern int optimizer_penalize_broadcast_threshold;
V
Venkatesh Raghavan 已提交
496 497 498 499 500
extern double optimizer_cost_threshold;
extern double optimizer_nestloop_factor;
extern double optimizer_sort_factor;

/* Optimizer hints */
501
extern int optimizer_array_expansion_threshold;
502
extern int optimizer_join_order_threshold;
503
extern int optimizer_join_order;
V
Venkatesh Raghavan 已提交
504 505
extern int optimizer_join_arity_for_associativity_commutativity;
extern int optimizer_cte_inlining_bound;
506
extern int optimizer_push_group_by_below_setop_threshold;
V
Venkatesh Raghavan 已提交
507 508 509
extern bool optimizer_force_multistage_agg;
extern bool optimizer_force_three_stage_scalar_dqa;
extern bool optimizer_force_expanded_distinct_aggs;
510
extern bool optimizer_force_agg_skew_avoidance;
V
Venkatesh Raghavan 已提交
511 512 513
extern bool optimizer_prune_computed_columns;
extern bool optimizer_push_requirements_from_consumer_to_producer;
extern bool optimizer_enforce_subplans;
514
extern bool optimizer_apply_left_outer_to_union_all_disregarding_stats;
V
Venkatesh Raghavan 已提交
515
extern bool optimizer_use_external_constant_expression_evaluation_for_ints;
516 517
extern bool optimizer_remove_order_below_dml;
extern bool optimizer_multilevel_partitioning;
518
extern bool optimizer_parallel_union;
519
extern bool optimizer_array_constraints;
V
Venkatesh Raghavan 已提交
520 521
extern bool optimizer_cte_inlining;
extern bool optimizer_enable_space_pruning;
522
extern bool optimizer_enable_associativity;
V
Venkatesh Raghavan 已提交
523 524 525 526 527

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

528 529
extern bool optimizer_use_gpdb_allocators;

P
Pengzhou Tang 已提交
530 531
/* optimizer GUCs for replicated table */
extern bool optimizer_replicated_table_insert;
532

533 534 535
/* GUCs for slice table*/
extern int	gp_max_slices;

536 537 538 539 540
/**
 * Enable logging of DPE match in optimizer.
 */
extern bool	optimizer_partition_selection_log;

541 542 543 544
/* optimizer join heuristic models */
#define JOIN_ORDER_IN_QUERY                 0
#define JOIN_ORDER_GREEDY_SEARCH            1
#define JOIN_ORDER_EXHAUSTIVE_SEARCH        2
545
#define JOIN_ORDER_EXHAUSTIVE2_SEARCH       3
546

547 548 549 550 551
/* Time based authentication GUC */
extern char  *gp_auth_time_override_str;

extern char  *gp_default_storage_options;

552 553 554
/* copy GUC */
extern bool gp_enable_segment_copy_checking;

555 556
extern int writable_external_table_bufsize;

557 558 559
/* Enable passing of query constraints to external table providers */
extern bool gp_external_enable_filter_pushdown;

560 561 562
/* Enable the Global Deadlock Detector */
extern bool gp_enable_global_deadlock_detector;

563 564 565 566 567 568 569 570 571 572
typedef enum
{
	INDEX_CHECK_NONE,
	INDEX_CHECK_SYSTEM,
	INDEX_CHECK_ALL
} IndexCheckType;

extern IndexCheckType gp_indexcheck_insert;
extern IndexCheckType gp_indexcheck_vacuum;

573 574 575 576 577 578 579 580
/* 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"
581 582
/* Aliases for storage option names */
#define SOPT_ALIAS_APPENDOPTIMIZED "appendoptimized"
583 584 585
/* Max number of chars needed to hold value of a storage option. */
#define MAX_SOPT_VALUE_LEN 15

586 587 588
/*
 * Functions exported by guc.c
 */
589
extern void SetConfigOption(const char *name, const char *value,
590
				GucContext context, GucSource source);
591 592

extern void DefineCustomBoolVariable(
B
Bruce Momjian 已提交
593 594 595 596
						 const char *name,
						 const char *short_desc,
						 const char *long_desc,
						 bool *valueAddr,
597
						 bool bootValue,
B
Bruce Momjian 已提交
598
						 GucContext context,
599
						 int flags,
600
						 GucBoolCheckHook check_hook,
B
Bruce Momjian 已提交
601 602
						 GucBoolAssignHook assign_hook,
						 GucShowHook show_hook);
603 604

extern void DefineCustomIntVariable(
B
Bruce Momjian 已提交
605 606 607 608
						const char *name,
						const char *short_desc,
						const char *long_desc,
						int *valueAddr,
609
						int bootValue,
610 611
						int minValue,
						int maxValue,
B
Bruce Momjian 已提交
612
						GucContext context,
613
						int flags,
614
						GucIntCheckHook check_hook,
B
Bruce Momjian 已提交
615 616
						GucIntAssignHook assign_hook,
						GucShowHook show_hook);
617 618

extern void DefineCustomRealVariable(
B
Bruce Momjian 已提交
619 620 621 622
						 const char *name,
						 const char *short_desc,
						 const char *long_desc,
						 double *valueAddr,
623
						 double bootValue,
624 625
						 double minValue,
						 double maxValue,
B
Bruce Momjian 已提交
626
						 GucContext context,
627
						 int flags,
628
						 GucRealCheckHook check_hook,
B
Bruce Momjian 已提交
629 630
						 GucRealAssignHook assign_hook,
						 GucShowHook show_hook);
631 632

extern void DefineCustomStringVariable(
B
Bruce Momjian 已提交
633 634 635 636
						   const char *name,
						   const char *short_desc,
						   const char *long_desc,
						   char **valueAddr,
637
						   const char *bootValue,
B
Bruce Momjian 已提交
638
						   GucContext context,
639
						   int flags,
640
						   GucStringCheckHook check_hook,
B
Bruce Momjian 已提交
641 642
						   GucStringAssignHook assign_hook,
						   GucShowHook show_hook);
643

644
extern void DefineCustomEnumVariable(
645 646 647 648 649 650 651 652
						 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,
653
						 GucEnumCheckHook check_hook,
654 655
						 GucEnumAssignHook assign_hook,
						 GucShowHook show_hook);
656

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

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

683
extern void SetPGVariable(const char *name, List *args, bool is_local);
684
extern void SetPGVariableOptDispatch(const char *name, List *args, bool is_local, bool gp_dispatch);
685 686
extern void GetPGVariable(const char *name, DestReceiver *dest);
extern TupleDesc GetPGVariableResultDesc(const char *name);
687

688
extern void ExecSetVariableStmt(VariableSetStmt *stmt, bool isTopLevel);
689
extern char *ExtractSetVariableArgs(VariableSetStmt *stmt);
690

691
extern void ProcessGUCArray(ArrayType *array,
692
				GucContext context, GucSource source, GucAction action);
693 694
extern ArrayType *GUCArrayAdd(ArrayType *array, const char *name, const char *value);
extern ArrayType *GUCArrayDelete(ArrayType *array, const char *name);
695
extern ArrayType *GUCArrayReset(ArrayType *array);
696

697
extern void pg_timezone_abbrev_initialize(void);
698

699
extern List *gp_guc_list_show(GucSource excluding, List *guclist);
700

701 702 703
extern struct config_generic *find_option(const char *name,
				bool create_placeholders, int elevel);

704 705
extern bool select_gp_replication_config_files(const char *configdir, const char *progname);

706
extern void set_gp_replication_config(const char *name, const char *value);
707

708 709
extern bool parse_real(const char *value, double *result);

B
Bruce Momjian 已提交
710
#ifdef EXEC_BACKEND
711 712
extern void write_nondefault_variables(GucContext context);
extern void read_nondefault_variables(void);
B
Bruce Momjian 已提交
713 714
#endif

715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735
/* 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


736 737 738 739 740 741
/*
 * 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.
 */

742
/* in commands/tablespace.c */
743 744 745
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);
746

747
/* in catalog/namespace.c */
748 749
extern bool check_search_path(char **newval, void **extra, GucSource source);
extern void assign_search_path(const char *newval, void *extra);
B
Bruce Momjian 已提交
750

751
/* in access/transam/xlog.c */
752 753
extern bool check_wal_buffers(int *newval, void **extra, GucSource source);
extern void assign_xlog_sync_method(int new_sync_method, void *extra);
754

A
Asim R P 已提交
755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771
/* 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);

772

773 774
extern StdRdOptions *defaultStdRdOptions(char relkind);

775
#endif   /* GUC_H */