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