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