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