PostgreSQL Source Code  git master
guc.c
Go to the documentation of this file.
1 /*--------------------------------------------------------------------
2  * guc.c
3  *
4  * Support for grand unified configuration scheme, including SET
5  * command, configuration file, and command line options.
6  * See src/backend/utils/misc/README for more information.
7  *
8  *
9  * Copyright (c) 2000-2020, PostgreSQL Global Development Group
10  * Written by Peter Eisentraut <peter_e@gmx.net>.
11  *
12  * IDENTIFICATION
13  * src/backend/utils/misc/guc.c
14  *
15  *--------------------------------------------------------------------
16  */
17 #include "postgres.h"
18 
19 #include <ctype.h>
20 #include <float.h>
21 #include <math.h>
22 #include <limits.h>
23 #include <unistd.h>
24 #include <sys/stat.h>
25 #ifdef HAVE_SYSLOG
26 #include <syslog.h>
27 #endif
28 
29 #include "access/commit_ts.h"
30 #include "access/gin.h"
31 #include "access/rmgr.h"
32 #include "access/tableam.h"
33 #include "access/transam.h"
34 #include "access/twophase.h"
35 #include "access/xact.h"
36 #include "access/xlog_internal.h"
37 #include "catalog/namespace.h"
38 #include "catalog/pg_authid.h"
39 #include "catalog/storage.h"
40 #include "commands/async.h"
41 #include "commands/prepare.h"
42 #include "commands/trigger.h"
43 #include "commands/user.h"
44 #include "commands/vacuum.h"
45 #include "commands/variable.h"
46 #include "common/string.h"
47 #include "funcapi.h"
48 #include "jit/jit.h"
49 #include "libpq/auth.h"
50 #include "libpq/libpq.h"
51 #include "libpq/pqformat.h"
52 #include "miscadmin.h"
53 #include "optimizer/cost.h"
54 #include "optimizer/geqo.h"
55 #include "optimizer/optimizer.h"
56 #include "optimizer/paths.h"
57 #include "optimizer/planmain.h"
58 #include "parser/parse_expr.h"
59 #include "parser/parse_type.h"
60 #include "parser/parser.h"
61 #include "parser/scansup.h"
62 #include "pgstat.h"
63 #include "postmaster/autovacuum.h"
65 #include "postmaster/bgwriter.h"
66 #include "postmaster/postmaster.h"
67 #include "postmaster/syslogger.h"
68 #include "postmaster/walwriter.h"
71 #include "replication/slot.h"
72 #include "replication/syncrep.h"
74 #include "replication/walsender.h"
75 #include "storage/bufmgr.h"
76 #include "storage/dsm_impl.h"
77 #include "storage/fd.h"
78 #include "storage/large_object.h"
79 #include "storage/pg_shmem.h"
80 #include "storage/predicate.h"
81 #include "storage/proc.h"
82 #include "storage/standby.h"
83 #include "tcop/tcopprot.h"
84 #include "tsearch/ts_cache.h"
85 #include "utils/acl.h"
86 #include "utils/builtins.h"
87 #include "utils/bytea.h"
88 #include "utils/float.h"
89 #include "utils/guc_tables.h"
90 #include "utils/memutils.h"
91 #include "utils/pg_locale.h"
92 #include "utils/pg_lsn.h"
93 #include "utils/plancache.h"
94 #include "utils/portal.h"
95 #include "utils/ps_status.h"
96 #include "utils/rls.h"
97 #include "utils/snapmgr.h"
98 #include "utils/tzparser.h"
99 #include "utils/varlena.h"
100 #include "utils/xml.h"
101 
102 #ifndef PG_KRB_SRVTAB
103 #define PG_KRB_SRVTAB ""
104 #endif
105 
106 #define CONFIG_FILENAME "postgresql.conf"
107 #define HBA_FILENAME "pg_hba.conf"
108 #define IDENT_FILENAME "pg_ident.conf"
109 
110 #ifdef EXEC_BACKEND
111 #define CONFIG_EXEC_PARAMS "global/config_exec_params"
112 #define CONFIG_EXEC_PARAMS_NEW "global/config_exec_params.new"
113 #endif
114 
115 /*
116  * Precision with which REAL type guc values are to be printed for GUC
117  * serialization.
118  */
119 #define REALTYPE_PRECISION 17
120 
121 /* XXX these should appear in other modules' header files */
122 extern bool Log_disconnections;
123 extern int CommitDelay;
124 extern int CommitSiblings;
125 extern char *default_tablespace;
126 extern char *temp_tablespaces;
127 extern bool ignore_checksum_failure;
128 extern bool ignore_invalid_pages;
129 extern bool synchronize_seqscans;
130 
131 #ifdef TRACE_SYNCSCAN
132 extern bool trace_syncscan;
133 #endif
134 #ifdef DEBUG_BOUNDED_SORT
135 extern bool optimize_bounded_sort;
136 #endif
137 
139 
140 /* global variables for check hook support */
144 
145 static void do_serialize(char **destptr, Size *maxbytes, const char *fmt,...) pg_attribute_printf(3, 4);
146 
147 static void set_config_sourcefile(const char *name, char *sourcefile,
148  int sourceline);
149 static bool call_bool_check_hook(struct config_bool *conf, bool *newval,
150  void **extra, GucSource source, int elevel);
151 static bool call_int_check_hook(struct config_int *conf, int *newval,
152  void **extra, GucSource source, int elevel);
153 static bool call_real_check_hook(struct config_real *conf, double *newval,
154  void **extra, GucSource source, int elevel);
155 static bool call_string_check_hook(struct config_string *conf, char **newval,
156  void **extra, GucSource source, int elevel);
157 static bool call_enum_check_hook(struct config_enum *conf, int *newval,
158  void **extra, GucSource source, int elevel);
159 
160 static bool check_log_destination(char **newval, void **extra, GucSource source);
161 static void assign_log_destination(const char *newval, void *extra);
162 
163 static bool check_wal_consistency_checking(char **newval, void **extra,
164  GucSource source);
165 static void assign_wal_consistency_checking(const char *newval, void *extra);
166 
167 #ifdef HAVE_SYSLOG
168 static int syslog_facility = LOG_LOCAL0;
169 #else
170 static int syslog_facility = 0;
171 #endif
172 
173 static void assign_syslog_facility(int newval, void *extra);
174 static void assign_syslog_ident(const char *newval, void *extra);
175 static void assign_session_replication_role(int newval, void *extra);
176 static bool check_temp_buffers(int *newval, void **extra, GucSource source);
177 static bool check_bonjour(bool *newval, void **extra, GucSource source);
178 static bool check_ssl(bool *newval, void **extra, GucSource source);
179 static bool check_stage_log_stats(bool *newval, void **extra, GucSource source);
180 static bool check_log_stats(bool *newval, void **extra, GucSource source);
181 static bool check_canonical_path(char **newval, void **extra, GucSource source);
182 static bool check_timezone_abbreviations(char **newval, void **extra, GucSource source);
183 static void assign_timezone_abbreviations(const char *newval, void *extra);
184 static void pg_timezone_abbrev_initialize(void);
185 static const char *show_archive_command(void);
186 static void assign_tcp_keepalives_idle(int newval, void *extra);
187 static void assign_tcp_keepalives_interval(int newval, void *extra);
188 static void assign_tcp_keepalives_count(int newval, void *extra);
189 static void assign_tcp_user_timeout(int newval, void *extra);
190 static const char *show_tcp_keepalives_idle(void);
191 static const char *show_tcp_keepalives_interval(void);
192 static const char *show_tcp_keepalives_count(void);
193 static const char *show_tcp_user_timeout(void);
194 static bool check_maxconnections(int *newval, void **extra, GucSource source);
195 static bool check_max_worker_processes(int *newval, void **extra, GucSource source);
196 static bool check_autovacuum_max_workers(int *newval, void **extra, GucSource source);
197 static bool check_max_wal_senders(int *newval, void **extra, GucSource source);
198 static bool check_autovacuum_work_mem(int *newval, void **extra, GucSource source);
199 static bool check_effective_io_concurrency(int *newval, void **extra, GucSource source);
200 static bool check_maintenance_io_concurrency(int *newval, void **extra, GucSource source);
201 static void assign_pgstat_temp_directory(const char *newval, void *extra);
202 static bool check_application_name(char **newval, void **extra, GucSource source);
203 static void assign_application_name(const char *newval, void *extra);
204 static bool check_cluster_name(char **newval, void **extra, GucSource source);
205 static const char *show_unix_socket_permissions(void);
206 static const char *show_log_file_mode(void);
207 static const char *show_data_directory_mode(void);
208 static bool check_backtrace_functions(char **newval, void **extra, GucSource source);
209 static void assign_backtrace_functions(const char *newval, void *extra);
210 static bool check_recovery_target_timeline(char **newval, void **extra, GucSource source);
211 static void assign_recovery_target_timeline(const char *newval, void *extra);
212 static bool check_recovery_target(char **newval, void **extra, GucSource source);
213 static void assign_recovery_target(const char *newval, void *extra);
214 static bool check_recovery_target_xid(char **newval, void **extra, GucSource source);
215 static void assign_recovery_target_xid(const char *newval, void *extra);
216 static bool check_recovery_target_time(char **newval, void **extra, GucSource source);
217 static void assign_recovery_target_time(const char *newval, void *extra);
218 static bool check_recovery_target_name(char **newval, void **extra, GucSource source);
219 static void assign_recovery_target_name(const char *newval, void *extra);
220 static bool check_recovery_target_lsn(char **newval, void **extra, GucSource source);
221 static void assign_recovery_target_lsn(const char *newval, void *extra);
222 static bool check_primary_slot_name(char **newval, void **extra, GucSource source);
223 static bool check_default_with_oids(bool *newval, void **extra, GucSource source);
224 
225 /* Private functions in guc-file.l that need to be called from guc.c */
227  bool applySettings, int elevel);
228 
229 
230 /*
231  * Options for enum values defined in this module.
232  *
233  * NOTE! Option values may not contain double quotes!
234  */
235 
236 static const struct config_enum_entry bytea_output_options[] = {
237  {"escape", BYTEA_OUTPUT_ESCAPE, false},
238  {"hex", BYTEA_OUTPUT_HEX, false},
239  {NULL, 0, false}
240 };
241 
242 StaticAssertDecl(lengthof(bytea_output_options) == (BYTEA_OUTPUT_HEX + 2),
243  "array length mismatch");
244 
245 /*
246  * We have different sets for client and server message level options because
247  * they sort slightly different (see "log" level), and because "fatal"/"panic"
248  * aren't sensible for client_min_messages.
249  */
251  {"debug5", DEBUG5, false},
252  {"debug4", DEBUG4, false},
253  {"debug3", DEBUG3, false},
254  {"debug2", DEBUG2, false},
255  {"debug1", DEBUG1, false},
256  {"debug", DEBUG2, true},
257  {"log", LOG, false},
258  {"info", INFO, true},
259  {"notice", NOTICE, false},
260  {"warning", WARNING, false},
261  {"error", ERROR, false},
262  {NULL, 0, false}
263 };
264 
266  {"debug5", DEBUG5, false},
267  {"debug4", DEBUG4, false},
268  {"debug3", DEBUG3, false},
269  {"debug2", DEBUG2, false},
270  {"debug1", DEBUG1, false},
271  {"debug", DEBUG2, true},
272  {"info", INFO, false},
273  {"notice", NOTICE, false},
274  {"warning", WARNING, false},
275  {"error", ERROR, false},
276  {"log", LOG, false},
277  {"fatal", FATAL, false},
278  {"panic", PANIC, false},
279  {NULL, 0, false}
280 };
281 
282 static const struct config_enum_entry intervalstyle_options[] = {
283  {"postgres", INTSTYLE_POSTGRES, false},
284  {"postgres_verbose", INTSTYLE_POSTGRES_VERBOSE, false},
285  {"sql_standard", INTSTYLE_SQL_STANDARD, false},
286  {"iso_8601", INTSTYLE_ISO_8601, false},
287  {NULL, 0, false}
288 };
289 
290 StaticAssertDecl(lengthof(intervalstyle_options) == (INTSTYLE_ISO_8601 + 2),
291  "array length mismatch");
292 
294  {"terse", PGERROR_TERSE, false},
295  {"default", PGERROR_DEFAULT, false},
296  {"verbose", PGERROR_VERBOSE, false},
297  {NULL, 0, false}
298 };
299 
300 StaticAssertDecl(lengthof(log_error_verbosity_options) == (PGERROR_VERBOSE + 2),
301  "array length mismatch");
302 
303 static const struct config_enum_entry log_statement_options[] = {
304  {"none", LOGSTMT_NONE, false},
305  {"ddl", LOGSTMT_DDL, false},
306  {"mod", LOGSTMT_MOD, false},
307  {"all", LOGSTMT_ALL, false},
308  {NULL, 0, false}
309 };
310 
311 StaticAssertDecl(lengthof(log_statement_options) == (LOGSTMT_ALL + 2),
312  "array length mismatch");
313 
315  {"serializable", XACT_SERIALIZABLE, false},
316  {"repeatable read", XACT_REPEATABLE_READ, false},
317  {"read committed", XACT_READ_COMMITTED, false},
318  {"read uncommitted", XACT_READ_UNCOMMITTED, false},
319  {NULL, 0}
320 };
321 
323  {"origin", SESSION_REPLICATION_ROLE_ORIGIN, false},
324  {"replica", SESSION_REPLICATION_ROLE_REPLICA, false},
325  {"local", SESSION_REPLICATION_ROLE_LOCAL, false},
326  {NULL, 0, false}
327 };
328 
329 StaticAssertDecl(lengthof(session_replication_role_options) == (SESSION_REPLICATION_ROLE_LOCAL + 2),
330  "array length mismatch");
331 
333 #ifdef HAVE_SYSLOG
334  {"local0", LOG_LOCAL0, false},
335  {"local1", LOG_LOCAL1, false},
336  {"local2", LOG_LOCAL2, false},
337  {"local3", LOG_LOCAL3, false},
338  {"local4", LOG_LOCAL4, false},
339  {"local5", LOG_LOCAL5, false},
340  {"local6", LOG_LOCAL6, false},
341  {"local7", LOG_LOCAL7, false},
342 #else
343  {"none", 0, false},
344 #endif
345  {NULL, 0}
346 };
347 
348 static const struct config_enum_entry track_function_options[] = {
349  {"none", TRACK_FUNC_OFF, false},
350  {"pl", TRACK_FUNC_PL, false},
351  {"all", TRACK_FUNC_ALL, false},
352  {NULL, 0, false}
353 };
354 
355 StaticAssertDecl(lengthof(track_function_options) == (TRACK_FUNC_ALL + 2),
356  "array length mismatch");
357 
358 static const struct config_enum_entry xmlbinary_options[] = {
359  {"base64", XMLBINARY_BASE64, false},
360  {"hex", XMLBINARY_HEX, false},
361  {NULL, 0, false}
362 };
363 
364 StaticAssertDecl(lengthof(xmlbinary_options) == (XMLBINARY_HEX + 2),
365  "array length mismatch");
366 
367 static const struct config_enum_entry xmloption_options[] = {
368  {"content", XMLOPTION_CONTENT, false},
369  {"document", XMLOPTION_DOCUMENT, false},
370  {NULL, 0, false}
371 };
372 
373 StaticAssertDecl(lengthof(xmloption_options) == (XMLOPTION_CONTENT + 2),
374  "array length mismatch");
375 
376 /*
377  * Although only "on", "off", and "safe_encoding" are documented, we
378  * accept all the likely variants of "on" and "off".
379  */
381  {"safe_encoding", BACKSLASH_QUOTE_SAFE_ENCODING, false},
382  {"on", BACKSLASH_QUOTE_ON, false},
383  {"off", BACKSLASH_QUOTE_OFF, false},
384  {"true", BACKSLASH_QUOTE_ON, true},
385  {"false", BACKSLASH_QUOTE_OFF, true},
386  {"yes", BACKSLASH_QUOTE_ON, true},
387  {"no", BACKSLASH_QUOTE_OFF, true},
388  {"1", BACKSLASH_QUOTE_ON, true},
389  {"0", BACKSLASH_QUOTE_OFF, true},
390  {NULL, 0, false}
391 };
392 
393 /*
394  * Although only "on", "off", and "partition" are documented, we
395  * accept all the likely variants of "on" and "off".
396  */
398  {"partition", CONSTRAINT_EXCLUSION_PARTITION, false},
399  {"on", CONSTRAINT_EXCLUSION_ON, false},
400  {"off", CONSTRAINT_EXCLUSION_OFF, false},
401  {"true", CONSTRAINT_EXCLUSION_ON, true},
402  {"false", CONSTRAINT_EXCLUSION_OFF, true},
403  {"yes", CONSTRAINT_EXCLUSION_ON, true},
404  {"no", CONSTRAINT_EXCLUSION_OFF, true},
405  {"1", CONSTRAINT_EXCLUSION_ON, true},
406  {"0", CONSTRAINT_EXCLUSION_OFF, true},
407  {NULL, 0, false}
408 };
409 
410 /*
411  * Although only "on", "off", "remote_apply", "remote_write", and "local" are
412  * documented, we accept all the likely variants of "on" and "off".
413  */
415  {"local", SYNCHRONOUS_COMMIT_LOCAL_FLUSH, false},
416  {"remote_write", SYNCHRONOUS_COMMIT_REMOTE_WRITE, false},
417  {"remote_apply", SYNCHRONOUS_COMMIT_REMOTE_APPLY, false},
418  {"on", SYNCHRONOUS_COMMIT_ON, false},
419  {"off", SYNCHRONOUS_COMMIT_OFF, false},
420  {"true", SYNCHRONOUS_COMMIT_ON, true},
421  {"false", SYNCHRONOUS_COMMIT_OFF, true},
422  {"yes", SYNCHRONOUS_COMMIT_ON, true},
423  {"no", SYNCHRONOUS_COMMIT_OFF, true},
424  {"1", SYNCHRONOUS_COMMIT_ON, true},
425  {"0", SYNCHRONOUS_COMMIT_OFF, true},
426  {NULL, 0, false}
427 };
428 
429 /*
430  * Although only "on", "off", "try" are documented, we accept all the likely
431  * variants of "on" and "off".
432  */
433 static const struct config_enum_entry huge_pages_options[] = {
434  {"off", HUGE_PAGES_OFF, false},
435  {"on", HUGE_PAGES_ON, false},
436  {"try", HUGE_PAGES_TRY, false},
437  {"true", HUGE_PAGES_ON, true},
438  {"false", HUGE_PAGES_OFF, true},
439  {"yes", HUGE_PAGES_ON, true},
440  {"no", HUGE_PAGES_OFF, true},
441  {"1", HUGE_PAGES_ON, true},
442  {"0", HUGE_PAGES_OFF, true},
443  {NULL, 0, false}
444 };
445 
447  {"off", FORCE_PARALLEL_OFF, false},
448  {"on", FORCE_PARALLEL_ON, false},
449  {"regress", FORCE_PARALLEL_REGRESS, false},
450  {"true", FORCE_PARALLEL_ON, true},
451  {"false", FORCE_PARALLEL_OFF, true},
452  {"yes", FORCE_PARALLEL_ON, true},
453  {"no", FORCE_PARALLEL_OFF, true},
454  {"1", FORCE_PARALLEL_ON, true},
455  {"0", FORCE_PARALLEL_OFF, true},
456  {NULL, 0, false}
457 };
458 
460  {"auto", PLAN_CACHE_MODE_AUTO, false},
461  {"force_generic_plan", PLAN_CACHE_MODE_FORCE_GENERIC_PLAN, false},
462  {"force_custom_plan", PLAN_CACHE_MODE_FORCE_CUSTOM_PLAN, false},
463  {NULL, 0, false}
464 };
465 
466 /*
467  * password_encryption used to be a boolean, so accept all the likely
468  * variants of "on", too. "off" used to store passwords in plaintext,
469  * but we don't support that anymore.
470  */
472  {"md5", PASSWORD_TYPE_MD5, false},
473  {"scram-sha-256", PASSWORD_TYPE_SCRAM_SHA_256, false},
474  {"on", PASSWORD_TYPE_MD5, true},
475  {"true", PASSWORD_TYPE_MD5, true},
476  {"yes", PASSWORD_TYPE_MD5, true},
477  {"1", PASSWORD_TYPE_MD5, true},
478  {NULL, 0, false}
479 };
480 
482  {"", PG_TLS_ANY, false},
483  {"TLSv1", PG_TLS1_VERSION, false},
484  {"TLSv1.1", PG_TLS1_1_VERSION, false},
485  {"TLSv1.2", PG_TLS1_2_VERSION, false},
486  {"TLSv1.3", PG_TLS1_3_VERSION, false},
487  {NULL, 0, false}
488 };
489 
490 StaticAssertDecl(lengthof(ssl_protocol_versions_info) == (PG_TLS1_3_VERSION + 2),
491  "array length mismatch");
492 
494 #ifndef WIN32
495  {"sysv", SHMEM_TYPE_SYSV, false},
496 #endif
497 #ifndef EXEC_BACKEND
498  {"mmap", SHMEM_TYPE_MMAP, false},
499 #endif
500 #ifdef WIN32
501  {"windows", SHMEM_TYPE_WINDOWS, false},
502 #endif
503  {NULL, 0, false}
504 };
505 
506 /*
507  * Options for enum values stored in other modules
508  */
509 extern const struct config_enum_entry wal_level_options[];
510 extern const struct config_enum_entry archive_mode_options[];
511 extern const struct config_enum_entry recovery_target_action_options[];
512 extern const struct config_enum_entry sync_method_options[];
513 extern const struct config_enum_entry dynamic_shared_memory_options[];
514 
515 /*
516  * GUC option variables that are exported from this module
517  */
518 bool log_duration = false;
519 bool Debug_print_plan = false;
520 bool Debug_print_parse = false;
522 bool Debug_pretty_print = true;
523 
524 bool log_parser_stats = false;
525 bool log_planner_stats = false;
526 bool log_executor_stats = false;
527 bool log_statement_stats = false; /* this is sort of all three above
528  * together */
531 
534 
535 /*
536  * This GUC exists solely for backward compatibility, check its definition for
537  * details.
538  */
539 bool default_with_oids = false;
541 
549 int log_temp_files = -1;
555 
557 
558 int num_temp_buffers = 1024;
559 
560 char *cluster_name = "";
565 
567 
569 
574 
575 /*
576  * SSL renegotiation was been removed in PostgreSQL 9.5, but we tolerate it
577  * being set to zero (meaning never renegotiate) for backward compatibility.
578  * This avoids breaking compatibility with clients that have never supported
579  * renegotiation and therefore always try to zero it.
580  */
582 
583 /*
584  * This really belongs in pg_shmem.c, but is defined here so that it doesn't
585  * need to be duplicated in all the different implementations of pg_shmem.c.
586  */
588 
589 /*
590  * These variables are all dummies that don't do anything, except in some
591  * cases provide the value for SHOW to display. The real state is elsewhere
592  * and is kept in sync by assign_hooks.
593  */
594 static char *syslog_ident_str;
595 static double phony_random_seed;
597 static char *datestyle_string;
598 static char *locale_collate;
599 static char *locale_ctype;
603 static char *timezone_string;
604 static char *log_timezone_string;
606 static char *data_directory;
608 static int max_function_args;
609 static int max_index_keys;
611 static int block_size;
612 static int segment_size;
613 static int wal_block_size;
614 static bool data_checksums;
615 static bool integer_datetimes;
616 static bool assert_enabled;
622 
623 
624 /* should be static, but commands/variable.c needs to get at this */
626 
627 
628 /*
629  * Displayable names for context types (enum GucContext)
630  *
631  * Note: these strings are deliberately not localized.
632  */
633 const char *const GucContext_Names[] =
634 {
635  /* PGC_INTERNAL */ "internal",
636  /* PGC_POSTMASTER */ "postmaster",
637  /* PGC_SIGHUP */ "sighup",
638  /* PGC_SU_BACKEND */ "superuser-backend",
639  /* PGC_BACKEND */ "backend",
640  /* PGC_SUSET */ "superuser",
641  /* PGC_USERSET */ "user"
642 };
643 
644 StaticAssertDecl(lengthof(GucContext_Names) == (PGC_USERSET + 1),
645  "array length mismatch");
646 
647 /*
648  * Displayable names for source types (enum GucSource)
649  *
650  * Note: these strings are deliberately not localized.
651  */
652 const char *const GucSource_Names[] =
653 {
654  /* PGC_S_DEFAULT */ "default",
655  /* PGC_S_DYNAMIC_DEFAULT */ "default",
656  /* PGC_S_ENV_VAR */ "environment variable",
657  /* PGC_S_FILE */ "configuration file",
658  /* PGC_S_ARGV */ "command line",
659  /* PGC_S_GLOBAL */ "global",
660  /* PGC_S_DATABASE */ "database",
661  /* PGC_S_USER */ "user",
662  /* PGC_S_DATABASE_USER */ "database user",
663  /* PGC_S_CLIENT */ "client",
664  /* PGC_S_OVERRIDE */ "override",
665  /* PGC_S_INTERACTIVE */ "interactive",
666  /* PGC_S_TEST */ "test",
667  /* PGC_S_SESSION */ "session"
668 };
669 
670 StaticAssertDecl(lengthof(GucSource_Names) == (PGC_S_SESSION + 1),
671  "array length mismatch");
672 
673 /*
674  * Displayable names for the groupings defined in enum config_group
675  */
676 const char *const config_group_names[] =
677 {
678  /* UNGROUPED */
679  gettext_noop("Ungrouped"),
680  /* FILE_LOCATIONS */
681  gettext_noop("File Locations"),
682  /* CONN_AUTH */
683  gettext_noop("Connections and Authentication"),
684  /* CONN_AUTH_SETTINGS */
685  gettext_noop("Connections and Authentication / Connection Settings"),
686  /* CONN_AUTH_AUTH */
687  gettext_noop("Connections and Authentication / Authentication"),
688  /* CONN_AUTH_SSL */
689  gettext_noop("Connections and Authentication / SSL"),
690  /* RESOURCES */
691  gettext_noop("Resource Usage"),
692  /* RESOURCES_MEM */
693  gettext_noop("Resource Usage / Memory"),
694  /* RESOURCES_DISK */
695  gettext_noop("Resource Usage / Disk"),
696  /* RESOURCES_KERNEL */
697  gettext_noop("Resource Usage / Kernel Resources"),
698  /* RESOURCES_VACUUM_DELAY */
699  gettext_noop("Resource Usage / Cost-Based Vacuum Delay"),
700  /* RESOURCES_BGWRITER */
701  gettext_noop("Resource Usage / Background Writer"),
702  /* RESOURCES_ASYNCHRONOUS */
703  gettext_noop("Resource Usage / Asynchronous Behavior"),
704  /* WAL */
705  gettext_noop("Write-Ahead Log"),
706  /* WAL_SETTINGS */
707  gettext_noop("Write-Ahead Log / Settings"),
708  /* WAL_CHECKPOINTS */
709  gettext_noop("Write-Ahead Log / Checkpoints"),
710  /* WAL_ARCHIVING */
711  gettext_noop("Write-Ahead Log / Archiving"),
712  /* WAL_ARCHIVE_RECOVERY */
713  gettext_noop("Write-Ahead Log / Archive Recovery"),
714  /* WAL_RECOVERY_TARGET */
715  gettext_noop("Write-Ahead Log / Recovery Target"),
716  /* REPLICATION */
717  gettext_noop("Replication"),
718  /* REPLICATION_SENDING */
719  gettext_noop("Replication / Sending Servers"),
720  /* REPLICATION_MASTER */
721  gettext_noop("Replication / Master Server"),
722  /* REPLICATION_STANDBY */
723  gettext_noop("Replication / Standby Servers"),
724  /* REPLICATION_SUBSCRIBERS */
725  gettext_noop("Replication / Subscribers"),
726  /* QUERY_TUNING */
727  gettext_noop("Query Tuning"),
728  /* QUERY_TUNING_METHOD */
729  gettext_noop("Query Tuning / Planner Method Configuration"),
730  /* QUERY_TUNING_COST */
731  gettext_noop("Query Tuning / Planner Cost Constants"),
732  /* QUERY_TUNING_GEQO */
733  gettext_noop("Query Tuning / Genetic Query Optimizer"),
734  /* QUERY_TUNING_OTHER */
735  gettext_noop("Query Tuning / Other Planner Options"),
736  /* LOGGING */
737  gettext_noop("Reporting and Logging"),
738  /* LOGGING_WHERE */
739  gettext_noop("Reporting and Logging / Where to Log"),
740  /* LOGGING_WHEN */
741  gettext_noop("Reporting and Logging / When to Log"),
742  /* LOGGING_WHAT */
743  gettext_noop("Reporting and Logging / What to Log"),
744  /* PROCESS_TITLE */
745  gettext_noop("Process Title"),
746  /* STATS */
747  gettext_noop("Statistics"),
748  /* STATS_MONITORING */
749  gettext_noop("Statistics / Monitoring"),
750  /* STATS_COLLECTOR */
751  gettext_noop("Statistics / Query and Index Statistics Collector"),
752  /* AUTOVACUUM */
753  gettext_noop("Autovacuum"),
754  /* CLIENT_CONN */
755  gettext_noop("Client Connection Defaults"),
756  /* CLIENT_CONN_STATEMENT */
757  gettext_noop("Client Connection Defaults / Statement Behavior"),
758  /* CLIENT_CONN_LOCALE */
759  gettext_noop("Client Connection Defaults / Locale and Formatting"),
760  /* CLIENT_CONN_PRELOAD */
761  gettext_noop("Client Connection Defaults / Shared Library Preloading"),
762  /* CLIENT_CONN_OTHER */
763  gettext_noop("Client Connection Defaults / Other Defaults"),
764  /* LOCK_MANAGEMENT */
765  gettext_noop("Lock Management"),
766  /* COMPAT_OPTIONS */
767  gettext_noop("Version and Platform Compatibility"),
768  /* COMPAT_OPTIONS_PREVIOUS */
769  gettext_noop("Version and Platform Compatibility / Previous PostgreSQL Versions"),
770  /* COMPAT_OPTIONS_CLIENT */
771  gettext_noop("Version and Platform Compatibility / Other Platforms and Clients"),
772  /* ERROR_HANDLING */
773  gettext_noop("Error Handling"),
774  /* PRESET_OPTIONS */
775  gettext_noop("Preset Options"),
776  /* CUSTOM_OPTIONS */
777  gettext_noop("Customized Options"),
778  /* DEVELOPER_OPTIONS */
779  gettext_noop("Developer Options"),
780  /* help_config wants this array to be null-terminated */
781  NULL
782 };
783 
784 StaticAssertDecl(lengthof(config_group_names) == (DEVELOPER_OPTIONS + 2),
785  "array length mismatch");
786 
787 /*
788  * Displayable names for GUC variable types (enum config_type)
789  *
790  * Note: these strings are deliberately not localized.
791  */
792 const char *const config_type_names[] =
793 {
794  /* PGC_BOOL */ "bool",
795  /* PGC_INT */ "integer",
796  /* PGC_REAL */ "real",
797  /* PGC_STRING */ "string",
798  /* PGC_ENUM */ "enum"
799 };
800 
801 StaticAssertDecl(lengthof(config_type_names) == (PGC_ENUM + 1),
802  "array length mismatch");
803 
804 /*
805  * Unit conversion tables.
806  *
807  * There are two tables, one for memory units, and another for time units.
808  * For each supported conversion from one unit to another, we have an entry
809  * in the table.
810  *
811  * To keep things simple, and to avoid possible roundoff error,
812  * conversions are never chained. There needs to be a direct conversion
813  * between all units (of the same type).
814  *
815  * The conversions for each base unit must be kept in order from greatest to
816  * smallest human-friendly unit; convert_xxx_from_base_unit() rely on that.
817  * (The order of the base-unit groups does not matter.)
818  */
819 #define MAX_UNIT_LEN 3 /* length of longest recognized unit string */
820 
821 typedef struct
822 {
823  char unit[MAX_UNIT_LEN + 1]; /* unit, as a string, like "kB" or
824  * "min" */
825  int base_unit; /* GUC_UNIT_XXX */
826  double multiplier; /* Factor for converting unit -> base_unit */
828 
829 /* Ensure that the constants in the tables don't overflow or underflow */
830 #if BLCKSZ < 1024 || BLCKSZ > (1024*1024)
831 #error BLCKSZ must be between 1KB and 1MB
832 #endif
833 #if XLOG_BLCKSZ < 1024 || XLOG_BLCKSZ > (1024*1024)
834 #error XLOG_BLCKSZ must be between 1KB and 1MB
835 #endif
836 
837 static const char *memory_units_hint = gettext_noop("Valid units for this parameter are \"B\", \"kB\", \"MB\", \"GB\", and \"TB\".");
838 
840 {
841  {"TB", GUC_UNIT_BYTE, 1024.0 * 1024.0 * 1024.0 * 1024.0},
842  {"GB", GUC_UNIT_BYTE, 1024.0 * 1024.0 * 1024.0},
843  {"MB", GUC_UNIT_BYTE, 1024.0 * 1024.0},
844  {"kB", GUC_UNIT_BYTE, 1024.0},
845  {"B", GUC_UNIT_BYTE, 1.0},
846 
847  {"TB", GUC_UNIT_KB, 1024.0 * 1024.0 * 1024.0},
848  {"GB", GUC_UNIT_KB, 1024.0 * 1024.0},
849  {"MB", GUC_UNIT_KB, 1024.0},
850  {"kB", GUC_UNIT_KB, 1.0},
851  {"B", GUC_UNIT_KB, 1.0 / 1024.0},
852 
853  {"TB", GUC_UNIT_MB, 1024.0 * 1024.0},
854  {"GB", GUC_UNIT_MB, 1024.0},
855  {"MB", GUC_UNIT_MB, 1.0},
856  {"kB", GUC_UNIT_MB, 1.0 / 1024.0},
857  {"B", GUC_UNIT_MB, 1.0 / (1024.0 * 1024.0)},
858 
859  {"TB", GUC_UNIT_BLOCKS, (1024.0 * 1024.0 * 1024.0) / (BLCKSZ / 1024)},
860  {"GB", GUC_UNIT_BLOCKS, (1024.0 * 1024.0) / (BLCKSZ / 1024)},
861  {"MB", GUC_UNIT_BLOCKS, 1024.0 / (BLCKSZ / 1024)},
862  {"kB", GUC_UNIT_BLOCKS, 1.0 / (BLCKSZ / 1024)},
863  {"B", GUC_UNIT_BLOCKS, 1.0 / BLCKSZ},
864 
865  {"TB", GUC_UNIT_XBLOCKS, (1024.0 * 1024.0 * 1024.0) / (XLOG_BLCKSZ / 1024)},
866  {"GB", GUC_UNIT_XBLOCKS, (1024.0 * 1024.0) / (XLOG_BLCKSZ / 1024)},
867  {"MB", GUC_UNIT_XBLOCKS, 1024.0 / (XLOG_BLCKSZ / 1024)},
868  {"kB", GUC_UNIT_XBLOCKS, 1.0 / (XLOG_BLCKSZ / 1024)},
869  {"B", GUC_UNIT_XBLOCKS, 1.0 / XLOG_BLCKSZ},
870 
871  {""} /* end of table marker */
872 };
873 
874 static const char *time_units_hint = gettext_noop("Valid units for this parameter are \"us\", \"ms\", \"s\", \"min\", \"h\", and \"d\".");
875 
877 {
878  {"d", GUC_UNIT_MS, 1000 * 60 * 60 * 24},
879  {"h", GUC_UNIT_MS, 1000 * 60 * 60},
880  {"min", GUC_UNIT_MS, 1000 * 60},
881  {"s", GUC_UNIT_MS, 1000},
882  {"ms", GUC_UNIT_MS, 1},
883  {"us", GUC_UNIT_MS, 1.0 / 1000},
884 
885  {"d", GUC_UNIT_S, 60 * 60 * 24},
886  {"h", GUC_UNIT_S, 60 * 60},
887  {"min", GUC_UNIT_S, 60},
888  {"s", GUC_UNIT_S, 1},
889  {"ms", GUC_UNIT_S, 1.0 / 1000},
890  {"us", GUC_UNIT_S, 1.0 / (1000 * 1000)},
891 
892  {"d", GUC_UNIT_MIN, 60 * 24},
893  {"h", GUC_UNIT_MIN, 60},
894  {"min", GUC_UNIT_MIN, 1},
895  {"s", GUC_UNIT_MIN, 1.0 / 60},
896  {"ms", GUC_UNIT_MIN, 1.0 / (1000 * 60)},
897  {"us", GUC_UNIT_MIN, 1.0 / (1000 * 1000 * 60)},
898 
899  {""} /* end of table marker */
900 };
901 
902 /*
903  * Contents of GUC tables
904  *
905  * See src/backend/utils/misc/README for design notes.
906  *
907  * TO ADD AN OPTION:
908  *
909  * 1. Declare a global variable of type bool, int, double, or char*
910  * and make use of it.
911  *
912  * 2. Decide at what times it's safe to set the option. See guc.h for
913  * details.
914  *
915  * 3. Decide on a name, a default value, upper and lower bounds (if
916  * applicable), etc.
917  *
918  * 4. Add a record below.
919  *
920  * 5. Add it to src/backend/utils/misc/postgresql.conf.sample, if
921  * appropriate.
922  *
923  * 6. Don't forget to document the option (at least in config.sgml).
924  *
925  * 7. If it's a new GUC_LIST_QUOTE option, you must add it to
926  * variable_is_guc_list_quote() in src/bin/pg_dump/dumputils.c.
927  */
928 
929 
930 /******** option records follow ********/
931 
933 {
934  {
935  {"enable_seqscan", PGC_USERSET, QUERY_TUNING_METHOD,
936  gettext_noop("Enables the planner's use of sequential-scan plans."),
937  NULL,
939  },
941  true,
942  NULL, NULL, NULL
943  },
944  {
945  {"enable_indexscan", PGC_USERSET, QUERY_TUNING_METHOD,
946  gettext_noop("Enables the planner's use of index-scan plans."),
947  NULL,
949  },
951  true,
952  NULL, NULL, NULL
953  },
954  {
955  {"enable_indexonlyscan", PGC_USERSET, QUERY_TUNING_METHOD,
956  gettext_noop("Enables the planner's use of index-only-scan plans."),
957  NULL,
959  },
961  true,
962  NULL, NULL, NULL
963  },
964  {
965  {"enable_bitmapscan", PGC_USERSET, QUERY_TUNING_METHOD,
966  gettext_noop("Enables the planner's use of bitmap-scan plans."),
967  NULL,
969  },
971  true,
972  NULL, NULL, NULL
973  },
974  {
975  {"enable_tidscan", PGC_USERSET, QUERY_TUNING_METHOD,
976  gettext_noop("Enables the planner's use of TID scan plans."),
977  NULL,
979  },
981  true,
982  NULL, NULL, NULL
983  },
984  {
985  {"enable_sort", PGC_USERSET, QUERY_TUNING_METHOD,
986  gettext_noop("Enables the planner's use of explicit sort steps."),
987  NULL,
989  },
990  &enable_sort,
991  true,
992  NULL, NULL, NULL
993  },
994  {
995  {"enable_hashagg", PGC_USERSET, QUERY_TUNING_METHOD,
996  gettext_noop("Enables the planner's use of hashed aggregation plans."),
997  NULL,
999  },
1000  &enable_hashagg,
1001  true,
1002  NULL, NULL, NULL
1003  },
1004  {
1005  {"enable_hashagg_disk", PGC_USERSET, QUERY_TUNING_METHOD,
1006  gettext_noop("Enables the planner's use of hashed aggregation plans that are expected to exceed work_mem."),
1007  NULL,
1008  GUC_EXPLAIN
1009  },
1011  true,
1012  NULL, NULL, NULL
1013  },
1014  {
1015  {"enable_groupingsets_hash_disk", PGC_USERSET, QUERY_TUNING_METHOD,
1016  gettext_noop("Enables the planner's use of hashed aggregation plans for groupingsets when the total size of the hash tables is expected to exceed work_mem."),
1017  NULL,
1018  GUC_EXPLAIN
1019  },
1021  false,
1022  NULL, NULL, NULL
1023  },
1024  {
1025  {"enable_material", PGC_USERSET, QUERY_TUNING_METHOD,
1026  gettext_noop("Enables the planner's use of materialization."),
1027  NULL,
1028  GUC_EXPLAIN
1029  },
1030  &enable_material,
1031  true,
1032  NULL, NULL, NULL
1033  },
1034  {
1035  {"enable_nestloop", PGC_USERSET, QUERY_TUNING_METHOD,
1036  gettext_noop("Enables the planner's use of nested-loop join plans."),
1037  NULL,
1038  GUC_EXPLAIN
1039  },
1040  &enable_nestloop,
1041  true,
1042  NULL, NULL, NULL
1043  },
1044  {
1045  {"enable_mergejoin", PGC_USERSET, QUERY_TUNING_METHOD,
1046  gettext_noop("Enables the planner's use of merge join plans."),
1047  NULL,
1048  GUC_EXPLAIN
1049  },
1051  true,
1052  NULL, NULL, NULL
1053  },
1054  {
1055  {"enable_hashjoin", PGC_USERSET, QUERY_TUNING_METHOD,
1056  gettext_noop("Enables the planner's use of hash join plans."),
1057  NULL,
1058  GUC_EXPLAIN
1059  },
1060  &enable_hashjoin,
1061  true,
1062  NULL, NULL, NULL
1063  },
1064  {
1065  {"enable_gathermerge", PGC_USERSET, QUERY_TUNING_METHOD,
1066  gettext_noop("Enables the planner's use of gather merge plans."),
1067  NULL,
1068  GUC_EXPLAIN
1069  },
1071  true,
1072  NULL, NULL, NULL
1073  },
1074  {
1075  {"enable_partitionwise_join", PGC_USERSET, QUERY_TUNING_METHOD,
1076  gettext_noop("Enables partitionwise join."),
1077  NULL,
1078  GUC_EXPLAIN
1079  },
1081  false,
1082  NULL, NULL, NULL
1083  },
1084  {
1085  {"enable_partitionwise_aggregate", PGC_USERSET, QUERY_TUNING_METHOD,
1086  gettext_noop("Enables partitionwise aggregation and grouping."),
1087  NULL,
1088  GUC_EXPLAIN
1089  },
1091  false,
1092  NULL, NULL, NULL
1093  },
1094  {
1095  {"enable_parallel_append", PGC_USERSET, QUERY_TUNING_METHOD,
1096  gettext_noop("Enables the planner's use of parallel append plans."),
1097  NULL,
1098  GUC_EXPLAIN
1099  },
1101  true,
1102  NULL, NULL, NULL
1103  },
1104  {
1105  {"enable_parallel_hash", PGC_USERSET, QUERY_TUNING_METHOD,
1106  gettext_noop("Enables the planner's use of parallel hash plans."),
1107  NULL,
1108  GUC_EXPLAIN
1109  },
1111  true,
1112  NULL, NULL, NULL
1113  },
1114  {
1115  {"enable_partition_pruning", PGC_USERSET, QUERY_TUNING_METHOD,
1116  gettext_noop("Enables plan-time and run-time partition pruning."),
1117  gettext_noop("Allows the query planner and executor to compare partition "
1118  "bounds to conditions in the query to determine which "
1119  "partitions must be scanned."),
1120  GUC_EXPLAIN
1121  },
1123  true,
1124  NULL, NULL, NULL
1125  },
1126  {
1127  {"geqo", PGC_USERSET, QUERY_TUNING_GEQO,
1128  gettext_noop("Enables genetic query optimization."),
1129  gettext_noop("This algorithm attempts to do planning without "
1130  "exhaustive searching."),
1131  GUC_EXPLAIN
1132  },
1133  &enable_geqo,
1134  true,
1135  NULL, NULL, NULL
1136  },
1137  {
1138  /* Not for general use --- used by SET SESSION AUTHORIZATION */
1139  {"is_superuser", PGC_INTERNAL, UNGROUPED,
1140  gettext_noop("Shows whether the current user is a superuser."),
1141  NULL,
1143  },
1145  false,
1146  NULL, NULL, NULL
1147  },
1148  {
1149  {"bonjour", PGC_POSTMASTER, CONN_AUTH_SETTINGS,
1150  gettext_noop("Enables advertising the server via Bonjour."),
1151  NULL
1152  },
1153  &enable_bonjour,
1154  false,
1155  check_bonjour, NULL, NULL
1156  },
1157  {
1158  {"track_commit_timestamp", PGC_POSTMASTER, REPLICATION,
1159  gettext_noop("Collects transaction commit time."),
1160  NULL
1161  },
1163  false,
1164  NULL, NULL, NULL
1165  },
1166  {
1167  {"ssl", PGC_SIGHUP, CONN_AUTH_SSL,
1168  gettext_noop("Enables SSL connections."),
1169  NULL
1170  },
1171  &EnableSSL,
1172  false,
1173  check_ssl, NULL, NULL
1174  },
1175  {
1176  {"ssl_passphrase_command_supports_reload", PGC_SIGHUP, CONN_AUTH_SSL,
1177  gettext_noop("Also use ssl_passphrase_command during server reload."),
1178  NULL
1179  },
1181  false,
1182  NULL, NULL, NULL
1183  },
1184  {
1185  {"ssl_prefer_server_ciphers", PGC_SIGHUP, CONN_AUTH_SSL,
1186  gettext_noop("Give priority to server ciphersuite order."),
1187  NULL
1188  },
1190  true,
1191  NULL, NULL, NULL
1192  },
1193  {
1194  {"fsync", PGC_SIGHUP, WAL_SETTINGS,
1195  gettext_noop("Forces synchronization of updates to disk."),
1196  gettext_noop("The server will use the fsync() system call in several places to make "
1197  "sure that updates are physically written to disk. This insures "
1198  "that a database cluster will recover to a consistent state after "
1199  "an operating system or hardware crash.")
1200  },
1201  &enableFsync,
1202  true,
1203  NULL, NULL, NULL
1204  },
1205  {
1206  {"ignore_checksum_failure", PGC_SUSET, DEVELOPER_OPTIONS,
1207  gettext_noop("Continues processing after a checksum failure."),
1208  gettext_noop("Detection of a checksum failure normally causes PostgreSQL to "
1209  "report an error, aborting the current transaction. Setting "
1210  "ignore_checksum_failure to true causes the system to ignore the failure "
1211  "(but still report a warning), and continue processing. This "
1212  "behavior could cause crashes or other serious problems. Only "
1213  "has an effect if checksums are enabled."),
1215  },
1217  false,
1218  NULL, NULL, NULL
1219  },
1220  {
1221  {"zero_damaged_pages", PGC_SUSET, DEVELOPER_OPTIONS,
1222  gettext_noop("Continues processing past damaged page headers."),
1223  gettext_noop("Detection of a damaged page header normally causes PostgreSQL to "
1224  "report an error, aborting the current transaction. Setting "
1225  "zero_damaged_pages to true causes the system to instead report a "
1226  "warning, zero out the damaged page, and continue processing. This "
1227  "behavior will destroy data, namely all the rows on the damaged page."),
1229  },
1231  false,
1232  NULL, NULL, NULL
1233  },
1234  {
1235  {"ignore_invalid_pages", PGC_POSTMASTER, DEVELOPER_OPTIONS,
1236  gettext_noop("Continues recovery after an invalid pages failure."),
1237  gettext_noop("Detection of WAL records having references to "
1238  "invalid pages during recovery causes PostgreSQL to "
1239  "raise a PANIC-level error, aborting the recovery. "
1240  "Setting ignore_invalid_pages to true causes "
1241  "the system to ignore invalid page references "
1242  "in WAL records (but still report a warning), "
1243  "and continue recovery. This behavior may cause "
1244  "crashes, data loss, propagate or hide corruption, "
1245  "or other serious problems. Only has an effect "
1246  "during recovery or in standby mode."),
1248  },
1250  false,
1251  NULL, NULL, NULL
1252  },
1253  {
1254  {"full_page_writes", PGC_SIGHUP, WAL_SETTINGS,
1255  gettext_noop("Writes full pages to WAL when first modified after a checkpoint."),
1256  gettext_noop("A page write in process during an operating system crash might be "
1257  "only partially written to disk. During recovery, the row changes "
1258  "stored in WAL are not enough to recover. This option writes "
1259  "pages when first modified after a checkpoint to WAL so full recovery "
1260  "is possible.")
1261  },
1262  &fullPageWrites,
1263  true,
1264  NULL, NULL, NULL
1265  },
1266 
1267  {
1268  {"wal_log_hints", PGC_POSTMASTER, WAL_SETTINGS,
1269  gettext_noop("Writes full pages to WAL when first modified after a checkpoint, even for a non-critical modifications."),
1270  NULL
1271  },
1272  &wal_log_hints,
1273  false,
1274  NULL, NULL, NULL
1275  },
1276 
1277  {
1278  {"wal_compression", PGC_SUSET, WAL_SETTINGS,
1279  gettext_noop("Compresses full-page writes written in WAL file."),
1280  NULL
1281  },
1282  &wal_compression,
1283  false,
1284  NULL, NULL, NULL
1285  },
1286 
1287  {
1288  {"wal_init_zero", PGC_SUSET, WAL_SETTINGS,
1289  gettext_noop("Writes zeroes to new WAL files before first use."),
1290  NULL
1291  },
1292  &wal_init_zero,
1293  true,
1294  NULL, NULL, NULL
1295  },
1296 
1297  {
1298  {"wal_recycle", PGC_SUSET, WAL_SETTINGS,
1299  gettext_noop("Recycles WAL files by renaming them."),
1300  NULL
1301  },
1302  &wal_recycle,
1303  true,
1304  NULL, NULL, NULL
1305  },
1306 
1307  {
1308  {"log_checkpoints", PGC_SIGHUP, LOGGING_WHAT,
1309  gettext_noop("Logs each checkpoint."),
1310  NULL
1311  },
1312  &log_checkpoints,
1313  false,
1314  NULL, NULL, NULL
1315  },
1316  {
1317  {"log_connections", PGC_SU_BACKEND, LOGGING_WHAT,
1318  gettext_noop("Logs each successful connection."),
1319  NULL
1320  },
1321  &Log_connections,
1322  false,
1323  NULL, NULL, NULL
1324  },
1325  {
1326  {"log_disconnections", PGC_SU_BACKEND, LOGGING_WHAT,
1327  gettext_noop("Logs end of a session, including duration."),
1328  NULL
1329  },
1331  false,
1332  NULL, NULL, NULL
1333  },
1334  {
1335  {"log_replication_commands", PGC_SUSET, LOGGING_WHAT,
1336  gettext_noop("Logs each replication command."),
1337  NULL
1338  },
1340  false,
1341  NULL, NULL, NULL
1342  },
1343  {
1344  {"debug_assertions", PGC_INTERNAL, PRESET_OPTIONS,
1345  gettext_noop("Shows whether the running server has assertion checks enabled."),
1346  NULL,
1348  },
1349  &assert_enabled,
1350 #ifdef USE_ASSERT_CHECKING
1351  true,
1352 #else
1353  false,
1354 #endif
1355  NULL, NULL, NULL
1356  },
1357 
1358  {
1359  {"exit_on_error", PGC_USERSET, ERROR_HANDLING_OPTIONS,
1360  gettext_noop("Terminate session on any error."),
1361  NULL
1362  },
1363  &ExitOnAnyError,
1364  false,
1365  NULL, NULL, NULL
1366  },
1367  {
1368  {"restart_after_crash", PGC_SIGHUP, ERROR_HANDLING_OPTIONS,
1369  gettext_noop("Reinitialize server after backend crash."),
1370  NULL
1371  },
1373  true,
1374  NULL, NULL, NULL
1375  },
1376 
1377  {
1378  {"log_duration", PGC_SUSET, LOGGING_WHAT,
1379  gettext_noop("Logs the duration of each completed SQL statement."),
1380  NULL
1381  },
1382  &log_duration,
1383  false,
1384  NULL, NULL, NULL
1385  },
1386  {
1387  {"debug_print_parse", PGC_USERSET, LOGGING_WHAT,
1388  gettext_noop("Logs each query's parse tree."),
1389  NULL
1390  },
1392  false,
1393  NULL, NULL, NULL
1394  },
1395  {
1396  {"debug_print_rewritten", PGC_USERSET, LOGGING_WHAT,
1397  gettext_noop("Logs each query's rewritten parse tree."),
1398  NULL
1399  },
1401  false,
1402  NULL, NULL, NULL
1403  },
1404  {
1405  {"debug_print_plan", PGC_USERSET, LOGGING_WHAT,
1406  gettext_noop("Logs each query's execution plan."),
1407  NULL
1408  },
1410  false,
1411  NULL, NULL, NULL
1412  },
1413  {
1414  {"debug_pretty_print", PGC_USERSET, LOGGING_WHAT,
1415  gettext_noop("Indents parse and plan tree displays."),
1416  NULL
1417  },
1419  true,
1420  NULL, NULL, NULL
1421  },
1422  {
1423  {"log_parser_stats", PGC_SUSET, STATS_MONITORING,
1424  gettext_noop("Writes parser performance statistics to the server log."),
1425  NULL
1426  },
1428  false,
1429  check_stage_log_stats, NULL, NULL
1430  },
1431  {
1432  {"log_planner_stats", PGC_SUSET, STATS_MONITORING,
1433  gettext_noop("Writes planner performance statistics to the server log."),
1434  NULL
1435  },
1437  false,
1438  check_stage_log_stats, NULL, NULL
1439  },
1440  {
1441  {"log_executor_stats", PGC_SUSET, STATS_MONITORING,
1442  gettext_noop("Writes executor performance statistics to the server log."),
1443  NULL
1444  },
1446  false,
1447  check_stage_log_stats, NULL, NULL
1448  },
1449  {
1450  {"log_statement_stats", PGC_SUSET, STATS_MONITORING,
1451  gettext_noop("Writes cumulative performance statistics to the server log."),
1452  NULL
1453  },
1455  false,
1456  check_log_stats, NULL, NULL
1457  },
1458 #ifdef BTREE_BUILD_STATS
1459  {
1460  {"log_btree_build_stats", PGC_SUSET, DEVELOPER_OPTIONS,
1461  gettext_noop("Logs system resource usage statistics (memory and CPU) on various B-tree operations."),
1462  NULL,
1464  },
1466  false,
1467  NULL, NULL, NULL
1468  },
1469 #endif
1470 
1471  {
1472  {"track_activities", PGC_SUSET, STATS_COLLECTOR,
1473  gettext_noop("Collects information about executing commands."),
1474  gettext_noop("Enables the collection of information on the currently "
1475  "executing command of each session, along with "
1476  "the time at which that command began execution.")
1477  },
1479  true,
1480  NULL, NULL, NULL
1481  },
1482  {
1483  {"track_counts", PGC_SUSET, STATS_COLLECTOR,
1484  gettext_noop("Collects statistics on database activity."),
1485  NULL
1486  },
1488  true,
1489  NULL, NULL, NULL
1490  },
1491  {
1492  {"track_io_timing", PGC_SUSET, STATS_COLLECTOR,
1493  gettext_noop("Collects timing statistics for database I/O activity."),
1494  NULL
1495  },
1496  &track_io_timing,
1497  false,
1498  NULL, NULL, NULL
1499  },
1500 
1501  {
1502  {"update_process_title", PGC_SUSET, PROCESS_TITLE,
1503  gettext_noop("Updates the process title to show the active SQL command."),
1504  gettext_noop("Enables updating of the process title every time a new SQL command is received by the server.")
1505  },
1507 #ifdef WIN32
1508  false,
1509 #else
1510  true,
1511 #endif
1512  NULL, NULL, NULL
1513  },
1514 
1515  {
1516  {"autovacuum", PGC_SIGHUP, AUTOVACUUM,
1517  gettext_noop("Starts the autovacuum subprocess."),
1518  NULL
1519  },
1521  true,
1522  NULL, NULL, NULL
1523  },
1524 
1525  {
1526  {"trace_notify", PGC_USERSET, DEVELOPER_OPTIONS,
1527  gettext_noop("Generates debugging output for LISTEN and NOTIFY."),
1528  NULL,
1530  },
1531  &Trace_notify,
1532  false,
1533  NULL, NULL, NULL
1534  },
1535 
1536 #ifdef LOCK_DEBUG
1537  {
1538  {"trace_locks", PGC_SUSET, DEVELOPER_OPTIONS,
1539  gettext_noop("Emits information about lock usage."),
1540  NULL,
1542  },
1543  &Trace_locks,
1544  false,
1545  NULL, NULL, NULL
1546  },
1547  {
1548  {"trace_userlocks", PGC_SUSET, DEVELOPER_OPTIONS,
1549  gettext_noop("Emits information about user lock usage."),
1550  NULL,
1552  },
1553  &Trace_userlocks,
1554  false,
1555  NULL, NULL, NULL
1556  },
1557  {
1558  {"trace_lwlocks", PGC_SUSET, DEVELOPER_OPTIONS,
1559  gettext_noop("Emits information about lightweight lock usage."),
1560  NULL,
1562  },
1563  &Trace_lwlocks,
1564  false,
1565  NULL, NULL, NULL
1566  },
1567  {
1568  {"debug_deadlocks", PGC_SUSET, DEVELOPER_OPTIONS,
1569  gettext_noop("Dumps information about all current locks when a deadlock timeout occurs."),
1570  NULL,
1572  },
1573  &Debug_deadlocks,
1574  false,
1575  NULL, NULL, NULL
1576  },
1577 #endif
1578 
1579  {
1580  {"log_lock_waits", PGC_SUSET, LOGGING_WHAT,
1581  gettext_noop("Logs long lock waits."),
1582  NULL
1583  },
1584  &log_lock_waits,
1585  false,
1586  NULL, NULL, NULL
1587  },
1588 
1589  {
1590  {"log_hostname", PGC_SIGHUP, LOGGING_WHAT,
1591  gettext_noop("Logs the host name in the connection logs."),
1592  gettext_noop("By default, connection logs only show the IP address "
1593  "of the connecting host. If you want them to show the host name you "
1594  "can turn this on, but depending on your host name resolution "
1595  "setup it might impose a non-negligible performance penalty.")
1596  },
1597  &log_hostname,
1598  false,
1599  NULL, NULL, NULL
1600  },
1601  {
1602  {"transform_null_equals", PGC_USERSET, COMPAT_OPTIONS_CLIENT,
1603  gettext_noop("Treats \"expr=NULL\" as \"expr IS NULL\"."),
1604  gettext_noop("When turned on, expressions of the form expr = NULL "
1605  "(or NULL = expr) are treated as expr IS NULL, that is, they "
1606  "return true if expr evaluates to the null value, and false "
1607  "otherwise. The correct behavior of expr = NULL is to always "
1608  "return null (unknown).")
1609  },
1611  false,
1612  NULL, NULL, NULL
1613  },
1614  {
1615  {"db_user_namespace", PGC_SIGHUP, CONN_AUTH_AUTH,
1616  gettext_noop("Enables per-database user names."),
1617  NULL
1618  },
1620  false,
1621  NULL, NULL, NULL
1622  },
1623  {
1624  {"default_transaction_read_only", PGC_USERSET, CLIENT_CONN_STATEMENT,
1625  gettext_noop("Sets the default read-only status of new transactions."),
1626  NULL
1627  },
1629  false,
1630  NULL, NULL, NULL
1631  },
1632  {
1633  {"transaction_read_only", PGC_USERSET, CLIENT_CONN_STATEMENT,
1634  gettext_noop("Sets the current transaction's read-only status."),
1635  NULL,
1637  },
1638  &XactReadOnly,
1639  false,
1640  check_transaction_read_only, NULL, NULL
1641  },
1642  {
1643  {"default_transaction_deferrable", PGC_USERSET, CLIENT_CONN_STATEMENT,
1644  gettext_noop("Sets the default deferrable status of new transactions."),
1645  NULL
1646  },
1648  false,
1649  NULL, NULL, NULL
1650  },
1651  {
1652  {"transaction_deferrable", PGC_USERSET, CLIENT_CONN_STATEMENT,
1653  gettext_noop("Whether to defer a read-only serializable transaction until it can be executed with no possible serialization failures."),
1654  NULL,
1656  },
1657  &XactDeferrable,
1658  false,
1659  check_transaction_deferrable, NULL, NULL
1660  },
1661  {
1662  {"row_security", PGC_USERSET, CLIENT_CONN_STATEMENT,
1663  gettext_noop("Enable row security."),
1664  gettext_noop("When enabled, row security will be applied to all users.")
1665  },
1666  &row_security,
1667  true,
1668  NULL, NULL, NULL
1669  },
1670  {
1671  {"check_function_bodies", PGC_USERSET, CLIENT_CONN_STATEMENT,
1672  gettext_noop("Check function bodies during CREATE FUNCTION."),
1673  NULL
1674  },
1676  true,
1677  NULL, NULL, NULL
1678  },
1679  {
1680  {"array_nulls", PGC_USERSET, COMPAT_OPTIONS_PREVIOUS,
1681  gettext_noop("Enable input of NULL elements in arrays."),
1682  gettext_noop("When turned on, unquoted NULL in an array input "
1683  "value means a null value; "
1684  "otherwise it is taken literally.")
1685  },
1686  &Array_nulls,
1687  true,
1688  NULL, NULL, NULL
1689  },
1690 
1691  /*
1692  * WITH OIDS support, and consequently default_with_oids, was removed in
1693  * PostgreSQL 12, but we tolerate the parameter being set to false to
1694  * avoid unnecessarily breaking older dump files.
1695  */
1696  {
1697  {"default_with_oids", PGC_USERSET, COMPAT_OPTIONS_PREVIOUS,
1698  gettext_noop("WITH OIDS is no longer supported; this can only be false."),
1699  NULL,
1701  },
1703  false,
1704  check_default_with_oids, NULL, NULL
1705  },
1706  {
1707  {"logging_collector", PGC_POSTMASTER, LOGGING_WHERE,
1708  gettext_noop("Start a subprocess to capture stderr output and/or csvlogs into log files."),
1709  NULL
1710  },
1712  false,
1713  NULL, NULL, NULL
1714  },
1715  {
1716  {"log_truncate_on_rotation", PGC_SIGHUP, LOGGING_WHERE,
1717  gettext_noop("Truncate existing log files of same name during log rotation."),
1718  NULL
1719  },
1721  false,
1722  NULL, NULL, NULL
1723  },
1724 
1725 #ifdef TRACE_SORT
1726  {
1727  {"trace_sort", PGC_USERSET, DEVELOPER_OPTIONS,
1728  gettext_noop("Emit information about resource usage in sorting."),
1729  NULL,
1731  },
1732  &trace_sort,
1733  false,
1734  NULL, NULL, NULL
1735  },
1736 #endif
1737 
1738 #ifdef TRACE_SYNCSCAN
1739  /* this is undocumented because not exposed in a standard build */
1740  {
1741  {"trace_syncscan", PGC_USERSET, DEVELOPER_OPTIONS,
1742  gettext_noop("Generate debugging output for synchronized scanning."),
1743  NULL,
1745  },
1746  &trace_syncscan,
1747  false,
1748  NULL, NULL, NULL
1749  },
1750 #endif
1751 
1752 #ifdef DEBUG_BOUNDED_SORT
1753  /* this is undocumented because not exposed in a standard build */
1754  {
1755  {
1756  "optimize_bounded_sort", PGC_USERSET, QUERY_TUNING_METHOD,
1757  gettext_noop("Enable bounded sorting using heap sort."),
1758  NULL,
1760  },
1761  &optimize_bounded_sort,
1762  true,
1763  NULL, NULL, NULL
1764  },
1765 #endif
1766 
1767 #ifdef WAL_DEBUG
1768  {
1769  {"wal_debug", PGC_SUSET, DEVELOPER_OPTIONS,
1770  gettext_noop("Emit WAL-related debugging output."),
1771  NULL,
1773  },
1774  &XLOG_DEBUG,
1775  false,
1776  NULL, NULL, NULL
1777  },
1778 #endif
1779 
1780  {
1781  {"integer_datetimes", PGC_INTERNAL, PRESET_OPTIONS,
1782  gettext_noop("Datetimes are integer based."),
1783  NULL,
1785  },
1787  true,
1788  NULL, NULL, NULL
1789  },
1790 
1791  {
1792  {"krb_caseins_users", PGC_SIGHUP, CONN_AUTH_AUTH,
1793  gettext_noop("Sets whether Kerberos and GSSAPI user names should be treated as case-insensitive."),
1794  NULL
1795  },
1797  false,
1798  NULL, NULL, NULL
1799  },
1800 
1801  {
1802  {"escape_string_warning", PGC_USERSET, COMPAT_OPTIONS_PREVIOUS,
1803  gettext_noop("Warn about backslash escapes in ordinary string literals."),
1804  NULL
1805  },
1807  true,
1808  NULL, NULL, NULL
1809  },
1810 
1811  {
1812  {"standard_conforming_strings", PGC_USERSET, COMPAT_OPTIONS_PREVIOUS,
1813  gettext_noop("Causes '...' strings to treat backslashes literally."),
1814  NULL,
1815  GUC_REPORT
1816  },
1818  true,
1819  NULL, NULL, NULL
1820  },
1821 
1822  {
1823  {"synchronize_seqscans", PGC_USERSET, COMPAT_OPTIONS_PREVIOUS,
1824  gettext_noop("Enable synchronized sequential scans."),
1825  NULL
1826  },
1828  true,
1829  NULL, NULL, NULL
1830  },
1831 
1832  {
1833  {"recovery_target_inclusive", PGC_POSTMASTER, WAL_RECOVERY_TARGET,
1834  gettext_noop("Sets whether to include or exclude transaction with recovery target."),
1835  NULL
1836  },
1838  true,
1839  NULL, NULL, NULL
1840  },
1841 
1842  {
1843  {"hot_standby", PGC_POSTMASTER, REPLICATION_STANDBY,
1844  gettext_noop("Allows connections and queries during recovery."),
1845  NULL
1846  },
1848  true,
1849  NULL, NULL, NULL
1850  },
1851 
1852  {
1853  {"hot_standby_feedback", PGC_SIGHUP, REPLICATION_STANDBY,
1854  gettext_noop("Allows feedback from a hot standby to the primary that will avoid query conflicts."),
1855  NULL
1856  },
1858  false,
1859  NULL, NULL, NULL
1860  },
1861 
1862  {
1863  {"allow_system_table_mods", PGC_SUSET, DEVELOPER_OPTIONS,
1864  gettext_noop("Allows modifications of the structure of system tables."),
1865  NULL,
1867  },
1869  false,
1870  NULL, NULL, NULL
1871  },
1872 
1873  {
1874  {"ignore_system_indexes", PGC_BACKEND, DEVELOPER_OPTIONS,
1875  gettext_noop("Disables reading from system indexes."),
1876  gettext_noop("It does not prevent updating the indexes, so it is safe "
1877  "to use. The worst consequence is slowness."),
1879  },
1881  false,
1882  NULL, NULL, NULL
1883  },
1884 
1885  {
1886  {"lo_compat_privileges", PGC_SUSET, COMPAT_OPTIONS_PREVIOUS,
1887  gettext_noop("Enables backward compatibility mode for privilege checks on large objects."),
1888  gettext_noop("Skips privilege checks when reading or modifying large objects, "
1889  "for compatibility with PostgreSQL releases prior to 9.0.")
1890  },
1892  false,
1893  NULL, NULL, NULL
1894  },
1895 
1896  {
1897  {"operator_precedence_warning", PGC_USERSET, COMPAT_OPTIONS_PREVIOUS,
1898  gettext_noop("Emit a warning for constructs that changed meaning since PostgreSQL 9.4."),
1899  NULL,
1900  },
1902  false,
1903  NULL, NULL, NULL
1904  },
1905 
1906  {
1907  {"quote_all_identifiers", PGC_USERSET, COMPAT_OPTIONS_PREVIOUS,
1908  gettext_noop("When generating SQL fragments, quote all identifiers."),
1909  NULL,
1910  },
1912  false,
1913  NULL, NULL, NULL
1914  },
1915 
1916  {
1917  {"data_checksums", PGC_INTERNAL, PRESET_OPTIONS,
1918  gettext_noop("Shows whether data checksums are turned on for this cluster."),
1919  NULL,
1921  },
1922  &data_checksums,
1923  false,
1924  NULL, NULL, NULL
1925  },
1926 
1927  {
1928  {"syslog_sequence_numbers", PGC_SIGHUP, LOGGING_WHERE,
1929  gettext_noop("Add sequence number to syslog messages to avoid duplicate suppression."),
1930  NULL
1931  },
1933  true,
1934  NULL, NULL, NULL
1935  },
1936 
1937  {
1938  {"syslog_split_messages", PGC_SIGHUP, LOGGING_WHERE,
1939  gettext_noop("Split messages sent to syslog by lines and to fit into 1024 bytes."),
1940  NULL
1941  },
1943  true,
1944  NULL, NULL, NULL
1945  },
1946 
1947  {
1948  {"parallel_leader_participation", PGC_USERSET, RESOURCES_ASYNCHRONOUS,
1949  gettext_noop("Controls whether Gather and Gather Merge also run subplans."),
1950  gettext_noop("Should gather nodes also run subplans, or just gather tuples?"),
1951  GUC_EXPLAIN
1952  },
1954  true,
1955  NULL, NULL, NULL
1956  },
1957 
1958  {
1960  gettext_noop("Allow JIT compilation."),
1961  NULL,
1962  GUC_EXPLAIN
1963  },
1964  &jit_enabled,
1965  true,
1966  NULL, NULL, NULL
1967  },
1968 
1969  {
1970  {"jit_debugging_support", PGC_SU_BACKEND, DEVELOPER_OPTIONS,
1971  gettext_noop("Register JIT compiled function with debugger."),
1972  NULL,
1974  },
1976  false,
1977 
1978  /*
1979  * This is not guaranteed to be available, but given it's a developer
1980  * oriented option, it doesn't seem worth adding code checking
1981  * availability.
1982  */
1983  NULL, NULL, NULL
1984  },
1985 
1986  {
1987  {"jit_dump_bitcode", PGC_SUSET, DEVELOPER_OPTIONS,
1988  gettext_noop("Write out LLVM bitcode to facilitate JIT debugging."),
1989  NULL,
1991  },
1993  false,
1994  NULL, NULL, NULL
1995  },
1996 
1997  {
1998  {"jit_expressions", PGC_USERSET, DEVELOPER_OPTIONS,
1999  gettext_noop("Allow JIT compilation of expressions."),
2000  NULL,
2002  },
2003  &jit_expressions,
2004  true,
2005  NULL, NULL, NULL
2006  },
2007 
2008  {
2009  {"jit_profiling_support", PGC_SU_BACKEND, DEVELOPER_OPTIONS,
2010  gettext_noop("Register JIT compiled function with perf profiler."),
2011  NULL,
2013  },
2015  false,
2016 
2017  /*
2018  * This is not guaranteed to be available, but given it's a developer
2019  * oriented option, it doesn't seem worth adding code checking
2020  * availability.
2021  */
2022  NULL, NULL, NULL
2023  },
2024 
2025  {
2026  {"jit_tuple_deforming", PGC_USERSET, DEVELOPER_OPTIONS,
2027  gettext_noop("Allow JIT compilation of tuple deforming."),
2028  NULL,
2030  },
2032  true,
2033  NULL, NULL, NULL
2034  },
2035 
2036  {
2037  {"data_sync_retry", PGC_POSTMASTER, ERROR_HANDLING_OPTIONS,
2038  gettext_noop("Whether to continue running after a failure to sync data files."),
2039  },
2040  &data_sync_retry,
2041  false,
2042  NULL, NULL, NULL
2043  },
2044 
2045  {
2046  {"wal_receiver_create_temp_slot", PGC_SIGHUP, REPLICATION_STANDBY,
2047  gettext_noop("Sets whether a WAL receiver should create a temporary replication slot if no permanent slot is configured."),
2048  },
2050  false,
2051  NULL, NULL, NULL
2052  },
2053 
2054  /* End-of-list marker */
2055  {
2056  {NULL, 0, 0, NULL, NULL}, NULL, false, NULL, NULL, NULL
2057  }
2058 };
2059 
2060 
2062 {
2063  {
2064  {"archive_timeout", PGC_SIGHUP, WAL_ARCHIVING,
2065  gettext_noop("Forces a switch to the next WAL file if a "
2066  "new file has not been started within N seconds."),
2067  NULL,
2068  GUC_UNIT_S
2069  },
2071  0, 0, INT_MAX / 2,
2072  NULL, NULL, NULL
2073  },
2074  {
2075  {"post_auth_delay", PGC_BACKEND, DEVELOPER_OPTIONS,
2076  gettext_noop("Waits N seconds on connection startup after authentication."),
2077  gettext_noop("This allows attaching a debugger to the process."),
2079  },
2080  &PostAuthDelay,
2081  0, 0, INT_MAX / 1000000,
2082  NULL, NULL, NULL
2083  },
2084  {
2085  {"default_statistics_target", PGC_USERSET, QUERY_TUNING_OTHER,
2086  gettext_noop("Sets the default statistics target."),
2087  gettext_noop("This applies to table columns that have not had a "
2088  "column-specific target set via ALTER TABLE SET STATISTICS.")
2089  },
2091  100, 1, 10000,
2092  NULL, NULL, NULL
2093  },
2094  {
2095  {"from_collapse_limit", PGC_USERSET, QUERY_TUNING_OTHER,
2096  gettext_noop("Sets the FROM-list size beyond which subqueries "
2097  "are not collapsed."),
2098  gettext_noop("The planner will merge subqueries into upper "
2099  "queries if the resulting FROM list would have no more than "
2100  "this many items."),
2101  GUC_EXPLAIN
2102  },
2104  8, 1, INT_MAX,
2105  NULL, NULL, NULL
2106  },
2107  {
2108  {"join_collapse_limit", PGC_USERSET, QUERY_TUNING_OTHER,
2109  gettext_noop("Sets the FROM-list size beyond which JOIN "
2110  "constructs are not flattened."),
2111  gettext_noop("The planner will flatten explicit JOIN "
2112  "constructs into lists of FROM items whenever a "
2113  "list of no more than this many items would result."),
2114  GUC_EXPLAIN
2115  },
2117  8, 1, INT_MAX,
2118  NULL, NULL, NULL
2119  },
2120  {
2121  {"geqo_threshold", PGC_USERSET, QUERY_TUNING_GEQO,
2122  gettext_noop("Sets the threshold of FROM items beyond which GEQO is used."),
2123  NULL,
2124  GUC_EXPLAIN
2125  },
2126  &geqo_threshold,
2127  12, 2, INT_MAX,
2128  NULL, NULL, NULL
2129  },
2130  {
2131  {"geqo_effort", PGC_USERSET, QUERY_TUNING_GEQO,
2132  gettext_noop("GEQO: effort is used to set the default for other GEQO parameters."),
2133  NULL,
2134  GUC_EXPLAIN
2135  },
2136  &Geqo_effort,
2138  NULL, NULL, NULL
2139  },
2140  {
2141  {"geqo_pool_size", PGC_USERSET, QUERY_TUNING_GEQO,
2142  gettext_noop("GEQO: number of individuals in the population."),
2143  gettext_noop("Zero selects a suitable default value."),
2144  GUC_EXPLAIN
2145  },
2146  &Geqo_pool_size,
2147  0, 0, INT_MAX,
2148  NULL, NULL, NULL
2149  },
2150  {
2151  {"geqo_generations", PGC_USERSET, QUERY_TUNING_GEQO,
2152  gettext_noop("GEQO: number of iterations of the algorithm."),
2153  gettext_noop("Zero selects a suitable default value."),
2154  GUC_EXPLAIN
2155  },
2157  0, 0, INT_MAX,
2158  NULL, NULL, NULL
2159  },
2160 
2161  {
2162  /* This is PGC_SUSET to prevent hiding from log_lock_waits. */
2163  {"deadlock_timeout", PGC_SUSET, LOCK_MANAGEMENT,
2164  gettext_noop("Sets the time to wait on a lock before checking for deadlock."),
2165  NULL,
2166  GUC_UNIT_MS
2167  },
2168  &DeadlockTimeout,
2169  1000, 1, INT_MAX,
2170  NULL, NULL, NULL
2171  },
2172 
2173  {
2174  {"max_standby_archive_delay", PGC_SIGHUP, REPLICATION_STANDBY,
2175  gettext_noop("Sets the maximum delay before canceling queries when a hot standby server is processing archived WAL data."),
2176  NULL,
2177  GUC_UNIT_MS
2178  },
2180  30 * 1000, -1, INT_MAX,
2181  NULL, NULL, NULL
2182  },
2183 
2184  {
2185  {"max_standby_streaming_delay", PGC_SIGHUP, REPLICATION_STANDBY,
2186  gettext_noop("Sets the maximum delay before canceling queries when a hot standby server is processing streamed WAL data."),
2187  NULL,
2188  GUC_UNIT_MS
2189  },
2191  30 * 1000, -1, INT_MAX,
2192  NULL, NULL, NULL
2193  },
2194 
2195  {
2196  {"recovery_min_apply_delay", PGC_SIGHUP, REPLICATION_STANDBY,
2197  gettext_noop("Sets the minimum delay for applying changes during recovery."),
2198  NULL,
2199  GUC_UNIT_MS
2200  },
2202  0, 0, INT_MAX,
2203  NULL, NULL, NULL
2204  },
2205 
2206  {
2207  {"wal_receiver_status_interval", PGC_SIGHUP, REPLICATION_STANDBY,
2208  gettext_noop("Sets the maximum interval between WAL receiver status reports to the sending server."),
2209  NULL,
2210  GUC_UNIT_S
2211  },
2213  10, 0, INT_MAX / 1000,
2214  NULL, NULL, NULL
2215  },
2216 
2217  {
2218  {"wal_receiver_timeout", PGC_SIGHUP, REPLICATION_STANDBY,
2219  gettext_noop("Sets the maximum wait time to receive data from the sending server."),
2220  NULL,
2221  GUC_UNIT_MS
2222  },
2224  60 * 1000, 0, INT_MAX,
2225  NULL, NULL, NULL
2226  },
2227 
2228  {
2229  {"max_connections", PGC_POSTMASTER, CONN_AUTH_SETTINGS,
2230  gettext_noop("Sets the maximum number of concurrent connections."),
2231  NULL
2232  },
2233  &MaxConnections,
2234  100, 1, MAX_BACKENDS,
2235  check_maxconnections, NULL, NULL
2236  },
2237 
2238  {
2239  /* see max_connections */
2240  {"superuser_reserved_connections", PGC_POSTMASTER, CONN_AUTH_SETTINGS,
2241  gettext_noop("Sets the number of connection slots reserved for superusers."),
2242  NULL
2243  },
2245  3, 0, MAX_BACKENDS,
2246  NULL, NULL, NULL
2247  },
2248 
2249  /*
2250  * We sometimes multiply the number of shared buffers by two without
2251  * checking for overflow, so we mustn't allow more than INT_MAX / 2.
2252  */
2253  {
2254  {"shared_buffers", PGC_POSTMASTER, RESOURCES_MEM,
2255  gettext_noop("Sets the number of shared memory buffers used by the server."),
2256  NULL,
2258  },
2259  &NBuffers,
2260  1024, 16, INT_MAX / 2,
2261  NULL, NULL, NULL
2262  },
2263 
2264  {
2265  {"temp_buffers", PGC_USERSET, RESOURCES_MEM,
2266  gettext_noop("Sets the maximum number of temporary buffers used by each session."),
2267  NULL,
2269  },
2271  1024, 100, INT_MAX / 2,
2272  check_temp_buffers, NULL, NULL
2273  },
2274 
2275  {
2277  gettext_noop("Sets the TCP port the server listens on."),
2278  NULL
2279  },
2280  &PostPortNumber,
2281  DEF_PGPORT, 1, 65535,
2282  NULL, NULL, NULL
2283  },
2284 
2285  {
2286  {"unix_socket_permissions", PGC_POSTMASTER, CONN_AUTH_SETTINGS,
2287  gettext_noop("Sets the access permissions of the Unix-domain socket."),
2288  gettext_noop("Unix-domain sockets use the usual Unix file system "
2289  "permission set. The parameter value is expected "
2290  "to be a numeric mode specification in the form "
2291  "accepted by the chmod and umask system calls. "
2292  "(To use the customary octal format the number must "
2293  "start with a 0 (zero).)")
2294  },
2296  0777, 0000, 0777,
2297  NULL, NULL, show_unix_socket_permissions
2298  },
2299 
2300  {
2301  {"log_file_mode", PGC_SIGHUP, LOGGING_WHERE,
2302  gettext_noop("Sets the file permissions for log files."),
2303  gettext_noop("The parameter value is expected "
2304  "to be a numeric mode specification in the form "
2305  "accepted by the chmod and umask system calls. "
2306  "(To use the customary octal format the number must "
2307  "start with a 0 (zero).)")
2308  },
2309  &Log_file_mode,
2310  0600, 0000, 0777,
2311  NULL, NULL, show_log_file_mode
2312  },
2313 
2314 
2315  {
2316  {"data_directory_mode", PGC_INTERNAL, PRESET_OPTIONS,
2317  gettext_noop("Mode of the data directory."),
2318  gettext_noop("The parameter value is a numeric mode specification "
2319  "in the form accepted by the chmod and umask system "
2320  "calls. (To use the customary octal format the number "
2321  "must start with a 0 (zero).)"),
2323  },
2325  0700, 0000, 0777,
2326  NULL, NULL, show_data_directory_mode
2327  },
2328 
2329  {
2330  {"work_mem", PGC_USERSET, RESOURCES_MEM,
2331  gettext_noop("Sets the maximum memory to be used for query workspaces."),
2332  gettext_noop("This much memory can be used by each internal "
2333  "sort operation and hash table before switching to "
2334  "temporary disk files."),
2336  },
2337  &work_mem,
2338  4096, 64, MAX_KILOBYTES,
2339  NULL, NULL, NULL
2340  },
2341 
2342  {
2343  {"maintenance_work_mem", PGC_USERSET, RESOURCES_MEM,
2344  gettext_noop("Sets the maximum memory to be used for maintenance operations."),
2345  gettext_noop("This includes operations such as VACUUM and CREATE INDEX."),
2346  GUC_UNIT_KB
2347  },
2349  65536, 1024, MAX_KILOBYTES,
2350  NULL, NULL, NULL
2351  },
2352 
2353  {
2354  {"logical_decoding_work_mem", PGC_USERSET, RESOURCES_MEM,
2355  gettext_noop("Sets the maximum memory to be used for logical decoding."),
2356  gettext_noop("This much memory can be used by each internal "
2357  "reorder buffer before spilling to disk."),
2358  GUC_UNIT_KB
2359  },
2361  65536, 64, MAX_KILOBYTES,
2362  NULL, NULL, NULL
2363  },
2364 
2365  /*
2366  * We use the hopefully-safely-small value of 100kB as the compiled-in
2367  * default for max_stack_depth. InitializeGUCOptions will increase it if
2368  * possible, depending on the actual platform-specific stack limit.
2369  */
2370  {
2371  {"max_stack_depth", PGC_SUSET, RESOURCES_MEM,
2372  gettext_noop("Sets the maximum stack depth, in kilobytes."),
2373  NULL,
2374  GUC_UNIT_KB
2375  },
2376  &max_stack_depth,
2377  100, 100, MAX_KILOBYTES,
2379  },
2380 
2381  {
2382  {"temp_file_limit", PGC_SUSET, RESOURCES_DISK,
2383  gettext_noop("Limits the total size of all temporary files used by each process."),
2384  gettext_noop("-1 means no limit."),
2385  GUC_UNIT_KB
2386  },
2387  &temp_file_limit,
2388  -1, -1, INT_MAX,
2389  NULL, NULL, NULL
2390  },
2391 
2392  {
2393  {"vacuum_cost_page_hit", PGC_USERSET, RESOURCES_VACUUM_DELAY,
2394  gettext_noop("Vacuum cost for a page found in the buffer cache."),
2395  NULL
2396  },
2398  1, 0, 10000,
2399  NULL, NULL, NULL
2400  },
2401 
2402  {
2403  {"vacuum_cost_page_miss", PGC_USERSET, RESOURCES_VACUUM_DELAY,
2404  gettext_noop("Vacuum cost for a page not found in the buffer cache."),
2405  NULL
2406  },
2408  10, 0, 10000,
2409  NULL, NULL, NULL
2410  },
2411 
2412  {
2413  {"vacuum_cost_page_dirty", PGC_USERSET, RESOURCES_VACUUM_DELAY,
2414  gettext_noop("Vacuum cost for a page dirtied by vacuum."),
2415  NULL
2416  },
2418  20, 0, 10000,
2419  NULL, NULL, NULL
2420  },
2421 
2422  {
2423  {"vacuum_cost_limit", PGC_USERSET, RESOURCES_VACUUM_DELAY,
2424  gettext_noop("Vacuum cost amount available before napping."),
2425  NULL
2426  },
2427  &VacuumCostLimit,
2428  200, 1, 10000,
2429  NULL, NULL, NULL
2430  },
2431 
2432  {
2433  {"autovacuum_vacuum_cost_limit", PGC_SIGHUP, AUTOVACUUM,
2434  gettext_noop("Vacuum cost amount available before napping, for autovacuum."),
2435  NULL
2436  },
2438  -1, -1, 10000,
2439  NULL, NULL, NULL
2440  },
2441 
2442  {
2443  {"max_files_per_process", PGC_POSTMASTER, RESOURCES_KERNEL,
2444  gettext_noop("Sets the maximum number of simultaneously open files for each server process."),
2445  NULL
2446  },
2448  1000, 64, INT_MAX,
2449  NULL, NULL, NULL
2450  },
2451 
2452  /*
2453  * See also CheckRequiredParameterValues() if this parameter changes
2454  */
2455  {
2456  {"max_prepared_transactions", PGC_POSTMASTER, RESOURCES_MEM,
2457  gettext_noop("Sets the maximum number of simultaneously prepared transactions."),
2458  NULL
2459  },
2461  0, 0, MAX_BACKENDS,
2462  NULL, NULL, NULL
2463  },
2464 
2465 #ifdef LOCK_DEBUG
2466  {
2467  {"trace_lock_oidmin", PGC_SUSET, DEVELOPER_OPTIONS,
2468  gettext_noop("Sets the minimum OID of tables for tracking locks."),
2469  gettext_noop("Is used to avoid output on system tables."),
2471  },
2472  &Trace_lock_oidmin,
2473  FirstNormalObjectId, 0, INT_MAX,
2474  NULL, NULL, NULL
2475  },
2476  {
2477  {"trace_lock_table", PGC_SUSET, DEVELOPER_OPTIONS,
2478  gettext_noop("Sets the OID of the table with unconditionally lock tracing."),
2479  NULL,
2481  },
2482  &Trace_lock_table,
2483  0, 0, INT_MAX,
2484  NULL, NULL, NULL
2485  },
2486 #endif
2487 
2488  {
2489  {"statement_timeout", PGC_USERSET, CLIENT_CONN_STATEMENT,
2490  gettext_noop("Sets the maximum allowed duration of any statement."),
2491  gettext_noop("A value of 0 turns off the timeout."),
2492  GUC_UNIT_MS
2493  },
2495  0, 0, INT_MAX,
2496  NULL, NULL, NULL
2497  },
2498 
2499  {
2500  {"lock_timeout", PGC_USERSET, CLIENT_CONN_STATEMENT,
2501  gettext_noop("Sets the maximum allowed duration of any wait for a lock."),
2502  gettext_noop("A value of 0 turns off the timeout."),
2503  GUC_UNIT_MS
2504  },
2505  &LockTimeout,
2506  0, 0, INT_MAX,
2507  NULL, NULL, NULL
2508  },
2509 
2510  {
2511  {"idle_in_transaction_session_timeout", PGC_USERSET, CLIENT_CONN_STATEMENT,
2512  gettext_noop("Sets the maximum allowed duration of any idling transaction."),
2513  gettext_noop("A value of 0 turns off the timeout."),
2514  GUC_UNIT_MS
2515  },
2517  0, 0, INT_MAX,
2518  NULL, NULL, NULL
2519  },
2520 
2521  {
2522  {"vacuum_freeze_min_age", PGC_USERSET, CLIENT_CONN_STATEMENT,
2523  gettext_noop("Minimum age at which VACUUM should freeze a table row."),
2524  NULL
2525  },
2527  50000000, 0, 1000000000,
2528  NULL, NULL, NULL
2529  },
2530 
2531  {
2532  {"vacuum_freeze_table_age", PGC_USERSET, CLIENT_CONN_STATEMENT,
2533  gettext_noop("Age at which VACUUM should scan whole table to freeze tuples."),
2534  NULL
2535  },
2537  150000000, 0, 2000000000,
2538  NULL, NULL, NULL
2539  },
2540 
2541  {
2542  {"vacuum_multixact_freeze_min_age", PGC_USERSET, CLIENT_CONN_STATEMENT,
2543  gettext_noop("Minimum age at which VACUUM should freeze a MultiXactId in a table row."),
2544  NULL
2545  },
2547  5000000, 0, 1000000000,
2548  NULL, NULL, NULL
2549  },
2550 
2551  {
2552  {"vacuum_multixact_freeze_table_age", PGC_USERSET, CLIENT_CONN_STATEMENT,
2553  gettext_noop("Multixact age at which VACUUM should scan whole table to freeze tuples."),
2554  NULL
2555  },
2557  150000000, 0, 2000000000,
2558  NULL, NULL, NULL
2559  },
2560 
2561  {
2562  {"vacuum_defer_cleanup_age", PGC_SIGHUP, REPLICATION_MASTER,
2563  gettext_noop("Number of transactions by which VACUUM and HOT cleanup should be deferred, if any."),
2564  NULL
2565  },
2567  0, 0, 1000000,
2568  NULL, NULL, NULL
2569  },
2570 
2571  /*
2572  * See also CheckRequiredParameterValues() if this parameter changes
2573  */
2574  {
2575  {"max_locks_per_transaction", PGC_POSTMASTER, LOCK_MANAGEMENT,
2576  gettext_noop("Sets the maximum number of locks per transaction."),
2577  gettext_noop("The shared lock table is sized on the assumption that "
2578  "at most max_locks_per_transaction * max_connections distinct "
2579  "objects will need to be locked at any one time.")
2580  },
2582  64, 10, INT_MAX,
2583  NULL, NULL, NULL
2584  },
2585 
2586  {
2587  {"max_pred_locks_per_transaction", PGC_POSTMASTER, LOCK_MANAGEMENT,
2588  gettext_noop("Sets the maximum number of predicate locks per transaction."),
2589  gettext_noop("The shared predicate lock table is sized on the assumption that "
2590  "at most max_pred_locks_per_transaction * max_connections distinct "
2591  "objects will need to be locked at any one time.")
2592  },
2594  64, 10, INT_MAX,
2595  NULL, NULL, NULL
2596  },
2597 
2598  {
2599  {"max_pred_locks_per_relation", PGC_SIGHUP, LOCK_MANAGEMENT,
2600  gettext_noop("Sets the maximum number of predicate-locked pages and tuples per relation."),
2601  gettext_noop("If more than this total of pages and tuples in the same relation are locked "
2602  "by a connection, those locks are replaced by a relation-level lock.")
2603  },
2605  -2, INT_MIN, INT_MAX,
2606  NULL, NULL, NULL
2607  },
2608 
2609  {
2610  {"max_pred_locks_per_page", PGC_SIGHUP, LOCK_MANAGEMENT,
2611  gettext_noop("Sets the maximum number of predicate-locked tuples per page."),
2612  gettext_noop("If more than this number of tuples on the same page are locked "
2613  "by a connection, those locks are replaced by a page-level lock.")
2614  },
2616  2, 0, INT_MAX,
2617  NULL, NULL, NULL
2618  },
2619 
2620  {
2621  {"authentication_timeout", PGC_SIGHUP, CONN_AUTH_AUTH,
2622  gettext_noop("Sets the maximum allowed time to complete client authentication."),
2623  NULL,
2624  GUC_UNIT_S
2625  },
2627  60, 1, 600,
2628  NULL, NULL, NULL
2629  },
2630 
2631  {
2632  /* Not for general use */
2633  {"pre_auth_delay", PGC_SIGHUP, DEVELOPER_OPTIONS,
2634  gettext_noop("Waits N seconds on connection startup before authentication."),
2635  gettext_noop("This allows attaching a debugger to the process."),
2637  },
2638  &PreAuthDelay,
2639  0, 0, 60,
2640  NULL, NULL, NULL
2641  },
2642 
2643  {
2644  {"wal_keep_segments", PGC_SIGHUP, REPLICATION_SENDING,
2645  gettext_noop("Sets the number of WAL files held for standby servers."),
2646  NULL
2647  },
2649  0, 0, INT_MAX,
2650  NULL, NULL, NULL
2651  },
2652 
2653  {
2654  {"min_wal_size", PGC_SIGHUP, WAL_CHECKPOINTS,
2655  gettext_noop("Sets the minimum size to shrink the WAL to."),
2656  NULL,
2657  GUC_UNIT_MB
2658  },
2659  &min_wal_size_mb,
2660  DEFAULT_MIN_WAL_SEGS * (DEFAULT_XLOG_SEG_SIZE / (1024 * 1024)),
2661  2, MAX_KILOBYTES,
2662  NULL, NULL, NULL
2663  },
2664 
2665  {
2666  {"max_wal_size", PGC_SIGHUP, WAL_CHECKPOINTS,
2667  gettext_noop("Sets the WAL size that triggers a checkpoint."),
2668  NULL,
2669  GUC_UNIT_MB
2670  },
2671  &max_wal_size_mb,
2672  DEFAULT_MAX_WAL_SEGS * (DEFAULT_XLOG_SEG_SIZE / (1024 * 1024)),
2673  2, MAX_KILOBYTES,
2674  NULL, assign_max_wal_size, NULL
2675  },
2676 
2677  {
2678  {"checkpoint_timeout", PGC_SIGHUP, WAL_CHECKPOINTS,
2679  gettext_noop("Sets the maximum time between automatic WAL checkpoints."),
2680  NULL,
2681  GUC_UNIT_S
2682  },
2684  300, 30, 86400,
2685  NULL, NULL, NULL
2686  },
2687 
2688  {
2689  {"checkpoint_warning", PGC_SIGHUP, WAL_CHECKPOINTS,
2690  gettext_noop("Enables warnings if checkpoint segments are filled more "
2691  "frequently than this."),
2692  gettext_noop("Write a message to the server log if checkpoints "
2693  "caused by the filling of checkpoint segment files happens more "
2694  "frequently than this number of seconds. Zero turns off the warning."),
2695  GUC_UNIT_S
2696  },
2698  30, 0, INT_MAX,
2699  NULL, NULL, NULL
2700  },
2701 
2702  {
2703  {"checkpoint_flush_after", PGC_SIGHUP, WAL_CHECKPOINTS,
2704  gettext_noop("Number of pages after which previously performed writes are flushed to disk."),
2705  NULL,
2707  },
2710  NULL, NULL, NULL
2711  },
2712 
2713  {
2714  {"wal_buffers", PGC_POSTMASTER, WAL_SETTINGS,
2715  gettext_noop("Sets the number of disk-page buffers in shared memory for WAL."),
2716  NULL,
2718  },
2719  &XLOGbuffers,
2720  -1, -1, (INT_MAX / XLOG_BLCKSZ),
2721  check_wal_buffers, NULL, NULL
2722  },
2723 
2724  {
2725  {"wal_writer_delay", PGC_SIGHUP, WAL_SETTINGS,
2726  gettext_noop("Time between WAL flushes performed in the WAL writer."),
2727  NULL,
2728  GUC_UNIT_MS
2729  },
2730  &WalWriterDelay,
2731  200, 1, 10000,
2732  NULL, NULL, NULL
2733  },
2734 
2735  {
2736  {"wal_writer_flush_after", PGC_SIGHUP, WAL_SETTINGS,
2737  gettext_noop("Amount of WAL written out by WAL writer that triggers a flush."),
2738  NULL,
2740  },
2742  (1024 * 1024) / XLOG_BLCKSZ, 0, INT_MAX,
2743  NULL, NULL, NULL
2744  },
2745 
2746  {
2747  {"wal_skip_threshold", PGC_USERSET, WAL_SETTINGS,
2748  gettext_noop("Size of new file to fsync instead of writing WAL."),
2749  NULL,
2750  GUC_UNIT_KB
2751  },
2753  2048, 0, MAX_KILOBYTES,
2754  NULL, NULL, NULL
2755  },
2756 
2757  {
2758  {"max_wal_senders", PGC_POSTMASTER, REPLICATION_SENDING,
2759  gettext_noop("Sets the maximum number of simultaneously running WAL sender processes."),
2760  NULL
2761  },
2762  &max_wal_senders,
2763  10, 0, MAX_BACKENDS,
2764  check_max_wal_senders, NULL, NULL
2765  },
2766 
2767  {
2768  /* see max_wal_senders */
2769  {"max_replication_slots", PGC_POSTMASTER, REPLICATION_SENDING,
2770  gettext_noop("Sets the maximum number of simultaneously defined replication slots."),
2771  NULL
2772  },
2774  10, 0, MAX_BACKENDS /* XXX? */ ,
2775  NULL, NULL, NULL
2776  },
2777 
2778  {
2779  {"wal_sender_timeout", PGC_USERSET, REPLICATION_SENDING,
2780  gettext_noop("Sets the maximum time to wait for WAL replication."),
2781  NULL,
2782  GUC_UNIT_MS
2783  },
2785  60 * 1000, 0, INT_MAX,
2786  NULL, NULL, NULL
2787  },
2788 
2789  {
2790  {"commit_delay", PGC_SUSET, WAL_SETTINGS,
2791  gettext_noop("Sets the delay in microseconds between transaction commit and "
2792  "flushing WAL to disk."),
2793  NULL
2794  /* we have no microseconds designation, so can't supply units here */
2795  },
2796  &CommitDelay,
2797  0, 0, 100000,
2798  NULL, NULL, NULL
2799  },
2800 
2801  {
2802  {"commit_siblings", PGC_USERSET, WAL_SETTINGS,
2803  gettext_noop("Sets the minimum concurrent open transactions before performing "
2804  "commit_delay."),
2805  NULL
2806  },
2807  &CommitSiblings,
2808  5, 0, 1000,
2809  NULL, NULL, NULL
2810  },
2811 
2812  {
2813  {"extra_float_digits", PGC_USERSET, CLIENT_CONN_LOCALE,
2814  gettext_noop("Sets the number of digits displayed for floating-point values."),
2815  gettext_noop("This affects real, double precision, and geometric data types. "
2816  "A zero or negative parameter value is added to the standard "
2817  "number of digits (FLT_DIG or DBL_DIG as appropriate). "
2818  "Any value greater than zero selects precise output mode.")
2819  },
2821  1, -15, 3,
2822  NULL, NULL, NULL
2823  },
2824 
2825  {
2826  {"log_min_duration_sample", PGC_SUSET, LOGGING_WHEN,
2827  gettext_noop("Sets the minimum execution time above which "
2828  "a sample of statements will be logged."
2829  " Sampling is determined by log_statement_sample_rate."),
2830  gettext_noop("Zero log a sample of all queries. -1 turns this feature off."),
2831  GUC_UNIT_MS
2832  },
2834  -1, -1, INT_MAX,
2835  NULL, NULL, NULL
2836  },
2837 
2838  {
2839  {"log_min_duration_statement", PGC_SUSET, LOGGING_WHEN,
2840  gettext_noop("Sets the minimum execution time above which "
2841  "all statements will be logged."),
2842  gettext_noop("Zero prints all queries. -1 turns this feature off."),
2843  GUC_UNIT_MS
2844  },
2846  -1, -1, INT_MAX,
2847  NULL, NULL, NULL
2848  },
2849 
2850  {
2851  {"log_autovacuum_min_duration", PGC_SIGHUP, LOGGING_WHAT,
2852  gettext_noop("Sets the minimum execution time above which "
2853  "autovacuum actions will be logged."),
2854  gettext_noop("Zero prints all actions. -1 turns autovacuum logging off."),
2855  GUC_UNIT_MS
2856  },
2858  -1, -1, INT_MAX,
2859  NULL, NULL, NULL
2860  },
2861 
2862  {
2863  {"log_parameter_max_length", PGC_SUSET, LOGGING_WHAT,
2864  gettext_noop("When logging statements, limit logged parameter values to first N bytes."),
2865  gettext_noop("-1 to print values in full."),
2867  },
2869  -1, -1, INT_MAX / 2,
2870  NULL, NULL, NULL
2871  },
2872 
2873  {
2874  {"log_parameter_max_length_on_error", PGC_USERSET, LOGGING_WHAT,
2875  gettext_noop("When reporting an error, limit logged parameter values to first N bytes."),
2876  gettext_noop("-1 to print values in full."),
2878  },
2880  0, -1, INT_MAX / 2,
2881  NULL, NULL, NULL
2882  },
2883 
2884  {
2885  {"bgwriter_delay", PGC_SIGHUP, RESOURCES_BGWRITER,
2886  gettext_noop("Background writer sleep time between rounds."),
2887  NULL,
2888  GUC_UNIT_MS
2889  },
2890  &BgWriterDelay,
2891  200, 10, 10000,
2892  NULL, NULL, NULL
2893  },
2894 
2895  {
2896  {"bgwriter_lru_maxpages", PGC_SIGHUP, RESOURCES_BGWRITER,
2897  gettext_noop("Background writer maximum number of LRU pages to flush per round."),
2898  NULL
2899  },
2901  100, 0, INT_MAX / 2, /* Same upper limit as shared_buffers */
2902  NULL, NULL, NULL
2903  },
2904 
2905  {
2906  {"bgwriter_flush_after", PGC_SIGHUP, RESOURCES_BGWRITER,
2907  gettext_noop("Number of pages after which previously performed writes are flushed to disk."),
2908  NULL,
2910  },
2913  NULL, NULL, NULL
2914  },
2915 
2916  {
2917  {"effective_io_concurrency",
2918  PGC_USERSET,
2920  gettext_noop("Number of simultaneous requests that can be handled efficiently by the disk subsystem."),
2921  gettext_noop("For RAID arrays, this should be approximately the number of drive spindles in the array."),
2922  GUC_EXPLAIN
2923  },
2925 #ifdef USE_PREFETCH
2926  1,
2927 #else
2928  0,
2929 #endif
2930  0, MAX_IO_CONCURRENCY,
2931  check_effective_io_concurrency, NULL, NULL
2932  },
2933 
2934  {
2935  {"maintenance_io_concurrency",
2936  PGC_USERSET,
2938  gettext_noop("A variant of effective_io_concurrency that is used for maintenance work."),
2939  NULL,
2940  GUC_EXPLAIN
2941  },
2943 #ifdef USE_PREFETCH
2944  10,
2945 #else
2946  0,
2947 #endif
2948  0, MAX_IO_CONCURRENCY,
2950  },
2951 
2952  {
2953  {"backend_flush_after", PGC_USERSET, RESOURCES_ASYNCHRONOUS,
2954  gettext_noop("Number of pages after which previously performed writes are flushed to disk."),
2955  NULL,
2957  },
2960  NULL, NULL, NULL
2961  },
2962 
2963  {
2964  {"max_worker_processes",
2967  gettext_noop("Maximum number of concurrent worker processes."),
2968  NULL,
2969  },
2971  8, 0, MAX_BACKENDS,
2972  check_max_worker_processes, NULL, NULL
2973  },
2974 
2975  {
2976  {"max_logical_replication_workers",
2979  gettext_noop("Maximum number of logical replication worker processes."),
2980  NULL,
2981  },
2983  4, 0, MAX_BACKENDS,
2984  NULL, NULL, NULL
2985  },
2986 
2987  {
2988  {"max_sync_workers_per_subscription",
2989  PGC_SIGHUP,
2991  gettext_noop("Maximum number of table synchronization workers per subscription."),
2992  NULL,
2993  },
2995  2, 0, MAX_BACKENDS,
2996  NULL, NULL, NULL
2997  },
2998 
2999  {
3000  {"log_rotation_age", PGC_SIGHUP, LOGGING_WHERE,
3001  gettext_noop("Automatic log file rotation will occur after N minutes."),
3002  NULL,
3003  GUC_UNIT_MIN
3004  },
3005  &Log_RotationAge,
3007  NULL, NULL, NULL
3008  },
3009 
3010  {
3011  {"log_rotation_size", PGC_SIGHUP, LOGGING_WHERE,
3012  gettext_noop("Automatic log file rotation will occur after N kilobytes."),
3013  NULL,
3014  GUC_UNIT_KB
3015  },
3017  10 * 1024, 0, INT_MAX / 1024,
3018  NULL, NULL, NULL
3019  },
3020 
3021  {
3022  {"max_function_args", PGC_INTERNAL, PRESET_OPTIONS,
3023  gettext_noop("Shows the maximum number of function arguments."),
3024  NULL,
3026  },
3029  NULL, NULL, NULL
3030  },
3031 
3032  {
3033  {"max_index_keys", PGC_INTERNAL, PRESET_OPTIONS,
3034  gettext_noop("Shows the maximum number of index keys."),
3035  NULL,
3037  },
3038  &max_index_keys,
3040  NULL, NULL, NULL
3041  },
3042 
3043  {
3044  {"max_identifier_length", PGC_INTERNAL, PRESET_OPTIONS,
3045  gettext_noop("Shows the maximum identifier length."),
3046  NULL,
3048  },
3050  NAMEDATALEN - 1, NAMEDATALEN - 1, NAMEDATALEN - 1,
3051  NULL, NULL, NULL
3052  },
3053 
3054  {
3055  {"block_size", PGC_INTERNAL, PRESET_OPTIONS,
3056  gettext_noop("Shows the size of a disk block."),
3057  NULL,
3059  },
3060  &block_size,
3061  BLCKSZ, BLCKSZ, BLCKSZ,
3062  NULL, NULL, NULL
3063  },
3064 
3065  {
3066  {"segment_size", PGC_INTERNAL, PRESET_OPTIONS,
3067  gettext_noop("Shows the number of pages per disk file."),
3068  NULL,
3070  },
3071  &segment_size,
3072  RELSEG_SIZE, RELSEG_SIZE, RELSEG_SIZE,
3073  NULL, NULL, NULL
3074  },
3075 
3076  {
3077  {"wal_block_size", PGC_INTERNAL, PRESET_OPTIONS,
3078  gettext_noop("Shows the block size in the write ahead log."),
3079  NULL,
3081  },
3082  &wal_block_size,
3083  XLOG_BLCKSZ, XLOG_BLCKSZ, XLOG_BLCKSZ,
3084  NULL, NULL, NULL
3085  },
3086 
3087  {
3088  {"wal_retrieve_retry_interval", PGC_SIGHUP, REPLICATION_STANDBY,
3089  gettext_noop("Sets the time to wait before retrying to retrieve WAL "
3090  "after a failed attempt."),
3091  NULL,
3092  GUC_UNIT_MS
3093  },
3095  5000, 1, INT_MAX,
3096  NULL, NULL, NULL
3097  },
3098 
3099  {
3100  {"wal_segment_size", PGC_INTERNAL, PRESET_OPTIONS,
3101  gettext_noop("Shows the size of write ahead log segments."),
3102  NULL,
3104  },
3107  WalSegMinSize,
3108  WalSegMaxSize,
3109  NULL, NULL, NULL
3110  },
3111 
3112  {
3113  {"autovacuum_naptime", PGC_SIGHUP, AUTOVACUUM,
3114  gettext_noop("Time to sleep between autovacuum runs."),
3115  NULL,
3116  GUC_UNIT_S
3117  },
3119  60, 1, INT_MAX / 1000,
3120  NULL, NULL, NULL
3121  },
3122  {
3123  {"autovacuum_vacuum_threshold", PGC_SIGHUP, AUTOVACUUM,
3124  gettext_noop("Minimum number of tuple updates or deletes prior to vacuum."),
3125  NULL
3126  },
3128  50, 0, INT_MAX,
3129  NULL, NULL, NULL
3130  },
3131  {
3132  {"autovacuum_vacuum_insert_threshold", PGC_SIGHUP, AUTOVACUUM,
3133  gettext_noop("Minimum number of tuple inserts prior to vacuum, or -1 to disable insert vacuums"),
3134  NULL
3135  },
3137  1000, -1, INT_MAX,
3138  NULL, NULL, NULL
3139  },
3140  {
3141  {"autovacuum_analyze_threshold", PGC_SIGHUP, AUTOVACUUM,
3142  gettext_noop("Minimum number of tuple inserts, updates, or deletes prior to analyze."),
3143  NULL
3144  },
3146  50, 0, INT_MAX,
3147  NULL, NULL, NULL
3148  },
3149  {
3150  /* see varsup.c for why this is PGC_POSTMASTER not PGC_SIGHUP */
3151  {"autovacuum_freeze_max_age", PGC_POSTMASTER, AUTOVACUUM,
3152  gettext_noop("Age at which to autovacuum a table to prevent transaction ID wraparound."),
3153  NULL
3154  },
3156  /* see pg_resetwal if you change the upper-limit value */
3157  200000000, 100000, 2000000000,
3158  NULL, NULL, NULL
3159  },
3160  {
3161  /* see multixact.c for why this is PGC_POSTMASTER not PGC_SIGHUP */
3162  {"autovacuum_multixact_freeze_max_age", PGC_POSTMASTER, AUTOVACUUM,
3163  gettext_noop("Multixact age at which to autovacuum a table to prevent multixact wraparound."),
3164  NULL
3165  },
3167  400000000, 10000, 2000000000,
3168  NULL, NULL, NULL
3169  },
3170  {
3171  /* see max_connections */
3172  {"autovacuum_max_workers", PGC_POSTMASTER, AUTOVACUUM,
3173  gettext_noop("Sets the maximum number of simultaneously running autovacuum worker processes."),
3174  NULL
3175  },
3177  3, 1, MAX_BACKENDS,
3178  check_autovacuum_max_workers, NULL, NULL
3179  },
3180 
3181  {
3182  {"max_parallel_maintenance_workers", PGC_USERSET, RESOURCES_ASYNCHRONOUS,
3183  gettext_noop("Sets the maximum number of parallel processes per maintenance operation."),
3184  NULL
3185  },
3187  2, 0, 1024,
3188  NULL, NULL, NULL
3189  },
3190 
3191  {
3192  {"max_parallel_workers_per_gather", PGC_USERSET, RESOURCES_ASYNCHRONOUS,
3193  gettext_noop("Sets the maximum number of parallel processes per executor node."),
3194  NULL,
3195  GUC_EXPLAIN
3196  },
3199  NULL, NULL, NULL
3200  },
3201 
3202  {
3203  {"max_parallel_workers", PGC_USERSET, RESOURCES_ASYNCHRONOUS,
3204  gettext_noop("Sets the maximum number of parallel workers that can be active at one time."),
3205  NULL,
3206  GUC_EXPLAIN
3207  },
3210  NULL, NULL, NULL
3211  },
3212 
3213  {
3214  {"autovacuum_work_mem", PGC_SIGHUP, RESOURCES_MEM,
3215  gettext_noop("Sets the maximum memory to be used by each autovacuum worker process."),
3216  NULL,
3217  GUC_UNIT_KB
3218  },
3220  -1, -1, MAX_KILOBYTES,
3221  check_autovacuum_work_mem, NULL, NULL
3222  },
3223 
3224  {
3225  {"old_snapshot_threshold", PGC_POSTMASTER, RESOURCES_ASYNCHRONOUS,
3226  gettext_noop("Time before a snapshot is too old to read pages changed after the snapshot was taken."),
3227  gettext_noop("A value of -1 disables this feature."),
3228  GUC_UNIT_MIN
3229  },
3231  -1, -1, MINS_PER_HOUR * HOURS_PER_DAY * 60,
3232  NULL, NULL, NULL
3233  },
3234 
3235  {
3236  {"tcp_keepalives_idle", PGC_USERSET, CLIENT_CONN_OTHER,
3237  gettext_noop("Time between issuing TCP keepalives."),
3238  gettext_noop("A value of 0 uses the system default."),
3239  GUC_UNIT_S
3240  },
3242  0, 0, INT_MAX,
3244  },
3245 
3246  {
3247  {"tcp_keepalives_interval", PGC_USERSET, CLIENT_CONN_OTHER,
3248  gettext_noop("Time between TCP keepalive retransmits."),
3249  gettext_noop("A value of 0 uses the system default."),
3250  GUC_UNIT_S
3251  },
3253  0, 0, INT_MAX,
3255  },
3256 
3257  {
3258  {"ssl_renegotiation_limit", PGC_USERSET, CONN_AUTH_SSL,
3259  gettext_noop("SSL renegotiation is no longer supported; this can only be 0."),
3260  NULL,
3262  },
3264  0, 0, 0,
3265  NULL, NULL, NULL
3266  },
3267 
3268  {
3269  {"tcp_keepalives_count", PGC_USERSET, CLIENT_CONN_OTHER,
3270  gettext_noop("Maximum number of TCP keepalive retransmits."),
3271  gettext_noop("This controls the number of consecutive keepalive retransmits that can be "
3272  "lost before a connection is considered dead. A value of 0 uses the "
3273  "system default."),
3274  },
3276  0, 0, INT_MAX,
3278  },
3279 
3280  {
3281  {"gin_fuzzy_search_limit", PGC_USERSET, CLIENT_CONN_OTHER,
3282  gettext_noop("Sets the maximum allowed result for exact search by GIN."),
3283  NULL,
3284  0
3285  },
3287  0, 0, INT_MAX,
3288  NULL, NULL, NULL
3289  },
3290 
3291  {
3292  {"effective_cache_size", PGC_USERSET, QUERY_TUNING_COST,
3293  gettext_noop("Sets the planner's assumption about the total size of the data caches."),
3294  gettext_noop("That is, the total size of the caches (kernel cache and shared buffers) used for PostgreSQL data files. "
3295  "This is measured in disk pages, which are normally 8 kB each."),
3297  },
3299  DEFAULT_EFFECTIVE_CACHE_SIZE, 1, INT_MAX,
3300  NULL, NULL, NULL
3301  },
3302 
3303  {
3304  {"min_parallel_table_scan_size", PGC_USERSET, QUERY_TUNING_COST,
3305  gettext_noop("Sets the minimum amount of table data for a parallel scan."),
3306  gettext_noop("If the planner estimates that it will read a number of table pages too small to reach this limit, a parallel scan will not be considered."),
3308  },
3310  (8 * 1024 * 1024) / BLCKSZ, 0, INT_MAX / 3,
3311  NULL, NULL, NULL
3312  },
3313 
3314  {
3315  {"min_parallel_index_scan_size", PGC_USERSET, QUERY_TUNING_COST,
3316  gettext_noop("Sets the minimum amount of index data for a parallel scan."),
3317  gettext_noop("If the planner estimates that it will read a number of index pages too small to reach this limit, a parallel scan will not be considered."),
3319  },
3321  (512 * 1024) / BLCKSZ, 0, INT_MAX / 3,
3322  NULL, NULL, NULL
3323  },
3324 
3325  {
3326  /* Can't be set in postgresql.conf */
3327  {"server_version_num", PGC_INTERNAL, PRESET_OPTIONS,
3328  gettext_noop("Shows the server version as an integer."),
3329  NULL,
3331  },
3333  PG_VERSION_NUM, PG_VERSION_NUM, PG_VERSION_NUM,
3334  NULL, NULL, NULL
3335  },
3336 
3337  {
3338  {"log_temp_files", PGC_SUSET, LOGGING_WHAT,
3339  gettext_noop("Log the use of temporary files larger than this number of kilobytes."),
3340  gettext_noop("Zero logs all files. The default is -1 (turning this feature off)."),
3341  GUC_UNIT_KB
3342  },
3343  &log_temp_files,
3344  -1, -1, INT_MAX,
3345  NULL, NULL, NULL
3346  },
3347 
3348  {
3349  {"track_activity_query_size", PGC_POSTMASTER, RESOURCES_MEM,
3350  gettext_noop("Sets the size reserved for pg_stat_activity.query, in bytes."),
3351  NULL,
3353  },
3355  1024, 100, 1048576,
3356  NULL, NULL, NULL
3357  },
3358 
3359  {
3360  {"gin_pending_list_limit", PGC_USERSET, CLIENT_CONN_STATEMENT,
3361  gettext_noop("Sets the maximum size of the pending list for GIN index."),
3362  NULL,
3363  GUC_UNIT_KB
3364  },
3366  4096, 64, MAX_KILOBYTES,
3367  NULL, NULL, NULL
3368  },
3369 
3370  {
3371  {"tcp_user_timeout", PGC_USERSET, CLIENT_CONN_OTHER,
3372  gettext_noop("TCP user timeout."),
3373  gettext_noop("A value of 0 uses the system default."),
3374  GUC_UNIT_MS
3375  },
3377  0, 0, INT_MAX,
3379  },
3380 
3381  /* End-of-list marker */
3382  {
3383  {NULL, 0, 0, NULL, NULL}, NULL, 0, 0, 0, NULL, NULL, NULL
3384  }
3385 };
3386 
3387 
3389 {
3390  {
3391  {"seq_page_cost", PGC_USERSET, QUERY_TUNING_COST,
3392  gettext_noop("Sets the planner's estimate of the cost of a "
3393  "sequentially fetched disk page."),
3394  NULL,
3395  GUC_EXPLAIN
3396  },
3397  &seq_page_cost,
3398  DEFAULT_SEQ_PAGE_COST, 0, DBL_MAX,
3399  NULL, NULL, NULL
3400  },
3401  {
3402  {"random_page_cost", PGC_USERSET, QUERY_TUNING_COST,
3403  gettext_noop("Sets the planner's estimate of the cost of a "
3404  "nonsequentially fetched disk page."),
3405  NULL,
3406  GUC_EXPLAIN
3407  },
3409  DEFAULT_RANDOM_PAGE_COST, 0, DBL_MAX,
3410  NULL, NULL, NULL
3411  },
3412  {
3413  {"cpu_tuple_cost", PGC_USERSET, QUERY_TUNING_COST,
3414  gettext_noop("Sets the planner's estimate of the cost of "
3415  "processing each tuple (row)."),
3416  NULL,
3417  GUC_EXPLAIN
3418  },
3419  &cpu_tuple_cost,
3420  DEFAULT_CPU_TUPLE_COST, 0, DBL_MAX,
3421  NULL, NULL, NULL
3422  },
3423  {
3424  {"cpu_index_tuple_cost", PGC_USERSET, QUERY_TUNING_COST,
3425  gettext_noop("Sets the planner's estimate of the cost of "
3426  "processing each index entry during an index scan."),
3427  NULL,
3428  GUC_EXPLAIN
3429  },
3431  DEFAULT_CPU_INDEX_TUPLE_COST, 0, DBL_MAX,
3432  NULL, NULL, NULL
3433  },
3434  {
3435  {"cpu_operator_cost", PGC_USERSET, QUERY_TUNING_COST,
3436  gettext_noop("Sets the planner's estimate of the cost of "
3437  "processing each operator or function call."),
3438  NULL,
3439  GUC_EXPLAIN
3440  },
3442  DEFAULT_CPU_OPERATOR_COST, 0, DBL_MAX,
3443  NULL, NULL, NULL
3444  },
3445  {
3446  {"parallel_tuple_cost", PGC_USERSET, QUERY_TUNING_COST,
3447  gettext_noop("Sets the planner's estimate of the cost of "
3448  "passing each tuple (row) from worker to master backend."),
3449  NULL,
3450  GUC_EXPLAIN
3451  },
3453  DEFAULT_PARALLEL_TUPLE_COST, 0, DBL_MAX,
3454  NULL, NULL, NULL
3455  },
3456  {
3457  {"parallel_setup_cost", PGC_USERSET, QUERY_TUNING_COST,
3458  gettext_noop("Sets the planner's estimate of the cost of "
3459  "starting up worker processes for parallel query."),
3460  NULL,
3461  GUC_EXPLAIN
3462  },
3464  DEFAULT_PARALLEL_SETUP_COST, 0, DBL_MAX,
3465  NULL, NULL, NULL
3466  },
3467 
3468  {
3469  {"jit_above_cost", PGC_USERSET, QUERY_TUNING_COST,
3470  gettext_noop("Perform JIT compilation if query is more expensive."),
3471  gettext_noop("-1 disables JIT compilation."),
3472  GUC_EXPLAIN
3473  },
3474  &jit_above_cost,
3475  100000, -1, DBL_MAX,
3476  NULL, NULL, NULL
3477  },
3478 
3479  {
3480  {"jit_optimize_above_cost", PGC_USERSET, QUERY_TUNING_COST,
3481  gettext_noop("Optimize JITed functions if query is more expensive."),
3482  gettext_noop("-1 disables optimization."),
3483  GUC_EXPLAIN
3484  },
3486  500000, -1, DBL_MAX,
3487  NULL, NULL, NULL
3488  },
3489 
3490  {
3491  {"jit_inline_above_cost", PGC_USERSET, QUERY_TUNING_COST,
3492  gettext_noop("Perform JIT inlining if query is more expensive."),
3493  gettext_noop("-1 disables inlining."),
3494  GUC_EXPLAIN
3495  },
3497  500000, -1, DBL_MAX,
3498  NULL, NULL, NULL
3499  },
3500 
3501  {
3502  {"cursor_tuple_fraction", PGC_USERSET, QUERY_TUNING_OTHER,
3503  gettext_noop("Sets the planner's estimate of the fraction of "
3504  "a cursor's rows that will be retrieved."),
3505  NULL,
3506  GUC_EXPLAIN
3507  },
3510  NULL, NULL, NULL
3511  },
3512 
3513  {
3514  {"geqo_selection_bias", PGC_USERSET, QUERY_TUNING_GEQO,
3515  gettext_noop("GEQO: selective pressure within the population."),
3516  NULL,
3517  GUC_EXPLAIN
3518  },
3522  NULL, NULL, NULL
3523  },
3524  {
3525  {"geqo_seed", PGC_USERSET, QUERY_TUNING_GEQO,
3526  gettext_noop("GEQO: seed for random path selection."),
3527  NULL,
3528  GUC_EXPLAIN
3529  },
3530  &Geqo_seed,
3531  0.0, 0.0, 1.0,
3532  NULL, NULL, NULL
3533  },
3534 
3535  {
3536  {"bgwriter_lru_multiplier", PGC_SIGHUP, RESOURCES_BGWRITER,
3537  gettext_noop("Multiple of the average buffer usage to free per round."),
3538  NULL
3539  },
3541  2.0, 0.0, 10.0,
3542  NULL, NULL, NULL
3543  },
3544 
3545  {
3546  {"seed", PGC_USERSET, UNGROUPED,
3547  gettext_noop("Sets the seed for random-number generation."),
3548  NULL,
3550  },
3552  0.0, -1.0, 1.0,
3554  },
3555 
3556  {
3557  {"vacuum_cost_delay", PGC_USERSET, RESOURCES_VACUUM_DELAY,
3558  gettext_noop("Vacuum cost delay in milliseconds."),
3559  NULL,
3560  GUC_UNIT_MS
3561  },
3562  &VacuumCostDelay,
3563  0, 0, 100,
3564  NULL, NULL, NULL
3565  },
3566 
3567  {
3568  {"autovacuum_vacuum_cost_delay", PGC_SIGHUP, AUTOVACUUM,
3569  gettext_noop("Vacuum cost delay in milliseconds, for autovacuum."),
3570  NULL,
3571  GUC_UNIT_MS
3572  },
3574  2, -1, 100,
3575  NULL, NULL, NULL
3576  },
3577 
3578  {
3579  {"autovacuum_vacuum_scale_factor", PGC_SIGHUP, AUTOVACUUM,
3580  gettext_noop("Number of tuple updates or deletes prior to vacuum as a fraction of reltuples."),
3581  NULL
3582  },
3584  0.2, 0.0, 100.0,
3585  NULL, NULL, NULL
3586  },
3587 
3588  {
3589  {"autovacuum_vacuum_insert_scale_factor", PGC_SIGHUP, AUTOVACUUM,
3590  gettext_noop("Number of tuple inserts prior to vacuum as a fraction of reltuples."),
3591  NULL
3592  },
3594  0.2, 0.0, 100.0,
3595  NULL, NULL, NULL
3596  },
3597 
3598  {
3599  {"autovacuum_analyze_scale_factor", PGC_SIGHUP, AUTOVACUUM,
3600  gettext_noop("Number of tuple inserts, updates, or deletes prior to analyze as a fraction of reltuples."),
3601  NULL
3602  },
3604  0.1, 0.0, 100.0,
3605  NULL, NULL, NULL
3606  },
3607 
3608  {
3609  {"checkpoint_completion_target", PGC_SIGHUP, WAL_CHECKPOINTS,
3610  gettext_noop("Time spent flushing dirty buffers during checkpoint, as fraction of checkpoint interval."),
3611  NULL
3612  },
3614  0.5, 0.0, 1.0,
3615  NULL, NULL, NULL
3616  },
3617 
3618  {
3619  {"vacuum_cleanup_index_scale_factor", PGC_USERSET, CLIENT_CONN_STATEMENT,
3620  gettext_noop("Number of tuple inserts prior to index cleanup as a fraction of reltuples."),
3621  NULL
3622  },
3624  0.1, 0.0, 1e10,
3625  NULL, NULL, NULL
3626  },
3627 
3628  {
3629  {"log_statement_sample_rate", PGC_SUSET, LOGGING_WHEN,
3630  gettext_noop("Fraction of statements exceeding log_min_duration_sample to be logged."),
3631  gettext_noop("Use a value between 0.0 (never log) and 1.0 (always log).")
3632  },
3634  1.0, 0.0, 1.0,
3635  NULL, NULL, NULL
3636  },
3637 
3638  {
3639  {"log_transaction_sample_rate", PGC_SUSET, LOGGING_WHEN,
3640  gettext_noop("Set the fraction of transactions to log for new transactions."),
3641  gettext_noop("Logs all statements from a fraction of transactions. "
3642  "Use a value between 0.0 (never log) and 1.0 (log all "
3643  "statements for all transactions).")
3644  },
3646  0.0, 0.0, 1.0,
3647  NULL, NULL, NULL
3648  },
3649 
3650  /* End-of-list marker */
3651  {
3652  {NULL, 0, 0, NULL, NULL}, NULL, 0.0, 0.0, 0.0, NULL, NULL, NULL
3653  }
3654 };
3655 
3656 
3658 {
3659  {
3660  {"archive_command", PGC_SIGHUP, WAL_ARCHIVING,
3661  gettext_noop("Sets the shell command that will be called to archive a WAL file."),
3662  NULL
3663  },
3665  "",
3666  NULL, NULL, show_archive_command
3667  },
3668 
3669  {
3670  {"restore_command", PGC_POSTMASTER, WAL_ARCHIVE_RECOVERY,
3671  gettext_noop("Sets the shell command that will retrieve an archived WAL file."),
3672  NULL
3673  },
3675  "",
3676  NULL, NULL, NULL
3677  },
3678 
3679  {
3680  {"archive_cleanup_command", PGC_SIGHUP, WAL_ARCHIVE_RECOVERY,
3681  gettext_noop("Sets the shell command that will be executed at every restart point."),
3682  NULL
3683  },
3685  "",
3686  NULL, NULL, NULL
3687  },
3688 
3689  {
3690  {"recovery_end_command", PGC_SIGHUP, WAL_ARCHIVE_RECOVERY,
3691  gettext_noop("Sets the shell command that will be executed once at the end of recovery."),
3692  NULL
3693  },
3695  "",
3696  NULL, NULL, NULL
3697  },
3698 
3699  {
3700  {"recovery_target_timeline", PGC_POSTMASTER, WAL_RECOVERY_TARGET,
3701  gettext_noop("Specifies the timeline to recover into."),
3702  NULL
3703  },
3705  "latest",
3707  },
3708 
3709  {
3710  {"recovery_target", PGC_POSTMASTER, WAL_RECOVERY_TARGET,
3711  gettext_noop("Set to \"immediate\" to end recovery as soon as a consistent state is reached."),
3712  NULL
3713  },
3715  "",
3717  },
3718  {
3719  {"recovery_target_xid", PGC_POSTMASTER, WAL_RECOVERY_TARGET,
3720  gettext_noop("Sets the transaction ID up to which recovery will proceed."),
3721  NULL
3722  },
3724  "",
3726  },
3727  {
3728  {"recovery_target_time", PGC_POSTMASTER, WAL_RECOVERY_TARGET,
3729  gettext_noop("Sets the time stamp up to which recovery will proceed."),
3730  NULL
3731  },
3733  "",
3735  },
3736  {
3737  {"recovery_target_name", PGC_POSTMASTER, WAL_RECOVERY_TARGET,
3738  gettext_noop("Sets the named restore point up to which recovery will proceed."),
3739  NULL
3740  },
3742  "",
3744  },
3745  {
3746  {"recovery_target_lsn", PGC_POSTMASTER, WAL_RECOVERY_TARGET,
3747  gettext_noop("Sets the LSN of the write-ahead log location up to which recovery will proceed."),
3748  NULL
3749  },
3751  "",
3753  },
3754 
3755  {
3756  {"promote_trigger_file", PGC_SIGHUP, REPLICATION_STANDBY,
3757  gettext_noop("Specifies a file name whose presence ends recovery in the standby."),
3758  NULL
3759  },
3761  "",
3762  NULL, NULL, NULL
3763  },
3764 
3765  {
3766  {"primary_conninfo", PGC_SIGHUP, REPLICATION_STANDBY,
3767  gettext_noop("Sets the connection string to be used to connect to the sending server."),
3768  NULL,
3770  },
3771  &PrimaryConnInfo,
3772  "",
3773  NULL, NULL, NULL
3774  },
3775 
3776  {
3777  {"primary_slot_name", PGC_SIGHUP, REPLICATION_STANDBY,
3778  gettext_noop("Sets the name of the replication slot to use on the sending server."),
3779  NULL
3780  },
3781  &PrimarySlotName,
3782  "",
3783  check_primary_slot_name, NULL, NULL
3784  },
3785 
3786  {
3787  {"client_encoding", PGC_USERSET, CLIENT_CONN_LOCALE,
3788  gettext_noop("Sets the client's character set encoding."),
3789  NULL,
3791  },
3793  "SQL_ASCII",
3795  },
3796 
3797  {
3798  {"log_line_prefix", PGC_SIGHUP, LOGGING_WHAT,
3799  gettext_noop("Controls information prefixed to each log line."),
3800  gettext_noop("If blank, no prefix is used.")
3801  },
3802  &Log_line_prefix,
3803  "%m [%p] ",
3804  NULL, NULL, NULL
3805  },
3806 
3807  {
3808  {"log_timezone", PGC_SIGHUP, LOGGING_WHAT,
3809  gettext_noop("Sets the time zone to use in log messages."),
3810  NULL
3811  },
3813  "GMT",
3815  },
3816 
3817  {
3818  {"DateStyle", PGC_USERSET, CLIENT_CONN_LOCALE,
3819  gettext_noop("Sets the display format for date and time values."),
3820  gettext_noop("Also controls interpretation of ambiguous "
3821  "date inputs."),
3823  },
3825  "ISO, MDY",
3827  },
3828 
3829  {
3830  {"default_table_access_method", PGC_USERSET, CLIENT_CONN_STATEMENT,
3831  gettext_noop("Sets the default table access method for new tables."),
3832  NULL,
3833  GUC_IS_NAME
3834  },
3838  },
3839 
3840  {
3841  {"default_tablespace", PGC_USERSET, CLIENT_CONN_STATEMENT,
3842  gettext_noop("Sets the default tablespace to create tables and indexes in."),
3843  gettext_noop("An empty string selects the database's default tablespace."),
3844  GUC_IS_NAME
3845  },
3847  "",
3848  check_default_tablespace, NULL, NULL
3849  },
3850 
3851  {
3852  {"temp_tablespaces", PGC_USERSET, CLIENT_CONN_STATEMENT,
3853  gettext_noop("Sets the tablespace(s) to use for temporary tables and sort files."),
3854  NULL,
3856  },
3858  "",
3860  },
3861 
3862  {
3863  {"dynamic_library_path", PGC_SUSET, CLIENT_CONN_OTHER,
3864  gettext_noop("Sets the path for dynamically loadable modules."),
3865  gettext_noop("If a dynamically loadable module needs to be opened and "
3866  "the specified name does not have a directory component (i.e., the "
3867  "name does not contain a slash), the system will search this path for "
3868  "the specified file."),
3870  },
3872  "$libdir",
3873  NULL, NULL, NULL
3874  },
3875 
3876  {
3877  {"krb_server_keyfile", PGC_SIGHUP, CONN_AUTH_AUTH,
3878  gettext_noop("Sets the location of the Kerberos server key file."),
3879  NULL,
3881  },
3883  PG_KRB_SRVTAB,
3884  NULL, NULL, NULL
3885  },
3886 
3887  {
3888  {"bonjour_name", PGC_POSTMASTER, CONN_AUTH_SETTINGS,
3889  gettext_noop("Sets the Bonjour service name."),
3890  NULL
3891  },
3892  &bonjour_name,
3893  "",
3894  NULL, NULL, NULL
3895  },
3896 
3897  /* See main.c about why defaults for LC_foo are not all alike */
3898 
3899  {
3900  {"lc_collate", PGC_INTERNAL, CLIENT_CONN_LOCALE,
3901  gettext_noop("Shows the collation order locale."),
3902  NULL,
3904  },
3905  &locale_collate,
3906  "C",
3907  NULL, NULL, NULL
3908  },
3909 
3910  {
3911  {"lc_ctype", PGC_INTERNAL, CLIENT_CONN_LOCALE,
3912  gettext_noop("Shows the character classification and case conversion locale."),
3913  NULL,
3915  },
3916  &locale_ctype,
3917  "C",
3918  NULL, NULL, NULL
3919  },
3920 
3921  {
3922  {"lc_messages", PGC_SUSET, CLIENT_CONN_LOCALE,
3923  gettext_noop("Sets the language in which messages are displayed."),
3924  NULL
3925  },
3926  &locale_messages,
3927  "",
3929  },
3930 
3931  {
3932  {"lc_monetary", PGC_USERSET, CLIENT_CONN_LOCALE,
3933  gettext_noop("Sets the locale for formatting monetary amounts."),
3934  NULL
3935  },
3936  &locale_monetary,
3937  "C",
3939  },
3940 
3941  {
3942  {"lc_numeric", PGC_USERSET, CLIENT_CONN_LOCALE,
3943  gettext_noop("Sets the locale for formatting numbers."),
3944  NULL
3945  },
3946  &locale_numeric,
3947  "C",
3949  },
3950 
3951  {
3952  {"lc_time", PGC_USERSET, CLIENT_CONN_LOCALE,
3953  gettext_noop("Sets the locale for formatting date and time values."),
3954  NULL
3955  },
3956  &locale_time,
3957  "C",
3959  },
3960 
3961  {
3962  {"session_preload_libraries", PGC_SUSET, CLIENT_CONN_PRELOAD,
3963  gettext_noop("Lists shared libraries to preload into each backend."),
3964  NULL,
3966  },
3968  "",
3969  NULL, NULL, NULL
3970  },
3971 
3972  {
3973  {"shared_preload_libraries", PGC_POSTMASTER, CLIENT_CONN_PRELOAD,
3974  gettext_noop("Lists shared libraries to preload into server."),
3975  NULL,
3977  },
3979  "",
3980  NULL, NULL, NULL
3981  },
3982 
3983  {
3984  {"local_preload_libraries", PGC_USERSET, CLIENT_CONN_PRELOAD,
3985  gettext_noop("Lists unprivileged shared libraries to preload into each backend."),
3986  NULL,
3988  },
3990  "",
3991  NULL, NULL, NULL
3992  },
3993 
3994  {
3995  {"search_path", PGC_USERSET, CLIENT_CONN_STATEMENT,
3996  gettext_noop("Sets the schema search order for names that are not schema-qualified."),
3997  NULL,
3999  },
4001  "\"$user\", public",
4003  },
4004 
4005  {
4006  /* Can't be set in postgresql.conf */
4007  {"server_encoding", PGC_INTERNAL, CLIENT_CONN_LOCALE,
4008  gettext_noop("Sets the server (database) character set encoding."),
4009  NULL,
4011  },
4013  "SQL_ASCII",
4014  NULL, NULL, NULL
4015  },
4016 
4017  {
4018  /* Can't be set in postgresql.conf */
4019  {"server_version", PGC_INTERNAL, PRESET_OPTIONS,
4020  gettext_noop("Shows the server version."),
4021  NULL,
4023  },
4025  PG_VERSION,
4026  NULL, NULL, NULL
4027  },
4028 
4029  {
4030  /* Not for general use --- used by SET ROLE */
4031  {"role", PGC_USERSET, UNGROUPED,
4032  gettext_noop("Sets the current role."),
4033  NULL,
4035  },
4036  &role_string,
4037  "none",
4039  },
4040 
4041  {
4042  /* Not for general use --- used by SET SESSION AUTHORIZATION */
4043  {"session_authorization", PGC_USERSET, UNGROUPED,
4044  gettext_noop("Sets the session user name."),
4045  NULL,
4047  },
4049  NULL,
4051  },
4052 
4053  {
4054  {"log_destination", PGC_SIGHUP, LOGGING_WHERE,
4055  gettext_noop("Sets the destination for server log output."),
4056  gettext_noop("Valid values are combinations of \"stderr\", "
4057  "\"syslog\", \"csvlog\", and \"eventlog\", "
4058  "depending on the platform."),
4060  },
4062  "stderr",
4064  },
4065  {
4066  {"log_directory", PGC_SIGHUP, LOGGING_WHERE,
4067  gettext_noop("Sets the destination directory for log files."),
4068  gettext_noop("Can be specified as relative to the data directory "
4069  "or as absolute path."),
4071  },
4072  &Log_directory,
4073  "log",
4074  check_canonical_path, NULL, NULL
4075  },
4076  {
4077  {"log_filename", PGC_SIGHUP, LOGGING_WHERE,
4078  gettext_noop("Sets the file name pattern for log files."),
4079  NULL,
4081  },
4082  &Log_filename,
4083  "postgresql-%Y-%m-%d_%H%M%S.log",
4084  NULL, NULL, NULL
4085  },
4086 
4087  {
4088  {"syslog_ident", PGC_SIGHUP, LOGGING_WHERE,
4089  gettext_noop("Sets the program name used to identify PostgreSQL "
4090  "messages in syslog."),
4091  NULL
4092  },
4094  "postgres",
4095  NULL, assign_syslog_ident, NULL
4096  },
4097 
4098  {
4099  {"event_source", PGC_POSTMASTER, LOGGING_WHERE,
4100  gettext_noop("Sets the application name used to identify "
4101  "PostgreSQL messages in the event log."),
4102  NULL
4103  },
4104  &event_source,
4106  NULL, NULL, NULL
4107  },
4108 
4109  {
4110  {"TimeZone", PGC_USERSET, CLIENT_CONN_LOCALE,
4111  gettext_noop("Sets the time zone for displaying and interpreting time stamps."),
4112  NULL,
4113  GUC_REPORT
4114  },
4115  &timezone_string,
4116  "GMT",
4118  },
4119  {
4120  {"timezone_abbreviations", PGC_USERSET, CLIENT_CONN_LOCALE,
4121  gettext_noop("Selects a file of time zone abbreviations."),
4122  NULL
4123  },
4125  NULL,
4127  },
4128 
4129  {
4130  {"unix_socket_group", PGC_POSTMASTER, CONN_AUTH_SETTINGS,
4131  gettext_noop("Sets the owning group of the Unix-domain socket."),
4132  gettext_noop("The owning user of the socket is always the user "
4133  "that starts the server.")
4134  },
4136  "",
4137  NULL, NULL, NULL
4138  },
4139 
4140  {
4141  {"unix_socket_directories", PGC_POSTMASTER, CONN_AUTH_SETTINGS,
4142  gettext_noop("Sets the directories where Unix-domain sockets will be created."),
4143  NULL,
4145  },
4147 #ifdef HAVE_UNIX_SOCKETS
4149 #else
4150  "",
4151 #endif
4152  NULL, NULL, NULL
4153  },
4154 
4155  {
4156  {"listen_addresses", PGC_POSTMASTER, CONN_AUTH_SETTINGS,
4157  gettext_noop("Sets the host name or IP address(es) to listen to."),
4158  NULL,
4160  },
4161  &ListenAddresses,
4162  "localhost",
4163  NULL, NULL, NULL
4164  },
4165 
4166  {
4167  /*
4168  * Can't be set by ALTER SYSTEM as it can lead to recursive definition
4169  * of data_directory.
4170  */
4171  {"data_directory", PGC_POSTMASTER, FILE_LOCATIONS,
4172  gettext_noop("Sets the server's data directory."),
4173  NULL,
4175  },
4176  &data_directory,
4177  NULL,
4178  NULL, NULL, NULL
4179  },
4180 
4181  {
4182  {"config_file", PGC_POSTMASTER, FILE_LOCATIONS,
4183  gettext_noop("Sets the server's main configuration file."),
4184  NULL,
4186  },
4187  &ConfigFileName,
4188  NULL,
4189  NULL, NULL, NULL
4190  },
4191 
4192  {
4193  {"hba_file", PGC_POSTMASTER, FILE_LOCATIONS,
4194  gettext_noop("Sets the server's \"hba\" configuration file."),
4195  NULL,
4197  },
4198  &HbaFileName,
4199  NULL,
4200  NULL, NULL, NULL
4201  },
4202 
4203  {
4204  {"ident_file", PGC_POSTMASTER, FILE_LOCATIONS,
4205  gettext_noop("Sets the server's \"ident\" configuration file."),
4206  NULL,
4208  },
4209  &IdentFileName,
4210  NULL,
4211  NULL, NULL, NULL
4212  },
4213 
4214  {
4215  {"external_pid_file", PGC_POSTMASTER, FILE_LOCATIONS,
4216  gettext_noop("Writes the postmaster PID to the specified file."),
4217  NULL,
4219  },
4221  NULL,
4222  check_canonical_path, NULL, NULL
4223  },
4224 
4225  {
4226  {"ssl_library", PGC_INTERNAL, PRESET_OPTIONS,
4227  gettext_noop("Name of the SSL library."),
4228  NULL,
4230  },
4231  &ssl_library,
4232 #ifdef USE_SSL
4233  "OpenSSL",
4234 #else
4235  "",
4236 #endif
4237  NULL, NULL, NULL
4238  },
4239 
4240  {
4241  {"ssl_cert_file", PGC_SIGHUP, CONN_AUTH_SSL,
4242  gettext_noop("Location of the SSL server certificate file."),
4243  NULL
4244  },
4245  &ssl_cert_file,
4246  "server.crt",
4247  NULL, NULL, NULL
4248  },
4249 
4250  {
4251  {"ssl_key_file", PGC_SIGHUP, CONN_AUTH_SSL,
4252  gettext_noop("Location of the SSL server private key file."),
4253  NULL
4254  },
4255  &ssl_key_file,
4256  "server.key",
4257  NULL, NULL, NULL
4258  },
4259 
4260  {
4261  {"ssl_ca_file", PGC_SIGHUP, CONN_AUTH_SSL,
4262  gettext_noop("Location of the SSL certificate authority file."),
4263  NULL
4264  },
4265  &ssl_ca_file,
4266  "",
4267  NULL, NULL, NULL
4268  },
4269 
4270  {
4271  {"ssl_crl_file", PGC_SIGHUP, CONN_AUTH_SSL,
4272  gettext_noop("Location of the SSL certificate revocation list file."),
4273  NULL
4274  },
4275  &ssl_crl_file,
4276  "",
4277  NULL, NULL, NULL
4278  },
4279 
4280  {
4281  {"stats_temp_directory", PGC_SIGHUP, STATS_COLLECTOR,
4282  gettext_noop("Writes temporary statistics files to the specified directory."),
4283  NULL,
4285  },
4289  },
4290 
4291  {
4292  {"synchronous_standby_names", PGC_SIGHUP, REPLICATION_MASTER,
4293  gettext_noop("Number of synchronous standbys and list of names of potential synchronous ones."),
4294  NULL,
4296  },
4298  "",
4300  },
4301 
4302  {
4303  {"default_text_search_config", PGC_USERSET, CLIENT_CONN_LOCALE,
4304  gettext_noop("Sets default text search configuration."),
4305  NULL
4306  },
4307  &TSCurrentConfig,
4308  "pg_catalog.simple",
4310  },
4311 
4312  {
4313  {"ssl_ciphers", PGC_SIGHUP, CONN_AUTH_SSL,
4314  gettext_noop("Sets the list of allowed SSL ciphers."),
4315  NULL,
4317  },
4318  &SSLCipherSuites,
4319 #ifdef USE_OPENSSL
4320  "HIGH:MEDIUM:+3DES:!aNULL",
4321 #else
4322  "none",
4323 #endif
4324  NULL, NULL, NULL
4325  },
4326 
4327  {
4328  {"ssl_ecdh_curve", PGC_SIGHUP, CONN_AUTH_SSL,
4329  gettext_noop("Sets the curve to use for ECDH."),
4330  NULL,
4332  },
4333  &SSLECDHCurve,
4334 #ifdef USE_SSL
4335  "prime256v1",
4336 #else
4337  "none",
4338 #endif
4339  NULL, NULL, NULL
4340  },
4341 
4342  {
4343  {"ssl_dh_params_file", PGC_SIGHUP, CONN_AUTH_SSL,
4344  gettext_noop("Location of the SSL DH parameters file."),
4345  NULL,
4347  },
4349  "",
4350  NULL, NULL, NULL
4351  },
4352 
4353  {
4354  {"ssl_passphrase_command", PGC_SIGHUP, CONN_AUTH_SSL,
4355  gettext_noop("Command to obtain passphrases for SSL."),
4356  NULL,
4358  },
4360  "",
4361  NULL, NULL, NULL
4362  },
4363 
4364  {
4365  {"application_name", PGC_USERSET, LOGGING_WHAT,
4366  gettext_noop("Sets the application name to be reported in statistics and logs."),
4367  NULL,
4369  },
4371  "",
4373  },
4374 
4375  {
4376  {"cluster_name", PGC_POSTMASTER, PROCESS_TITLE,
4377  gettext_noop("Sets the name of the cluster, which is included in the process title."),
4378  NULL,
4379  GUC_IS_NAME
4380  },
4381  &cluster_name,
4382  "",
4383  check_cluster_name, NULL, NULL
4384  },
4385 
4386  {
4387  {"wal_consistency_checking", PGC_SUSET, DEVELOPER_OPTIONS,
4388  gettext_noop("Sets the WAL resource managers for which WAL consistency checks are done."),
4389  gettext_noop("Full-page images will be logged for all data blocks and cross-checked against the results of WAL replay."),
4391  },
4393  "",
4395  },
4396 
4397  {
4398  {"jit_provider", PGC_POSTMASTER, CLIENT_CONN_PRELOAD,
4399  gettext_noop("JIT provider to use."),
4400  NULL,
4402  },
4403  &jit_provider,
4404  "llvmjit",
4405  NULL, NULL, NULL
4406  },
4407 
4408  {
4409  {"backtrace_functions", PGC_SUSET, DEVELOPER_OPTIONS,
4410  gettext_noop("Log backtrace for errors in these functions."),
4411  NULL,
4413  },
4415  "",
4417  },
4418 
4419  /* End-of-list marker */
4420  {
4421  {NULL, 0, 0, NULL, NULL}, NULL, NULL, NULL, NULL, NULL
4422  }
4423 };
4424 
4425 
4427 {
4428  {
4429  {"backslash_quote", PGC_USERSET, COMPAT_OPTIONS_PREVIOUS,
4430  gettext_noop("Sets whether \"\\'\" is allowed in string literals."),
4431  NULL
4432  },
4433  &backslash_quote,
4435  NULL, NULL, NULL
4436  },
4437 
4438  {
4439  {"bytea_output", PGC_USERSET, CLIENT_CONN_STATEMENT,
4440  gettext_noop("Sets the output format for bytea."),
4441  NULL
4442  },
4443  &bytea_output,
4445  NULL, NULL, NULL
4446  },
4447 
4448  {
4449  {"client_min_messages", PGC_USERSET, CLIENT_CONN_STATEMENT,
4450  gettext_noop("Sets the message levels that are sent to the client."),
4451  gettext_noop("Each level includes all the levels that follow it. The later"
4452  " the level, the fewer messages are sent.")
4453  },
4456  NULL, NULL, NULL
4457  },
4458 
4459  {
4460  {"constraint_exclusion", PGC_USERSET, QUERY_TUNING_OTHER,
4461  gettext_noop("Enables the planner to use constraints to optimize queries."),
4462  gettext_noop("Table scans will be skipped if their constraints"
4463  " guarantee that no rows match the query."),
4464  GUC_EXPLAIN
4465  },
4468  NULL, NULL, NULL
4469  },
4470 
4471  {
4472  {"default_transaction_isolation", PGC_USERSET, CLIENT_CONN_STATEMENT,
4473  gettext_noop("Sets the transaction isolation level of each new transaction."),
4474  NULL
4475  },
4478  NULL, NULL, NULL
4479  },
4480 
4481  {
4482  {"transaction_isolation", PGC_USERSET, CLIENT_CONN_STATEMENT,
4483  gettext_noop("Sets the current transaction's isolation level."),
4484  NULL,
4486  },
4487  &XactIsoLevel,
4489  check_XactIsoLevel, NULL, NULL
4490  },
4491 
4492  {
4493  {"IntervalStyle", PGC_USERSET, CLIENT_CONN_LOCALE,
4494  gettext_noop("Sets the display format for interval values."),
4495  NULL,
4496  GUC_REPORT
4497  },
4498  &IntervalStyle,
4500  NULL, NULL, NULL
4501  },
4502 
4503  {
4504  {"log_error_verbosity", PGC_SUSET, LOGGING_WHAT,
4505  gettext_noop("Sets the verbosity of logged messages."),
4506  NULL
4507  },
4510  NULL, NULL, NULL
4511  },
4512 
4513  {
4514  {"log_min_messages", PGC_SUSET, LOGGING_WHEN,
4515  gettext_noop("Sets the message levels that are logged."),
4516  gettext_noop("Each level includes all the levels that follow it. The later"
4517  " the level, the fewer messages are sent.")
4518  },
4521  NULL, NULL, NULL
4522  },
4523 
4524  {
4525  {"log_min_error_statement", PGC_SUSET, LOGGING_WHEN,
4526  gettext_noop("Causes all statements generating error at or above this level to be logged."),
4527  gettext_noop("Each level includes all the levels that follow it. The later"
4528  " the level, the fewer messages are sent.")
4529  },
4532  NULL, NULL, NULL
4533  },
4534 
4535  {
4536  {"log_statement", PGC_SUSET, LOGGING_WHAT,
4537  gettext_noop("Sets the type of statements logged."),
4538  NULL
4539  },
4540  &log_statement,
4542  NULL, NULL, NULL
4543  },
4544 
4545  {
4546  {"syslog_facility", PGC_SIGHUP, LOGGING_WHERE,
4547  gettext_noop("Sets the syslog \"facility\" to be used when syslog enabled."),
4548  NULL
4549  },
4550  &syslog_facility,
4551 #ifdef HAVE_SYSLOG
4552  LOG_LOCAL0,
4553 #else
4554  0,
4555 #endif
4557  NULL, assign_syslog_facility, NULL
4558  },
4559 
4560  {
4561  {"session_replication_role", PGC_SUSET, CLIENT_CONN_STATEMENT,
4562  gettext_noop("Sets the session's behavior for triggers and rewrite rules."),
4563  NULL
4564  },
4568  },
4569 
4570  {
4571  {"synchronous_commit", PGC_USERSET, WAL_SETTINGS,
4572  gettext_noop("Sets the current transaction's synchronization level."),
4573  NULL
4574  },
4577  NULL, assign_synchronous_commit, NULL
4578  },
4579 
4580  {
4581  {"archive_mode", PGC_POSTMASTER, WAL_ARCHIVING,
4582  gettext_noop("Allows archiving of WAL files using archive_command."),
4583  NULL
4584  },
4585  &XLogArchiveMode,
4587  NULL, NULL, NULL
4588  },
4589 
4590  {
4591  {"recovery_target_action", PGC_POSTMASTER, WAL_RECOVERY_TARGET,
4592  gettext_noop("Sets the action to perform upon reaching the recovery target."),
4593  NULL
4594  },
4597  NULL, NULL, NULL
4598  },
4599 
4600  {
4601  {"trace_recovery_messages", PGC_SIGHUP, DEVELOPER_OPTIONS,
4602  gettext_noop("Enables logging of recovery-related debugging information."),
4603  gettext_noop("Each level includes all the levels that follow it. The later"
4604  " the level, the fewer messages are sent.")
4605  },
4607 
4608  /*
4609  * client_message_level_options allows too many values, really, but
4610  * it's not worth having a separate options array for this.
4611  */
4613  NULL, NULL, NULL
4614  },
4615 
4616  {
4617  {"track_functions", PGC_SUSET, STATS_COLLECTOR,
4618  gettext_noop("Collects function-level statistics on database activity."),
4619  NULL
4620  },
4623  NULL, NULL, NULL
4624  },
4625 
4626  {
4627  {"wal_level", PGC_POSTMASTER, WAL_SETTINGS,
4628  gettext_noop("Set the level of information written to the WAL."),
4629  NULL
4630  },
4631  &wal_level,
4633  NULL, NULL, NULL
4634  },
4635 
4636  {
4637  {"dynamic_shared_memory_type", PGC_POSTMASTER, RESOURCES_MEM,
4638  gettext_noop("Selects the dynamic shared memory implementation used."),
4639  NULL
4640  },
4643  NULL, NULL, NULL
4644  },
4645 
4646  {
4647  {"shared_memory_type", PGC_POSTMASTER, RESOURCES_MEM,
4648  gettext_noop("Selects the shared memory implementation used for the main shared memory region."),
4649  NULL
4650  },
4653  NULL, NULL, NULL
4654  },
4655 
4656  {
4657  {"wal_sync_method", PGC_SIGHUP, WAL_SETTINGS,
4658  gettext_noop("Selects the method used for forcing WAL updates to disk."),
4659  NULL
4660  },
4661  &sync_method,
4663  NULL, assign_xlog_sync_method, NULL
4664  },
4665 
4666  {
4667  {"xmlbinary", PGC_USERSET, CLIENT_CONN_STATEMENT,
4668  gettext_noop("Sets how binary values are to be encoded in XML."),
4669  NULL
4670  },
4671  &xmlbinary,
4673  NULL, NULL, NULL
4674  },
4675 
4676  {
4677  {"xmloption", PGC_USERSET, CLIENT_CONN_STATEMENT,
4678  gettext_noop("Sets whether XML data in implicit parsing and serialization "
4679  "operations is to be considered as documents or content fragments."),
4680  NULL
4681  },
4682  &xmloption,
4684  NULL, NULL, NULL
4685  },
4686 
4687  {
4688  {"huge_pages", PGC_POSTMASTER, RESOURCES_MEM,
4689  gettext_noop("Use of huge pages on Linux or Windows."),
4690  NULL
4691  },
4692  &huge_pages,
4694  NULL, NULL, NULL
4695  },
4696 
4697  {
4698  {"force_parallel_mode", PGC_USERSET, QUERY_TUNING_OTHER,
4699  gettext_noop("Forces use of parallel query facilities."),
4700  gettext_noop("If possible, run query using a parallel worker and with parallel restrictions."),
4701  GUC_EXPLAIN
4702  },
4705  NULL, NULL, NULL
4706  },
4707 
4708  {
4709  {"password_encryption", PGC_USERSET, CONN_AUTH_AUTH,
4710  gettext_noop("Encrypt passwords."),
4711  gettext_noop("When a password is specified in CREATE USER or "
4712  "ALTER USER without writing either ENCRYPTED or UNENCRYPTED, "
4713  "this parameter determines whether the password is to be encrypted.")
4714  },
4717  NULL, NULL, NULL
4718  },
4719 
4720  {
4721  {"plan_cache_mode", PGC_USERSET, QUERY_TUNING_OTHER,
4722  gettext_noop("Controls the planner's selection of custom or generic plan."),
4723  gettext_noop("Prepared statements can have custom and generic plans, and the planner "
4724  "will attempt to choose which is better. This can be set to override "
4725  "the default behavior."),
4726  GUC_EXPLAIN
4727  },
4728  &plan_cache_mode,
4730  NULL, NULL, NULL
4731  },
4732 
4733  {
4734  {"ssl_min_protocol_version", PGC_SIGHUP, CONN_AUTH_SSL,
4735  gettext_noop("Sets the minimum SSL/TLS protocol version to use."),
4736  NULL,
4738  },
4741  ssl_protocol_versions_info + 1, /* don't allow PG_TLS_ANY */
4742  NULL, NULL, NULL
4743  },
4744 
4745  {
4746  {"ssl_max_protocol_version", PGC_SIGHUP, CONN_AUTH_SSL,
4747  gettext_noop("Sets the maximum SSL/TLS protocol version to use."),
4748  NULL,
4750  },
4752  PG_TLS_ANY,
4754  NULL, NULL, NULL
4755  },
4756 
4757  /* End-of-list marker */
4758  {
4759  {NULL, 0, 0, NULL, NULL}, NULL, 0, NULL, NULL, NULL, NULL
4760  }
4761 };
4762 
4763 /******** end of options list ********/
4764 
4765 
4766 /*
4767  * To allow continued support of obsolete names for GUC variables, we apply
4768  * the following mappings to any unrecognized name. Note that an old name
4769  * should be mapped to a new one only if the new variable has very similar
4770  * semantics to the old.
4771  */
4772 static const char *const map_old_guc_names[] = {
4773  "sort_mem", "work_mem",
4774  "vacuum_mem", "maintenance_work_mem",
4775  NULL
4776 };
4777 
4778 
4779 /*
4780  * Actual lookup of variables is done through this single, sorted array.
4781  */
4783 
4784 /* Current number of variables contained in the vector */
4786 
4787 /* Vector capacity */
4789 
4790 
4791 static bool guc_dirty; /* true if need to do commit/abort work */
4792 
4793 static bool reporting_enabled; /* true to enable GUC_REPORT */
4794 
4795 static int GUCNestLevel = 0; /* 1 when in main transaction */
4796 
4797 
4798 static int guc_var_compare(const void *a, const void *b);
4799 static int guc_name_compare(const char *namea, const char *nameb);
4800 static void InitializeGUCOptionsFromEnvironment(void);
4801 static void InitializeOneGUCOption(struct config_generic *gconf);
4802 static void push_old_value(struct config_generic *gconf, GucAction action);
4803 static void ReportGUCOption(struct config_generic *record);
4804 static void reapply_stacked_values(struct config_generic *variable,
4805  struct config_string *pHolder,
4806  GucStack *stack,
4807  const char *curvalue,
4808  GucContext curscontext, GucSource cursource);
4809 static void ShowGUCConfigOption(const char *name, DestReceiver *dest);
4810 static void ShowAllGUCConfig(DestReceiver *dest);
4811 static char *_ShowOption(struct config_generic *record, bool use_units);
4812 static bool validate_option_array_item(const char *name, const char *value,
4813  bool skipIfNoPermissions);
4814 static void write_auto_conf_file(int fd, const char *filename, ConfigVariable *head_p);
4815 static void replace_auto_config_value(ConfigVariable **head_p, ConfigVariable **tail_p,
4816  const char *name, const char *value);
4817 
4818 
4819 /*
4820  * Some infrastructure for checking malloc/strdup/realloc calls
4821  */
4822 static void *
4823 guc_malloc(int elevel, size_t size)
4824 {
4825  void *data;
4826 
4827  /* Avoid unportable behavior of malloc(0) */
4828  if (size == 0)
4829  size = 1;
4830  data = malloc(size);
4831  if (data == NULL)
4832  ereport(elevel,
4833  (errcode(ERRCODE_OUT_OF_MEMORY),
4834  errmsg("out of memory")));
4835  return data;
4836 }
4837 
4838 static void *
4839 guc_realloc(int elevel, void *old, size_t size)
4840 {
4841  void *data;
4842 
4843  /* Avoid unportable behavior of realloc(NULL, 0) */
4844  if (old == NULL && size == 0)
4845  size = 1;
4846  data = realloc(old, size);
4847  if (data == NULL)
4848  ereport(elevel,
4849  (errcode(ERRCODE_OUT_OF_MEMORY),
4850  errmsg("out of memory")));
4851  return data;
4852 }
4853 
4854 static char *
4855 guc_strdup(int elevel, const char *src)
4856 {
4857  char *data;
4858 
4859  data = strdup(src);
4860  if (data == NULL)
4861  ereport(elevel,
4862  (errcode(ERRCODE_OUT_OF_MEMORY),
4863  errmsg("out of memory")));
4864  return data;
4865 }
4866 
4867 
4868 /*
4869  * Detect whether strval is referenced anywhere in a GUC string item
4870  */
4871 static bool
4872 string_field_used(struct config_string *conf, char *strval)
4873 {
4874  GucStack *stack;
4875 
4876  if (strval == *(conf->variable) ||
4877  strval == conf->reset_val ||
4878  strval == conf->boot_val)
4879  return true;
4880  for (stack = conf->gen.stack; stack; stack = stack->prev)
4881  {
4882  if (strval == stack->prior.val.stringval ||
4883  strval == stack->masked.val.stringval)
4884  return true;
4885  }
4886  return false;
4887 }
4888 
4889 /*
4890  * Support for assigning to a field of a string GUC item. Free the prior
4891  * value if it's not referenced anywhere else in the item (including stacked
4892  * states).
4893  */
4894 static void
4895 set_string_field(struct config_string *conf, char **field, char *newval)
4896 {
4897  char *oldval = *field;
4898 
4899  /* Do the assignment */
4900  *field = newval;
4901 
4902  /* Free old value if it's not NULL and isn't referenced anymore */
4903  if (oldval && !string_field_used(conf, oldval))
4904  free(oldval);
4905 }
4906 
4907 /*
4908  * Detect whether an "extra" struct is referenced anywhere in a GUC item
4909  */
4910 static bool
4911 extra_field_used(struct config_generic *gconf, void *extra)
4912 {
4913  GucStack *stack;
4914 
4915  if (extra == gconf->extra)
4916  return true;
4917  switch (gconf->vartype)
4918  {
4919  case PGC_BOOL:
4920  if (extra == ((struct config_bool *) gconf)->reset_extra)
4921  return true;
4922  break;
4923  case PGC_INT:
4924  if (extra == ((struct config_int *) gconf)->reset_extra)
4925  return true;
4926  break;
4927  case PGC_REAL:
4928  if (extra == ((struct config_real *) gconf)->reset_extra)
4929  return true;
4930  break;
4931  case PGC_STRING:
4932  if (extra == ((struct config_string *) gconf)->reset_extra)
4933  return true;
4934  break;
4935  case PGC_ENUM:
4936  if (extra == ((struct config_enum *) gconf)->reset_extra)
4937  return true;
4938  break;
4939  }
4940  for (stack = gconf->stack; stack; stack = stack->prev)
4941  {
4942  if (extra == stack->prior.extra ||
4943  extra == stack->masked.extra)
4944  return true;
4945  }
4946 
4947  return false;
4948 }
4949 
4950 /*
4951  * Support for assigning to an "extra" field of a GUC item. Free the prior
4952  * value if it's not referenced anywhere else in the item (including stacked
4953  * states).
4954  */
4955 static void
4956 set_extra_field(struct config_generic *gconf, void **field, void *newval)
4957 {
4958  void *oldval = *field;
4959 
4960  /* Do the assignment */
4961  *field = newval;
4962 
4963  /* Free old value if it's not NULL and isn't referenced anymore */
4964  if (oldval && !extra_field_used(gconf, oldval))
4965  free(oldval);
4966 }
4967 
4968 /*
4969  * Support for copying a variable's active value into a stack entry.
4970  * The "extra" field associated with the active value is copied, too.
4971  *
4972  * NB: be sure stringval and extra fields of a new stack entry are
4973  * initialized to NULL before this is used, else we'll try to free() them.
4974  */
4975 static void
4977 {
4978  switch (gconf->vartype)
4979  {
4980  case PGC_BOOL:
4981  val->val.boolval =
4982  *((struct config_bool *) gconf)->variable;
4983  break;
4984  case PGC_INT:
4985  val->val.intval =
4986  *((struct config_int *) gconf)->variable;
4987  break;
4988  case PGC_REAL:
4989  val->val.realval =
4990  *((struct config_real *) gconf)->variable;
4991  break;
4992  case PGC_STRING:
4993  set_string_field((struct config_string *) gconf,
4994  &(val->val.stringval),
4995  *((struct config_string *) gconf)->variable);
4996  break;
4997  case PGC_ENUM:
4998  val->val.enumval =
4999  *((struct config_enum *) gconf)->variable;
5000  break;
5001  }
5002  set_extra_field(gconf, &(val->extra), gconf->extra);
5003 }
5004 
5005 /*
5006  * Support for discarding a no-longer-needed value in a stack entry.
5007  * The "extra" field associated with the stack entry is cleared, too.
5008  */
5009 static void
5011 {
5012  switch (gconf->vartype)
5013  {
5014  case PGC_BOOL:
5015  case PGC_INT:
5016  case PGC_REAL:
5017  case PGC_ENUM:
5018  /* no need to do anything */
5019  break;
5020  case PGC_STRING:
5021  set_string_field((struct config_string *) gconf,
5022  &(val->val.stringval),
5023  NULL);
5024  break;
5025  }
5026  set_extra_field(gconf, &(val->extra), NULL);
5027 }
5028 
5029 
5030 /*
5031  * Fetch the sorted array pointer (exported for help_config.c's use ONLY)
5032  */
5033 struct config_generic **
5035 {
5036  return guc_variables;
5037 }
5038 
5039 
5040 /*
5041  * Build the sorted array. This is split out so that it could be
5042  * re-executed after startup (e.g., we could allow loadable modules to
5043  * add vars, and then we'd need to re-sort).
5044  */
5045 void
5047 {
5048  int size_vars;
5049  int num_vars = 0;
5050  struct config_generic **guc_vars;
5051  int i;
5052 
5053  for (i = 0; ConfigureNamesBool[i].gen.name; i++)
5054  {
5055  struct config_bool *conf = &ConfigureNamesBool[i];
5056 
5057  /* Rather than requiring vartype to be filled in by hand, do this: */
5058  conf->gen.vartype = PGC_BOOL;
5059  num_vars++;
5060  }
5061 
5062  for (i = 0; ConfigureNamesInt[i].gen.name; i++)
5063  {
5064  struct config_int *conf = &ConfigureNamesInt[i];
5065 
5066  conf->gen.vartype = PGC_INT;
5067  num_vars++;
5068  }
5069 
5070  for (i = 0; ConfigureNamesReal[i].gen.name; i++)
5071  {
5072  struct config_real *conf = &ConfigureNamesReal[i];
5073 
5074  conf->gen.vartype = PGC_REAL;
5075  num_vars++;
5076  }
5077 
5078  for (i = 0; ConfigureNamesString[i].gen.name; i++)
5079  {
5080  struct config_string *conf = &ConfigureNamesString[i];
5081 
5082  conf->gen.vartype = PGC_STRING;
5083  num_vars++;
5084  }
5085 
5086  for (i = 0; ConfigureNamesEnum[i].gen.name; i++)
5087  {
5088  struct config_enum *conf = &ConfigureNamesEnum[i];
5089 
5090  conf->gen.vartype = PGC_ENUM;
5091  num_vars++;
5092  }
5093 
5094  /*
5095  * Create table with 20% slack
5096  */
5097  size_vars = num_vars + num_vars / 4;
5098 
5099  guc_vars = (struct config_generic **)
5100  guc_malloc(FATAL, size_vars * sizeof(struct config_generic *));
5101 
5102  num_vars = 0;
5103 
5104  for (i = 0; ConfigureNamesBool[i].gen.name; i++)
5105  guc_vars[num_vars++] = &ConfigureNamesBool[i].gen;
5106 
5107  for (i = 0; ConfigureNamesInt[i].gen.name; i++)
5108  guc_vars[num_vars++] = &ConfigureNamesInt[i].gen;
5109 
5110  for (i = 0; ConfigureNamesReal[i].gen.name; i++)
5111  guc_vars[num_vars++] = &ConfigureNamesReal[i].gen;
5112 
5113  for (i = 0; ConfigureNamesString[i].gen.name; i++)
5114  guc_vars[num_vars++] = &ConfigureNamesString[i].gen;
5115 
5116  for (i = 0; ConfigureNamesEnum[i].gen.name; i++)
5117  guc_vars[num_vars++] = &ConfigureNamesEnum[i].gen;
5118 
5119  if (guc_variables)
5120  free(guc_variables);
5121  guc_variables = guc_vars;
5122  num_guc_variables = num_vars;
5123  size_guc_variables = size_vars;
5124  qsort((void *) guc_variables, num_guc_variables,
5125  sizeof(struct config_generic *), guc_var_compare);
5126 }
5127 
5128 /*
5129  * Add a new GUC variable to the list of known variables. The
5130  * list is expanded if needed.
5131  */
5132 static bool
5133 add_guc_variable(struct config_generic *var, int elevel)
5134 {
5135  if (num_guc_variables + 1 >= size_guc_variables)
5136  {
5137  /*
5138  * Increase the vector by 25%
5139  */
5140  int size_vars = size_guc_variables + size_guc_variables / 4;
5141  struct config_generic **guc_vars;
5142 
5143  if (size_vars == 0)
5144  {
5145  size_vars = 100;
5146  guc_vars = (struct config_generic **)
5147  guc_malloc(elevel, size_vars * sizeof(struct config_generic *));
5148  }
5149  else
5150  {
5151  guc_vars = (struct config_generic **)
5152  guc_realloc(elevel, guc_variables, size_vars * sizeof(struct config_generic *));
5153  }
5154 
5155  if (guc_vars == NULL)
5156  return false; /* out of memory */
5157 
5158  guc_variables = guc_vars;
5159  size_guc_variables = size_vars;
5160  }
5161  guc_variables[num_guc_variables++] = var;
5162  qsort((void *) guc_variables, num_guc_variables,
5163  sizeof(struct config_generic *), guc_var_compare);
5164  return true;
5165 }
5166 
5167 /*
5168  * Create and add a placeholder variable for a custom variable name.
5169  */
5170 static struct config_generic *
5171 add_placeholder_variable(const char *name, int elevel)
5172 {
5173  size_t sz = sizeof(struct config_string) + sizeof(char *);
5174  struct config_string *var;
5175  struct config_generic *gen;
5176 
5177  var = (struct config_string *) guc_malloc(elevel, sz);
5178  if (var == NULL)
5179  return NULL;
5180  memset(var, 0, sz);
5181  gen = &var->gen;
5182 
5183  gen->name = guc_strdup(elevel, name);
5184  if (gen->name == NULL)
5185  {
5186  free(var);
5187  return NULL;
5188  }
5189 
5190  gen->context = PGC_USERSET;
5191  gen->group = CUSTOM_OPTIONS;
5192  gen->short_desc = "GUC placeholder variable";
5194  gen->vartype = PGC_STRING;
5195 
5196  /*
5197  * The char* is allocated at the end of the struct since we have no
5198  * 'static' place to point to. Note that the current value, as well as
5199  * the boot and reset values, start out NULL.
5200  */
5201  var->variable = (char **) (var + 1);
5202 
5203  if (!add_guc_variable((struct config_generic *) var, elevel))
5204  {
5205  free(unconstify(char *, gen->name));
5206  free(var);
5207  return NULL;
5208  }
5209 
5210  return gen;
5211 }
5212 
5213 /*
5214  * Look up option NAME. If it exists, return a pointer to its record,
5215  * else return NULL. If create_placeholders is true, we'll create a
5216  * placeholder record for a valid-looking custom variable name.
5217  */
5218 static struct config_generic *
5219 find_option(const char *name, bool create_placeholders, int elevel)
5220 {
5221  const char **key = &name;
5222  struct config_generic **res;
5223  int i;
5224 
5225  Assert(name);
5226 
5227  /*
5228  * By equating const char ** with struct config_generic *, we are assuming
5229  * the name field is first in config_generic.
5230  */
5231  res = (struct config_generic **) bsearch((void *) &key,
5232  (void *) guc_variables,
5233  num_guc_variables,
5234  sizeof(struct config_generic *),
5235  guc_var_compare);
5236  if (res)
5237  return *res;
5238 
5239  /*
5240  * See if the name is an obsolete name for a variable. We assume that the
5241  * set of supported old names is short enough that a brute-force search is
5242  * the best way.
5243  */
5244  for (i = 0; map_old_guc_names[i] != NULL; i += 2)
5245  {
5246  if (guc_name_compare(name, map_old_guc_names[i]) == 0)
5247  return find_option(map_old_guc_names[i + 1], false, elevel);
5248  }
5249 
5250  if (create_placeholders)
5251  {
5252  /*
5253  * Check if the name is qualified, and if so, add a placeholder.
5254  */
5255  if (strchr(name, GUC_QUALIFIER_SEPARATOR) != NULL)
5256  return add_placeholder_variable(name, elevel);
5257  }
5258 
5259  /* Unknown name */
5260  return NULL;
5261 }
5262 
5263 
5264 /*
5265  * comparator for qsorting and bsearching guc_variables array
5266  */
5267 static int
5268 guc_var_compare(const void *a, const void *b)
5269 {
5270  const struct config_generic *confa = *(struct config_generic *const *) a;
5271  const struct config_generic *confb = *(struct config_generic *const *) b;
5272 
5273  return guc_name_compare(confa->name, confb->name);
5274 }
5275 
5276 /*
5277  * the bare comparison function for GUC names
5278  */
5279 static int
5280 guc_name_compare(const char *namea, const char *nameb)
5281 {
5282  /*
5283  * The temptation to use strcasecmp() here must be resisted, because the
5284  * array ordering has to remain stable across setlocale() calls. So, build
5285  * our own with a simple ASCII-only downcasing.
5286  */
5287  while (*namea && *nameb)
5288  {
5289  char cha = *namea++;
5290  char chb = *nameb++;
5291 
5292  if (cha >= 'A' && cha <= 'Z')
5293  cha += 'a' - 'A';
5294  if (chb >= 'A' && chb <= 'Z')
5295  chb += 'a' - 'A';
5296  if (cha != chb)
5297  return cha - chb;
5298  }
5299  if (*namea)
5300  return 1; /* a is longer */
5301  if (*nameb)
5302  return -1; /* b is longer */
5303  return 0;
5304 }
5305 
5306 
5307 /*
5308  * Initialize GUC options during program startup.
5309  *
5310  * Note that we cannot read the config file yet, since we have not yet
5311  * processed command-line switches.
5312  */
5313 void
5315 {
5316  int i;
5317 
5318  /*
5319  * Before log_line_prefix could possibly receive a nonempty setting, make
5320  * sure that timezone processing is minimally alive (see elog.c).
5321  */
5323 
5324  /*
5325  * Build sorted array of all GUC variables.
5326  */
5328 
5329  /*
5330  * Load all variables with their compiled-in defaults, and initialize
5331  * status fields as needed.
5332  */
5333  for (i = 0; i < num_guc_variables; i++)
5334  {
5335  InitializeOneGUCOption(guc_variables[i]);
5336  }
5337 
5338  guc_dirty = false;
5339 
5340  reporting_enabled = false;
5341 
5342  /*
5343  * Prevent any attempt to override the transaction modes from
5344  * non-interactive sources.
5345  */
5346  SetConfigOption("transaction_isolation", "read committed",
5348  SetConfigOption("transaction_read_only", "no",
5350  SetConfigOption("transaction_deferrable", "no",
5352 
5353  /*
5354  * For historical reasons, some GUC parameters can receive defaults from
5355  * environment variables. Process those settings.
5356  */
5358 }
5359 
5360 /*
5361  * Assign any GUC values that can come from the server's environment.
5362  *
5363  * This is called from InitializeGUCOptions, and also from ProcessConfigFile
5364  * to deal with the possibility that a setting has been removed from
5365  * postgresql.conf and should now get a value from the environment.
5366  * (The latter is a kludge that should probably go away someday; if so,
5367  * fold this back into InitializeGUCOptions.)
5368  */
5369 static void
5371 {
5372  char *env;
5373  long stack_rlimit;
5374 
5375  env = getenv("PGPORT");
5376  if (env != NULL)
5378 
5379  env = getenv("PGDATESTYLE");
5380  if (env != NULL)
5381  SetConfigOption("datestyle", env, PGC_POSTMASTER, PGC_S_ENV_VAR);
5382 
5383  env = getenv("PGCLIENTENCODING");
5384  if (env != NULL)
5385  SetConfigOption("client_encoding", env, PGC_POSTMASTER, PGC_S_ENV_VAR);
5386 
5387  /*
5388  * rlimit isn't exactly an "environment variable", but it behaves about
5389  * the same. If we can identify the platform stack depth rlimit, increase
5390  * default stack depth setting up to whatever is safe (but at most 2MB).
5391  */
5392  stack_rlimit = get_stack_depth_rlimit();
5393  if (stack_rlimit > 0)
5394  {
5395  long new_limit = (stack_rlimit - STACK_DEPTH_SLOP) / 1024L;
5396 
5397  if (new_limit > 100)
5398  {
5399  char limbuf[16];
5400 
5401  new_limit = Min(new_limit, 2048);
5402  sprintf(limbuf, "%ld", new_limit);
5403  SetConfigOption("max_stack_depth", limbuf,
5405  }
5406  }
5407 }
5408 
5409 /*
5410  * Initialize one GUC option variable to its compiled-in default.
5411  *
5412  * Note: the reason for calling check_hooks is not that we think the boot_val
5413  * might fail, but that the hooks might wish to compute an "extra" struct.
5414  */
5415 static void
5417 {
5418  gconf->status = 0;
5419  gconf->source = PGC_S_DEFAULT;
5420  gconf->reset_source = PGC_S_DEFAULT;
5421  gconf->scontext = PGC_INTERNAL;
5422  gconf->reset_scontext = PGC_INTERNAL;
5423  gconf->stack = NULL;
5424  gconf->extra = NULL;
5425  gconf->sourcefile = NULL;
5426  gconf->sourceline = 0;
5427 
5428  switch (gconf->vartype)
5429  {
5430  case PGC_BOOL:
5431  {
5432  struct config_bool *conf = (struct config_bool *) gconf;
5433  bool newval = conf->boot_val;
5434  void *extra = NULL;
5435 
5436  if (!call_bool_check_hook(conf, &newval, &extra,
5437  PGC_S_DEFAULT, LOG))
5438  elog(FATAL, "failed to initialize %s to %d",
5439  conf->gen.name, (int) newval);
5440  if (conf->assign_hook)
5441  conf->assign_hook(newval, extra);
5442  *conf->variable = conf->reset_val = newval;
5443  conf->gen.extra = conf->reset_extra = extra;
5444  break;
5445  }
5446  case PGC_INT:
5447  {
5448  struct config_int *conf = (struct config_int *) gconf;
5449  int newval = conf->boot_val;
5450  void *extra = NULL;
5451 
5452  Assert(newval >= conf->min);
5453  Assert(newval <= conf->max);
5454  if (!call_int_check_hook(conf, &newval, &extra,
5455  PGC_S_DEFAULT, LOG))
5456  elog(FATAL, "failed to initialize %s to %d",
5457  conf->gen.name, newval);
5458  if (conf->assign_hook)
5459  conf->assign_hook(newval, extra);
5460  *conf->variable = conf->reset_val = newval;
5461  conf->gen.extra = conf->reset_extra = extra;
5462  break;
5463  }
5464  case PGC_REAL:
5465  {
5466  struct config_real *conf = (struct config_real *) gconf;
5467  double newval = conf->boot_val;
5468  void *extra = NULL;
5469 
5470  Assert(newval >= conf->min);
5471  Assert(newval <= conf->max);
5472  if (!call_real_check_hook(conf, &newval, &extra,
5473  PGC_S_DEFAULT, LOG))
5474  elog(FATAL, "failed to initialize %s to %g",
5475  conf->gen.name, newval);
5476  if (conf->assign_hook)
5477  conf->assign_hook(newval, extra);
5478  *conf->variable = conf->reset_val = newval;
5479  conf->gen.extra = conf->reset_extra = extra;
5480  break;
5481  }
5482  case PGC_STRING:
5483  {
5484  struct config_string *conf = (struct config_string *) gconf;
5485  char *newval;
5486  void *extra = NULL;
5487 
5488  /* non-NULL boot_val must always get strdup'd */
5489  if (conf->boot_val != NULL)
5490  newval = guc_strdup(FATAL, conf->boot_val);
5491  else
5492  newval = NULL;
5493 
5494  if (!call_string_check_hook(conf, &newval, &extra,
5495  PGC_S_DEFAULT, LOG))
5496  elog(FATAL, "failed to initialize %s to \"%s\"",
5497  conf->gen.name, newval ? newval : "");
5498  if (conf->assign_hook)
5499  conf->assign_hook(newval, extra);
5500  *conf->variable = conf->reset_val = newval;
5501  conf->gen.extra = conf->reset_extra = extra;
5502  break;
5503  }
5504  case PGC_ENUM:
5505  {
5506  struct config_enum *conf = (struct config_enum *) gconf;
5507  int newval = conf->boot_val;
5508  void *extra = NULL;
5509 
5510  if (!call_enum_check_hook(conf, &newval, &extra,
5511  PGC_S_DEFAULT, LOG))
5512  elog(FATAL, "failed to initialize %s to %d",
5513  conf->gen.name, newval);
5514  if (conf->assign_hook)
5515  conf->assign_hook(newval, extra);
5516  *conf->variable = conf->reset_val = newval;
5517  conf->gen.extra = conf->reset_extra = extra;
5518  break;
5519  }
5520  }
5521 }
5522 
5523 
5524 /*
5525  * Select the configuration files and data directory to be used, and
5526  * do the initial read of postgresql.conf.
5527  *
5528  * This is called after processing command-line switches.
5529  * userDoption is the -D switch value if any (NULL if unspecified).
5530  * progname is just for use in error messages.
5531  *
5532  * Returns true on success; on failure, prints a suitable error message
5533  * to stderr and returns false.
5534  */
5535 bool
5536 SelectConfigFiles(const char *userDoption, const char *progname)
5537 {
5538  char *configdir;
5539  char *fname;
5540  struct stat stat_buf;
5541 
5542  /* configdir is -D option, or $PGDATA if no -D */
5543  if (userDoption)
5544  configdir = make_absolute_path(userDoption);
5545  else
5546  configdir = make_absolute_path(getenv("PGDATA"));
5547 
5548  if (configdir && stat(configdir, &stat_buf) != 0)
5549  {
5550  write_stderr("%s: could not access directory \"%s\": %s\n",
5551  progname,
5552  configdir,
5553  strerror(errno));
5554  if (errno == ENOENT)
5555  write_stderr("Run initdb or pg_basebackup to initialize a PostgreSQL data directory.\n");
5556  return false;
5557  }
5558 
5559  /*
5560  * Find the configuration file: if config_file was specified on the
5561  * command line, use it, else use configdir/postgresql.conf. In any case
5562  * ensure the result is an absolute path, so that it will be interpreted
5563  * the same way by future backends.
5564  */
5565  if (ConfigFileName)
5566  fname = make_absolute_path(ConfigFileName);
5567  else if (configdir)
5568  {
5569  fname = guc_malloc(FATAL,
5570  strlen(configdir) + strlen(CONFIG_FILENAME) + 2);
5571  sprintf(fname, "%s/%s", configdir, CONFIG_FILENAME);
5572  }
5573  else
5574  {
5575  write_stderr("%s does not know where to find the server configuration file.\n"
5576  "You must specify the --config-file or -D invocation "
5577  "option or set the PGDATA environment variable.\n",
5578  progname);
5579  return false;
5580  }
5581 
5582  /*
5583  * Set the ConfigFileName GUC variable to its final value, ensuring that
5584  * it can't be overridden later.
5585  */
5586  SetConfigOption("config_file", fname, PGC_POSTMASTER, PGC_S_OVERRIDE);
5587  free(fname);
5588 
5589  /*
5590  * Now read the config file for the first time.
5591  */
5592  if (stat(ConfigFileName, &stat_buf) != 0)
5593  {
5594  write_stderr("%s: could not access the server configuration file \"%s\": %s\n",
5595  progname, ConfigFileName, strerror(errno));
5596  free(configdir);
5597  return false;
5598  }
5599 
5600  /*
5601  * Read the configuration file for the first time. This time only the
5602  * data_directory parameter is picked up to determine the data directory,
5603  * so that we can read the PG_AUTOCONF_FILENAME file next time.
5604  */
5606 
5607  /*
5608  * If the data_directory GUC variable has been set, use that as DataDir;
5609  * otherwise use configdir if set; else punt.
5610  *
5611  * Note: SetDataDir will copy and absolute-ize its argument, so we don't
5612  * have to.
5613  */
5614  if (data_directory)
5615  SetDataDir(data_directory);
5616  else if (configdir)
5617  SetDataDir(configdir);
5618  else
5619  {
5620  write_stderr("%s does not know where to find the database system data.\n"
5621  "This can be specified as \"data_directory\" in \"%s\", "
5622  "or by the -D invocation option, or by the "
5623  "PGDATA environment variable.\n",
5624  progname, ConfigFileName);
5625  return false;
5626  }
5627 
5628  /*
5629  * Reflect the final DataDir value back into the data_directory GUC var.
5630  * (If you are wondering why we don't just make them a single variable,
5631  * it's because the EXEC_BACKEND case needs DataDir to be transmitted to
5632  * child backends specially. XXX is that still true? Given that we now
5633  * chdir to DataDir, EXEC_BACKEND can read the config file without knowing
5634  * DataDir in advance.)
5635  */
5637 
5638  /*
5639  * Now read the config file a second time, allowing any settings in the
5640  * PG_AUTOCONF_FILENAME file to take effect. (This is pretty ugly, but
5641  * since we have to determine the DataDir before we can find the autoconf
5642  * file, the alternatives seem worse.)
5643  */
5645 
5646  /*
5647  * If timezone_abbreviations wasn't set in the configuration file, install
5648  * the default value. We do it this way because we can't safely install a
5649  * "real" value until my_exec_path is set, which may not have happened
5650  * when InitializeGUCOptions runs, so the bootstrap default value cannot
5651  * be the real desired default.
5652  */
5654 
5655  /*
5656  * Figure out where pg_hba.conf is, and make sure the path is absolute.
5657  */
5658  if (HbaFileName)
5659  fname = make_absolute_path(HbaFileName);
5660  else if (configdir)
5661  {
5662  fname = guc_malloc(FATAL,
5663  strlen(configdir) + strlen(HBA_FILENAME) + 2);
5664  sprintf(fname, "%s/%s", configdir, HBA_FILENAME);
5665  }
5666  else
5667  {
5668  write_stderr("%s does not know where to find the \"hba\" configuration file.\n"
5669  "This can be specified as \"hba_file\" in \"%s\", "
5670  "or by the -D invocation option, or by the "
5671  "PGDATA environment variable.\n",
5672  progname, ConfigFileName);
5673  return false;
5674  }
5675  SetConfigOption("hba_file", fname, PGC_POSTMASTER, PGC_S_OVERRIDE);
5676  free(fname);
5677 
5678  /*
5679  * Likewise for pg_ident.conf.
5680  */
5681  if (IdentFileName)
5682  fname = make_absolute_path(IdentFileName);
5683  else if (configdir)
5684  {
5685  fname = guc_malloc(FATAL,
5686  strlen(configdir) + strlen(IDENT_FILENAME) + 2);
5687  sprintf(fname, "%s/%s", configdir, IDENT_FILENAME);
5688  }
5689  else
5690  {
5691  write_stderr("%s does not know where to find the \"ident\" configuration file.\n"
5692  "This can be specified as \"ident_file\" in \"%s\", "
5693  "or by the -D invocation option, or by the "
5694  "PGDATA environment variable.\n",
5695  progname, ConfigFileName);
5696  return false;
5697  }
5698  SetConfigOption("ident_file", fname, PGC_POSTMASTER, PGC_S_OVERRIDE);
5699  free(fname);
5700 
5701  free(configdir);
5702 
5703  return true;
5704 }
5705 
5706 
5707 /*
5708  * Reset all options to their saved default values (implements RESET ALL)
5709  */
5710 void
5712 {
5713  int i;
5714 
5715  for (i = 0; i < num_guc_variables; i++)
5716  {
5717  struct config_generic *gconf = guc_variables[i];
5718 
5719  /* Don't reset non-SET-able values */
5720  if (gconf->context != PGC_SUSET &&
5721  gconf->context != PGC_USERSET)
5722  continue;
5723  /* Don't reset if special exclusion from RESET ALL */
5724  if (gconf->flags & GUC_NO_RESET_ALL)
5725  continue;
5726  /* No need to reset if wasn't SET */
5727  if (gconf->source <= PGC_S_OVERRIDE)
5728  continue;
5729 
5730  /* Save old value to support transaction abort */
5732 
5733  switch (gconf->vartype)
5734  {
5735  case PGC_BOOL:
5736  {
5737  struct config_bool *conf = (struct config_bool *) gconf;
5738 
5739  if (conf->assign_hook)
5740  conf->assign_hook(conf->reset_val,
5741  conf->reset_extra);
5742  *conf->variable = conf->reset_val;
5743  set_extra_field(&conf->gen, &conf->gen.extra,
5744  conf->reset_extra);
5745  break;
5746  }
5747  case PGC_INT:
5748  {
5749  struct config_int *conf = (struct config_int *) gconf;
5750