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