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 "catalog/namespace.h"
45 #include "catalog/pg_authid.h"
46 #include "catalog/storage.h"
47 #include "commands/async.h"
48 #include "commands/prepare.h"
49 #include "commands/trigger.h"
50 #include "commands/user.h"
51 #include "commands/vacuum.h"
52 #include "commands/variable.h"
53 #include "common/string.h"
54 #include "funcapi.h"
55 #include "jit/jit.h"
56 #include "libpq/auth.h"
57 #include "libpq/libpq.h"
58 #include "libpq/pqformat.h"
59 #include "miscadmin.h"
60 #include "optimizer/cost.h"
61 #include "optimizer/geqo.h"
62 #include "optimizer/optimizer.h"
63 #include "optimizer/paths.h"
64 #include "optimizer/planmain.h"
65 #include "parser/parse_expr.h"
66 #include "parser/parse_type.h"
67 #include "parser/parser.h"
68 #include "parser/scansup.h"
69 #include "pgstat.h"
70 #include "postmaster/autovacuum.h"
72 #include "postmaster/bgwriter.h"
73 #include "postmaster/postmaster.h"
74 #include "postmaster/startup.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/queryjumble.h"
106 #include "utils/rls.h"
107 #include "utils/snapmgr.h"
108 #include "utils/tzparser.h"
109 #include "utils/inval.h"
110 #include "utils/varlena.h"
111 #include "utils/xml.h"
112 
113 #ifndef PG_KRB_SRVTAB
114 #define PG_KRB_SRVTAB ""
115 #endif
116 
117 #define CONFIG_FILENAME "postgresql.conf"
118 #define HBA_FILENAME "pg_hba.conf"
119 #define IDENT_FILENAME "pg_ident.conf"
120 
121 #ifdef EXEC_BACKEND
122 #define CONFIG_EXEC_PARAMS "global/config_exec_params"
123 #define CONFIG_EXEC_PARAMS_NEW "global/config_exec_params.new"
124 #endif
125 
126 /*
127  * Precision with which REAL type guc values are to be printed for GUC
128  * serialization.
129  */
130 #define REALTYPE_PRECISION 17
131 
132 /* XXX these should appear in other modules' header files */
133 extern bool Log_disconnections;
134 extern int CommitDelay;
135 extern int CommitSiblings;
136 extern char *default_tablespace;
137 extern char *temp_tablespaces;
138 extern bool ignore_checksum_failure;
139 extern bool ignore_invalid_pages;
140 extern bool synchronize_seqscans;
141 
142 #ifdef TRACE_SYNCSCAN
143 extern bool trace_syncscan;
144 #endif
145 #ifdef DEBUG_BOUNDED_SORT
146 extern bool optimize_bounded_sort;
147 #endif
148 
150 
151 /* global variables for check hook support */
155 
156 static void do_serialize(char **destptr, Size *maxbytes, const char *fmt,...) pg_attribute_printf(3, 4);
157 
158 static void set_config_sourcefile(const char *name, char *sourcefile,
159  int sourceline);
160 static bool call_bool_check_hook(struct config_bool *conf, bool *newval,
161  void **extra, GucSource source, int elevel);
162 static bool call_int_check_hook(struct config_int *conf, int *newval,
163  void **extra, GucSource source, int elevel);
164 static bool call_real_check_hook(struct config_real *conf, double *newval,
165  void **extra, GucSource source, int elevel);
166 static bool call_string_check_hook(struct config_string *conf, char **newval,
167  void **extra, GucSource source, int elevel);
168 static bool call_enum_check_hook(struct config_enum *conf, int *newval,
169  void **extra, GucSource source, int elevel);
170 
171 static bool check_log_destination(char **newval, void **extra, GucSource source);
172 static void assign_log_destination(const char *newval, void *extra);
173 
174 static bool check_wal_consistency_checking(char **newval, void **extra,
175  GucSource source);
176 static void assign_wal_consistency_checking(const char *newval, void *extra);
177 
178 #ifdef HAVE_SYSLOG
179 static int syslog_facility = LOG_LOCAL0;
180 #else
181 static int syslog_facility = 0;
182 #endif
183 
184 static void assign_syslog_facility(int newval, void *extra);
185 static void assign_syslog_ident(const char *newval, void *extra);
186 static void assign_session_replication_role(int newval, void *extra);
187 static bool check_temp_buffers(int *newval, void **extra, GucSource source);
188 static bool check_bonjour(bool *newval, void **extra, GucSource source);
189 static bool check_ssl(bool *newval, void **extra, GucSource source);
190 static bool check_stage_log_stats(bool *newval, void **extra, GucSource source);
191 static bool check_log_stats(bool *newval, void **extra, GucSource source);
192 static bool check_canonical_path(char **newval, void **extra, GucSource source);
193 static bool check_timezone_abbreviations(char **newval, void **extra, GucSource source);
194 static void assign_timezone_abbreviations(const char *newval, void *extra);
195 static void pg_timezone_abbrev_initialize(void);
196 static const char *show_archive_command(void);
197 static void assign_tcp_keepalives_idle(int newval, void *extra);
198 static void assign_tcp_keepalives_interval(int newval, void *extra);
199 static void assign_tcp_keepalives_count(int newval, void *extra);
200 static void assign_tcp_user_timeout(int newval, void *extra);
201 static const char *show_tcp_keepalives_idle(void);
202 static const char *show_tcp_keepalives_interval(void);
203 static const char *show_tcp_keepalives_count(void);
204 static const char *show_tcp_user_timeout(void);
205 static bool check_maxconnections(int *newval, void **extra, GucSource source);
206 static bool check_max_worker_processes(int *newval, void **extra, GucSource source);
207 static bool check_autovacuum_max_workers(int *newval, void **extra, GucSource source);
208 static bool check_max_wal_senders(int *newval, void **extra, GucSource source);
209 static bool check_autovacuum_work_mem(int *newval, void **extra, GucSource source);
210 static bool check_effective_io_concurrency(int *newval, void **extra, GucSource source);
211 static bool check_maintenance_io_concurrency(int *newval, void **extra, GucSource source);
212 static bool check_huge_page_size(int *newval, void **extra, GucSource source);
213 static bool check_client_connection_check_interval(int *newval, void **extra, GucSource source);
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 "auto" are documented, we accept
409  * all the likely variants of "on" and "off".
410  */
412  {"auto", COMPUTE_QUERY_ID_AUTO, false},
413  {"on", COMPUTE_QUERY_ID_ON, false},
414  {"off", COMPUTE_QUERY_ID_OFF, false},
415  {"true", COMPUTE_QUERY_ID_ON, true},
416  {"false", COMPUTE_QUERY_ID_OFF, true},
417  {"yes", COMPUTE_QUERY_ID_ON, true},
418  {"no", COMPUTE_QUERY_ID_OFF, true},
419  {"1", COMPUTE_QUERY_ID_ON, true},
420  {"0", COMPUTE_QUERY_ID_OFF, true},
421  {NULL, 0, false}
422 };
423 
424 /*
425  * Although only "on", "off", and "partition" are documented, we
426  * accept all the likely variants of "on" and "off".
427  */
429  {"partition", CONSTRAINT_EXCLUSION_PARTITION, false},
430  {"on", CONSTRAINT_EXCLUSION_ON, false},
431  {"off", CONSTRAINT_EXCLUSION_OFF, false},
432  {"true", CONSTRAINT_EXCLUSION_ON, true},
433  {"false", CONSTRAINT_EXCLUSION_OFF, true},
434  {"yes", CONSTRAINT_EXCLUSION_ON, true},
435  {"no", CONSTRAINT_EXCLUSION_OFF, true},
436  {"1", CONSTRAINT_EXCLUSION_ON, true},
437  {"0", CONSTRAINT_EXCLUSION_OFF, true},
438  {NULL, 0, false}
439 };
440 
441 /*
442  * Although only "on", "off", "remote_apply", "remote_write", and "local" are
443  * documented, we accept all the likely variants of "on" and "off".
444  */
446  {"local", SYNCHRONOUS_COMMIT_LOCAL_FLUSH, false},
447  {"remote_write", SYNCHRONOUS_COMMIT_REMOTE_WRITE, false},
448  {"remote_apply", SYNCHRONOUS_COMMIT_REMOTE_APPLY, false},
449  {"on", SYNCHRONOUS_COMMIT_ON, false},
450  {"off", SYNCHRONOUS_COMMIT_OFF, false},
451  {"true", SYNCHRONOUS_COMMIT_ON, true},
452  {"false", SYNCHRONOUS_COMMIT_OFF, true},
453  {"yes", SYNCHRONOUS_COMMIT_ON, true},
454  {"no", SYNCHRONOUS_COMMIT_OFF, true},
455  {"1", SYNCHRONOUS_COMMIT_ON, true},
456  {"0", SYNCHRONOUS_COMMIT_OFF, true},
457  {NULL, 0, false}
458 };
459 
460 /*
461  * Although only "on", "off", "try" are documented, we accept all the likely
462  * variants of "on" and "off".
463  */
464 static const struct config_enum_entry huge_pages_options[] = {
465  {"off", HUGE_PAGES_OFF, false},
466  {"on", HUGE_PAGES_ON, false},
467  {"try", HUGE_PAGES_TRY, false},
468  {"true", HUGE_PAGES_ON, true},
469  {"false", HUGE_PAGES_OFF, true},
470  {"yes", HUGE_PAGES_ON, true},
471  {"no", HUGE_PAGES_OFF, true},
472  {"1", HUGE_PAGES_ON, true},
473  {"0", HUGE_PAGES_OFF, true},
474  {NULL, 0, false}
475 };
476 
478  {"off", FORCE_PARALLEL_OFF, false},
479  {"on", FORCE_PARALLEL_ON, false},
480  {"regress", FORCE_PARALLEL_REGRESS, false},
481  {"true", FORCE_PARALLEL_ON, true},
482  {"false", FORCE_PARALLEL_OFF, true},
483  {"yes", FORCE_PARALLEL_ON, true},
484  {"no", FORCE_PARALLEL_OFF, true},
485  {"1", FORCE_PARALLEL_ON, true},
486  {"0", FORCE_PARALLEL_OFF, true},
487  {NULL, 0, false}
488 };
489 
491  {"auto", PLAN_CACHE_MODE_AUTO, false},
492  {"force_generic_plan", PLAN_CACHE_MODE_FORCE_GENERIC_PLAN, false},
493  {"force_custom_plan", PLAN_CACHE_MODE_FORCE_CUSTOM_PLAN, false},
494  {NULL, 0, false}
495 };
496 
498  {"md5", PASSWORD_TYPE_MD5, false},
499  {"scram-sha-256", PASSWORD_TYPE_SCRAM_SHA_256, false},
500  {NULL, 0, false}
501 };
502 
504  {"", PG_TLS_ANY, false},
505  {"TLSv1", PG_TLS1_VERSION, false},
506  {"TLSv1.1", PG_TLS1_1_VERSION, false},
507  {"TLSv1.2", PG_TLS1_2_VERSION, false},
508  {"TLSv1.3", PG_TLS1_3_VERSION, false},
509  {NULL, 0, false}
510 };
511 
512 StaticAssertDecl(lengthof(ssl_protocol_versions_info) == (PG_TLS1_3_VERSION + 2),
513  "array length mismatch");
514 
516  {"fsync", RECOVERY_INIT_SYNC_METHOD_FSYNC, false},
517 #ifdef HAVE_SYNCFS
518  {"syncfs", RECOVERY_INIT_SYNC_METHOD_SYNCFS, false},
519 #endif
520  {NULL, 0, false}
521 };
522 
524 #ifndef WIN32
525  {"sysv", SHMEM_TYPE_SYSV, false},
526 #endif
527 #ifndef EXEC_BACKEND
528  {"mmap", SHMEM_TYPE_MMAP, false},
529 #endif
530 #ifdef WIN32
531  {"windows", SHMEM_TYPE_WINDOWS, false},
532 #endif
533  {NULL, 0, false}
534 };
535 
537  {"pglz", TOAST_PGLZ_COMPRESSION, false},
538 #ifdef USE_LZ4
539  {"lz4", TOAST_LZ4_COMPRESSION, false},
540 #endif
541  {NULL, 0, false}
542 };
543 
545  {"pglz", WAL_COMPRESSION_PGLZ, false},
546 #ifdef USE_LZ4
547  {"lz4", WAL_COMPRESSION_LZ4, false},
548 #endif
549  {"on", WAL_COMPRESSION_PGLZ, false},
550  {"off", WAL_COMPRESSION_NONE, false},
551  {"true", WAL_COMPRESSION_PGLZ, true},
552  {"false", WAL_COMPRESSION_NONE, true},
553  {"yes", WAL_COMPRESSION_PGLZ, true},
554  {"no", WAL_COMPRESSION_NONE, true},
555  {"1", WAL_COMPRESSION_PGLZ, true},
556  {"0", WAL_COMPRESSION_NONE, true},
557  {NULL, 0, false}
558 };
559 
560 /*
561  * Options for enum values stored in other modules
562  */
563 extern const struct config_enum_entry wal_level_options[];
564 extern const struct config_enum_entry archive_mode_options[];
565 extern const struct config_enum_entry recovery_target_action_options[];
566 extern const struct config_enum_entry sync_method_options[];
567 extern const struct config_enum_entry dynamic_shared_memory_options[];
568 
569 /*
570  * GUC option variables that are exported from this module
571  */
572 bool log_duration = false;
573 bool Debug_print_plan = false;
574 bool Debug_print_parse = false;
576 bool Debug_pretty_print = true;
577 
578 bool log_parser_stats = false;
579 bool log_planner_stats = false;
580 bool log_executor_stats = false;
581 bool log_statement_stats = false; /* this is sort of all three above
582  * together */
585 
588 
589 /*
590  * This GUC exists solely for backward compatibility, check its definition for
591  * details.
592  */
593 bool default_with_oids = false;
595 
603 int log_temp_files = -1;
609 
611 
612 int num_temp_buffers = 1024;
613 
614 char *cluster_name = "";
619 
621 
623 
628 
629 /*
630  * SSL renegotiation was been removed in PostgreSQL 9.5, but we tolerate it
631  * being set to zero (meaning never renegotiate) for backward compatibility.
632  * This avoids breaking compatibility with clients that have never supported
633  * renegotiation and therefore always try to zero it.
634  */
636 
637 /*
638  * This really belongs in pg_shmem.c, but is defined here so that it doesn't
639  * need to be duplicated in all the different implementations of pg_shmem.c.
640  */
643 
644 /*
645  * These variables are all dummies that don't do anything, except in some
646  * cases provide the value for SHOW to display. The real state is elsewhere
647  * and is kept in sync by assign_hooks.
648  */
649 static char *syslog_ident_str;
650 static double phony_random_seed;
652 static char *datestyle_string;
653 static char *locale_collate;
654 static char *locale_ctype;
658 static char *timezone_string;
659 static char *log_timezone_string;
661 static char *data_directory;
663 static int max_function_args;
664 static int max_index_keys;
666 static int block_size;
667 static int segment_size;
670 static int wal_block_size;
671 static bool data_checksums;
672 static bool integer_datetimes;
673 static bool assert_enabled;
674 static bool in_hot_standby;
680 
681 
682 /* should be static, but commands/variable.c needs to get at this */
684 
685 
686 /*
687  * Displayable names for context types (enum GucContext)
688  *
689  * Note: these strings are deliberately not localized.
690  */
691 const char *const GucContext_Names[] =
692 {
693  /* PGC_INTERNAL */ "internal",
694  /* PGC_POSTMASTER */ "postmaster",
695  /* PGC_SIGHUP */ "sighup",
696  /* PGC_SU_BACKEND */ "superuser-backend",
697  /* PGC_BACKEND */ "backend",
698  /* PGC_SUSET */ "superuser",
699  /* PGC_USERSET */ "user"
700 };
701 
702 StaticAssertDecl(lengthof(GucContext_Names) == (PGC_USERSET + 1),
703  "array length mismatch");
704 
705 /*
706  * Displayable names for source types (enum GucSource)
707  *
708  * Note: these strings are deliberately not localized.
709  */
710 const char *const GucSource_Names[] =
711 {
712  /* PGC_S_DEFAULT */ "default",
713  /* PGC_S_DYNAMIC_DEFAULT */ "default",
714  /* PGC_S_ENV_VAR */ "environment variable",
715  /* PGC_S_FILE */ "configuration file",
716  /* PGC_S_ARGV */ "command line",
717  /* PGC_S_GLOBAL */ "global",
718  /* PGC_S_DATABASE */ "database",
719  /* PGC_S_USER */ "user",
720  /* PGC_S_DATABASE_USER */ "database user",
721  /* PGC_S_CLIENT */ "client",
722  /* PGC_S_OVERRIDE */ "override",
723  /* PGC_S_INTERACTIVE */ "interactive",
724  /* PGC_S_TEST */ "test",
725  /* PGC_S_SESSION */ "session"
726 };
727 
728 StaticAssertDecl(lengthof(GucSource_Names) == (PGC_S_SESSION + 1),
729  "array length mismatch");
730 
731 /*
732  * Displayable names for the groupings defined in enum config_group
733  */
734 const char *const config_group_names[] =
735 {
736  /* UNGROUPED */
737  gettext_noop("Ungrouped"),
738  /* FILE_LOCATIONS */
739  gettext_noop("File Locations"),
740  /* CONN_AUTH_SETTINGS */
741  gettext_noop("Connections and Authentication / Connection Settings"),
742  /* CONN_AUTH_AUTH */
743  gettext_noop("Connections and Authentication / Authentication"),
744  /* CONN_AUTH_SSL */
745  gettext_noop("Connections and Authentication / SSL"),
746  /* RESOURCES_MEM */
747  gettext_noop("Resource Usage / Memory"),
748  /* RESOURCES_DISK */
749  gettext_noop("Resource Usage / Disk"),
750  /* RESOURCES_KERNEL */
751  gettext_noop("Resource Usage / Kernel Resources"),
752  /* RESOURCES_VACUUM_DELAY */
753  gettext_noop("Resource Usage / Cost-Based Vacuum Delay"),
754  /* RESOURCES_BGWRITER */
755  gettext_noop("Resource Usage / Background Writer"),
756  /* RESOURCES_ASYNCHRONOUS */
757  gettext_noop("Resource Usage / Asynchronous Behavior"),
758  /* WAL_SETTINGS */
759  gettext_noop("Write-Ahead Log / Settings"),
760  /* WAL_CHECKPOINTS */
761  gettext_noop("Write-Ahead Log / Checkpoints"),
762  /* WAL_ARCHIVING */
763  gettext_noop("Write-Ahead Log / Archiving"),
764  /* WAL_ARCHIVE_RECOVERY */
765  gettext_noop("Write-Ahead Log / Archive Recovery"),
766  /* WAL_RECOVERY_TARGET */
767  gettext_noop("Write-Ahead Log / Recovery Target"),
768  /* REPLICATION_SENDING */
769  gettext_noop("Replication / Sending Servers"),
770  /* REPLICATION_PRIMARY */
771  gettext_noop("Replication / Primary Server"),
772  /* REPLICATION_STANDBY */
773  gettext_noop("Replication / Standby Servers"),
774  /* REPLICATION_SUBSCRIBERS */
775  gettext_noop("Replication / Subscribers"),
776  /* QUERY_TUNING_METHOD */
777  gettext_noop("Query Tuning / Planner Method Configuration"),
778  /* QUERY_TUNING_COST */
779  gettext_noop("Query Tuning / Planner Cost Constants"),
780  /* QUERY_TUNING_GEQO */
781  gettext_noop("Query Tuning / Genetic Query Optimizer"),
782  /* QUERY_TUNING_OTHER */
783  gettext_noop("Query Tuning / Other Planner Options"),
784  /* LOGGING_WHERE */
785  gettext_noop("Reporting and Logging / Where to Log"),
786  /* LOGGING_WHEN */
787  gettext_noop("Reporting and Logging / When to Log"),
788  /* LOGGING_WHAT */
789  gettext_noop("Reporting and Logging / What to Log"),
790  /* PROCESS_TITLE */
791  gettext_noop("Reporting and Logging / Process Title"),
792  /* STATS_MONITORING */
793  gettext_noop("Statistics / Monitoring"),
794  /* STATS_COLLECTOR */
795  gettext_noop("Statistics / Query and Index Statistics Collector"),
796  /* AUTOVACUUM */
797  gettext_noop("Autovacuum"),
798  /* CLIENT_CONN_STATEMENT */
799  gettext_noop("Client Connection Defaults / Statement Behavior"),
800  /* CLIENT_CONN_LOCALE */
801  gettext_noop("Client Connection Defaults / Locale and Formatting"),
802  /* CLIENT_CONN_PRELOAD */
803  gettext_noop("Client Connection Defaults / Shared Library Preloading"),
804  /* CLIENT_CONN_OTHER */
805  gettext_noop("Client Connection Defaults / Other Defaults"),
806  /* LOCK_MANAGEMENT */
807  gettext_noop("Lock Management"),
808  /* COMPAT_OPTIONS_PREVIOUS */
809  gettext_noop("Version and Platform Compatibility / Previous PostgreSQL Versions"),
810  /* COMPAT_OPTIONS_CLIENT */
811  gettext_noop("Version and Platform Compatibility / Other Platforms and Clients"),
812  /* ERROR_HANDLING */
813  gettext_noop("Error Handling"),
814  /* PRESET_OPTIONS */
815  gettext_noop("Preset Options"),
816  /* CUSTOM_OPTIONS */
817  gettext_noop("Customized Options"),
818  /* DEVELOPER_OPTIONS */
819  gettext_noop("Developer Options"),
820  /* help_config wants this array to be null-terminated */
821  NULL
822 };
823 
824 StaticAssertDecl(lengthof(config_group_names) == (DEVELOPER_OPTIONS + 2),
825  "array length mismatch");
826 
827 /*
828  * Displayable names for GUC variable types (enum config_type)
829  *
830  * Note: these strings are deliberately not localized.
831  */
832 const char *const config_type_names[] =
833 {
834  /* PGC_BOOL */ "bool",
835  /* PGC_INT */ "integer",
836  /* PGC_REAL */ "real",
837  /* PGC_STRING */ "string",
838  /* PGC_ENUM */ "enum"
839 };
840 
841 StaticAssertDecl(lengthof(config_type_names) == (PGC_ENUM + 1),
842  "array length mismatch");
843 
844 /*
845  * Unit conversion tables.
846  *
847  * There are two tables, one for memory units, and another for time units.
848  * For each supported conversion from one unit to another, we have an entry
849  * in the table.
850  *
851  * To keep things simple, and to avoid possible roundoff error,
852  * conversions are never chained. There needs to be a direct conversion
853  * between all units (of the same type).
854  *
855  * The conversions for each base unit must be kept in order from greatest to
856  * smallest human-friendly unit; convert_xxx_from_base_unit() rely on that.
857  * (The order of the base-unit groups does not matter.)
858  */
859 #define MAX_UNIT_LEN 3 /* length of longest recognized unit string */
860 
861 typedef struct
862 {
863  char unit[MAX_UNIT_LEN + 1]; /* unit, as a string, like "kB" or
864  * "min" */
865  int base_unit; /* GUC_UNIT_XXX */
866  double multiplier; /* Factor for converting unit -> base_unit */
868 
869 /* Ensure that the constants in the tables don't overflow or underflow */
870 #if BLCKSZ < 1024 || BLCKSZ > (1024*1024)
871 #error BLCKSZ must be between 1KB and 1MB
872 #endif
873 #if XLOG_BLCKSZ < 1024 || XLOG_BLCKSZ > (1024*1024)
874 #error XLOG_BLCKSZ must be between 1KB and 1MB
875 #endif
876 
877 static const char *memory_units_hint = gettext_noop("Valid units for this parameter are \"B\", \"kB\", \"MB\", \"GB\", and \"TB\".");
878 
880 {
881  {"TB", GUC_UNIT_BYTE, 1024.0 * 1024.0 * 1024.0 * 1024.0},
882  {"GB", GUC_UNIT_BYTE, 1024.0 * 1024.0 * 1024.0},
883  {"MB", GUC_UNIT_BYTE, 1024.0 * 1024.0},
884  {"kB", GUC_UNIT_BYTE, 1024.0},
885  {"B", GUC_UNIT_BYTE, 1.0},
886 
887  {"TB", GUC_UNIT_KB, 1024.0 * 1024.0 * 1024.0},
888  {"GB", GUC_UNIT_KB, 1024.0 * 1024.0},
889  {"MB", GUC_UNIT_KB, 1024.0},
890  {"kB", GUC_UNIT_KB, 1.0},
891  {"B", GUC_UNIT_KB, 1.0 / 1024.0},
892 
893  {"TB", GUC_UNIT_MB, 1024.0 * 1024.0},
894  {"GB", GUC_UNIT_MB, 1024.0},
895  {"MB", GUC_UNIT_MB, 1.0},
896  {"kB", GUC_UNIT_MB, 1.0 / 1024.0},
897  {"B", GUC_UNIT_MB, 1.0 / (1024.0 * 1024.0)},
898 
899  {"TB", GUC_UNIT_BLOCKS, (1024.0 * 1024.0 * 1024.0) / (BLCKSZ / 1024)},
900  {"GB", GUC_UNIT_BLOCKS, (1024.0 * 1024.0) / (BLCKSZ / 1024)},
901  {"MB", GUC_UNIT_BLOCKS, 1024.0 / (BLCKSZ / 1024)},
902  {"kB", GUC_UNIT_BLOCKS, 1.0 / (BLCKSZ / 1024)},
903  {"B", GUC_UNIT_BLOCKS, 1.0 / BLCKSZ},
904 
905  {"TB", GUC_UNIT_XBLOCKS, (1024.0 * 1024.0 * 1024.0) / (XLOG_BLCKSZ / 1024)},
906  {"GB", GUC_UNIT_XBLOCKS, (1024.0 * 1024.0) / (XLOG_BLCKSZ / 1024)},
907  {"MB", GUC_UNIT_XBLOCKS, 1024.0 / (XLOG_BLCKSZ / 1024)},
908  {"kB", GUC_UNIT_XBLOCKS, 1.0 / (XLOG_BLCKSZ / 1024)},
909  {"B", GUC_UNIT_XBLOCKS, 1.0 / XLOG_BLCKSZ},
910 
911  {""} /* end of table marker */
912 };
913 
914 static const char *time_units_hint = gettext_noop("Valid units for this parameter are \"us\", \"ms\", \"s\", \"min\", \"h\", and \"d\".");
915 
917 {
918  {"d", GUC_UNIT_MS, 1000 * 60 * 60 * 24},
919  {"h", GUC_UNIT_MS, 1000 * 60 * 60},
920  {"min", GUC_UNIT_MS, 1000 * 60},
921  {"s", GUC_UNIT_MS, 1000},
922  {"ms", GUC_UNIT_MS, 1},
923  {"us", GUC_UNIT_MS, 1.0 / 1000},
924 
925  {"d", GUC_UNIT_S, 60 * 60 * 24},
926  {"h", GUC_UNIT_S, 60 * 60},
927  {"min", GUC_UNIT_S, 60},
928  {"s", GUC_UNIT_S, 1},
929  {"ms", GUC_UNIT_S, 1.0 / 1000},
930  {"us", GUC_UNIT_S, 1.0 / (1000 * 1000)},
931 
932  {"d", GUC_UNIT_MIN, 60 * 24},
933  {"h", GUC_UNIT_MIN, 60},
934  {"min", GUC_UNIT_MIN, 1},
935  {"s", GUC_UNIT_MIN, 1.0 / 60},
936  {"ms", GUC_UNIT_MIN, 1.0 / (1000 * 60)},
937  {"us", GUC_UNIT_MIN, 1.0 / (1000 * 1000 * 60)},
938 
939  {""} /* end of table marker */
940 };
941 
942 /*
943  * Contents of GUC tables
944  *
945  * See src/backend/utils/misc/README for design notes.
946  *
947  * TO ADD AN OPTION:
948  *
949  * 1. Declare a global variable of type bool, int, double, or char*
950  * and make use of it.
951  *
952  * 2. Decide at what times it's safe to set the option. See guc.h for
953  * details.
954  *
955  * 3. Decide on a name, a default value, upper and lower bounds (if
956  * applicable), etc.
957  *
958  * 4. Add a record below.
959  *
960  * 5. Add it to src/backend/utils/misc/postgresql.conf.sample, if
961  * appropriate.
962  *
963  * 6. Don't forget to document the option (at least in config.sgml).
964  *
965  * 7. If it's a new GUC_LIST_QUOTE option, you must add it to
966  * variable_is_guc_list_quote() in src/bin/pg_dump/dumputils.c.
967  */
968 
969 
970 /******** option records follow ********/
971 
973 {
974  {
975  {"enable_seqscan", PGC_USERSET, QUERY_TUNING_METHOD,
976  gettext_noop("Enables the planner's use of sequential-scan plans."),
977  NULL,
979  },
981  true,
982  NULL, NULL, NULL
983  },
984  {
985  {"enable_indexscan", PGC_USERSET, QUERY_TUNING_METHOD,
986  gettext_noop("Enables the planner's use of index-scan plans."),
987  NULL,
989  },
991  true,
992  NULL, NULL, NULL
993  },
994  {
995  {"enable_indexonlyscan", PGC_USERSET, QUERY_TUNING_METHOD,
996  gettext_noop("Enables the planner's use of index-only-scan plans."),
997  NULL,
999  },
1001  true,
1002  NULL, NULL, NULL
1003  },
1004  {
1005  {"enable_bitmapscan", PGC_USERSET, QUERY_TUNING_METHOD,
1006  gettext_noop("Enables the planner's use of bitmap-scan plans."),
1007  NULL,
1008  GUC_EXPLAIN
1009  },
1011  true,
1012  NULL, NULL, NULL
1013  },
1014  {
1015  {"enable_tidscan", PGC_USERSET, QUERY_TUNING_METHOD,
1016  gettext_noop("Enables the planner's use of TID scan plans."),
1017  NULL,
1018  GUC_EXPLAIN
1019  },
1020  &enable_tidscan,
1021  true,
1022  NULL, NULL, NULL
1023  },
1024  {
1025  {"enable_sort", PGC_USERSET, QUERY_TUNING_METHOD,
1026  gettext_noop("Enables the planner's use of explicit sort steps."),
1027  NULL,
1028  GUC_EXPLAIN
1029  },
1030  &enable_sort,
1031  true,
1032  NULL, NULL, NULL
1033  },
1034  {
1035  {"enable_incremental_sort", PGC_USERSET, QUERY_TUNING_METHOD,
1036  gettext_noop("Enables the planner's use of incremental sort steps."),
1037  NULL
1038  },
1040  true,
1041  NULL, NULL, NULL
1042  },
1043  {
1044  {"enable_hashagg", PGC_USERSET, QUERY_TUNING_METHOD,
1045  gettext_noop("Enables the planner's use of hashed aggregation plans."),
1046  NULL,
1047  GUC_EXPLAIN
1048  },
1049  &enable_hashagg,
1050  true,
1051  NULL, NULL, NULL
1052  },
1053  {
1054  {"enable_material", PGC_USERSET, QUERY_TUNING_METHOD,
1055  gettext_noop("Enables the planner's use of materialization."),
1056  NULL,
1057  GUC_EXPLAIN
1058  },
1059  &enable_material,
1060  true,
1061  NULL, NULL, NULL
1062  },
1063  {
1064  {"enable_memoize", PGC_USERSET, QUERY_TUNING_METHOD,
1065  gettext_noop("Enables the planner's use of memoization."),
1066  NULL,
1067  GUC_EXPLAIN
1068  },
1069  &enable_memoize,
1070  true,
1071  NULL, NULL, NULL
1072  },
1073  {
1074  {"enable_nestloop", PGC_USERSET, QUERY_TUNING_METHOD,
1075  gettext_noop("Enables the planner's use of nested-loop join plans."),
1076  NULL,
1077  GUC_EXPLAIN
1078  },
1079  &enable_nestloop,
1080  true,
1081  NULL, NULL, NULL
1082  },
1083  {
1084  {"enable_mergejoin", PGC_USERSET, QUERY_TUNING_METHOD,
1085  gettext_noop("Enables the planner's use of merge join plans."),
1086  NULL,
1087  GUC_EXPLAIN
1088  },
1090  true,
1091  NULL, NULL, NULL
1092  },
1093  {
1094  {"enable_hashjoin", PGC_USERSET, QUERY_TUNING_METHOD,
1095  gettext_noop("Enables the planner's use of hash join plans."),
1096  NULL,
1097  GUC_EXPLAIN
1098  },
1099  &enable_hashjoin,
1100  true,
1101  NULL, NULL, NULL
1102  },
1103  {
1104  {"enable_gathermerge", PGC_USERSET, QUERY_TUNING_METHOD,
1105  gettext_noop("Enables the planner's use of gather merge plans."),
1106  NULL,
1107  GUC_EXPLAIN
1108  },
1110  true,
1111  NULL, NULL, NULL
1112  },
1113  {
1114  {"enable_partitionwise_join", PGC_USERSET, QUERY_TUNING_METHOD,
1115  gettext_noop("Enables partitionwise join."),
1116  NULL,
1117  GUC_EXPLAIN
1118  },
1120  false,
1121  NULL, NULL, NULL
1122  },
1123  {
1124  {"enable_partitionwise_aggregate", PGC_USERSET, QUERY_TUNING_METHOD,
1125  gettext_noop("Enables partitionwise aggregation and grouping."),
1126  NULL,
1127  GUC_EXPLAIN
1128  },
1130  false,
1131  NULL, NULL, NULL
1132  },
1133  {
1134  {"enable_parallel_append", PGC_USERSET, QUERY_TUNING_METHOD,
1135  gettext_noop("Enables the planner's use of parallel append plans."),
1136  NULL,
1137  GUC_EXPLAIN
1138  },
1140  true,
1141  NULL, NULL, NULL
1142  },
1143  {
1144  {"enable_parallel_hash", PGC_USERSET, QUERY_TUNING_METHOD,
1145  gettext_noop("Enables the planner's use of parallel hash plans."),
1146  NULL,
1147  GUC_EXPLAIN
1148  },
1150  true,
1151  NULL, NULL, NULL
1152  },
1153  {
1154  {"enable_partition_pruning", PGC_USERSET, QUERY_TUNING_METHOD,
1155  gettext_noop("Enables plan-time and execution-time partition pruning."),
1156  gettext_noop("Allows the query planner and executor to compare partition "
1157  "bounds to conditions in the query to determine which "
1158  "partitions must be scanned."),
1159  GUC_EXPLAIN
1160  },
1162  true,
1163  NULL, NULL, NULL
1164  },
1165  {
1166  {"enable_async_append", PGC_USERSET, QUERY_TUNING_METHOD,
1167  gettext_noop("Enables the planner's use of async append plans."),
1168  NULL,
1169  GUC_EXPLAIN
1170  },
1172  true,
1173  NULL, NULL, NULL
1174  },
1175  {
1176  {"geqo", PGC_USERSET, QUERY_TUNING_GEQO,
1177  gettext_noop("Enables genetic query optimization."),
1178  gettext_noop("This algorithm attempts to do planning without "
1179  "exhaustive searching."),
1180  GUC_EXPLAIN
1181  },
1182  &enable_geqo,
1183  true,
1184  NULL, NULL, NULL
1185  },
1186  {
1187  /* Not for general use --- used by SET SESSION AUTHORIZATION */
1188  {"is_superuser", PGC_INTERNAL, UNGROUPED,
1189  gettext_noop("Shows whether the current user is a superuser."),
1190  NULL,
1192  },
1194  false,
1195  NULL, NULL, NULL
1196  },
1197  {
1198  {"bonjour", PGC_POSTMASTER, CONN_AUTH_SETTINGS,
1199  gettext_noop("Enables advertising the server via Bonjour."),
1200  NULL
1201  },
1202  &enable_bonjour,
1203  false,
1204  check_bonjour, NULL, NULL
1205  },
1206  {
1207  {"track_commit_timestamp", PGC_POSTMASTER, REPLICATION_SENDING,
1208  gettext_noop("Collects transaction commit time."),
1209  NULL
1210  },
1212  false,
1213  NULL, NULL, NULL
1214  },
1215  {
1216  {"ssl", PGC_SIGHUP, CONN_AUTH_SSL,
1217  gettext_noop("Enables SSL connections."),
1218  NULL
1219  },
1220  &EnableSSL,
1221  false,
1222  check_ssl, NULL, NULL
1223  },
1224  {
1225  {"ssl_passphrase_command_supports_reload", PGC_SIGHUP, CONN_AUTH_SSL,
1226  gettext_noop("Also use ssl_passphrase_command during server reload."),
1227  NULL
1228  },
1230  false,
1231  NULL, NULL, NULL
1232  },
1233  {
1234  {"ssl_prefer_server_ciphers", PGC_SIGHUP, CONN_AUTH_SSL,
1235  gettext_noop("Give priority to server ciphersuite order."),
1236  NULL
1237  },
1239  true,
1240  NULL, NULL, NULL
1241  },
1242  {
1243  {"fsync", PGC_SIGHUP, WAL_SETTINGS,
1244  gettext_noop("Forces synchronization of updates to disk."),
1245  gettext_noop("The server will use the fsync() system call in several places to make "
1246  "sure that updates are physically written to disk. This insures "
1247  "that a database cluster will recover to a consistent state after "
1248  "an operating system or hardware crash.")
1249  },
1250  &enableFsync,
1251  true,
1252  NULL, NULL, NULL
1253  },
1254  {
1255  {"ignore_checksum_failure", PGC_SUSET, DEVELOPER_OPTIONS,
1256  gettext_noop("Continues processing after a checksum failure."),
1257  gettext_noop("Detection of a checksum failure normally causes PostgreSQL to "
1258  "report an error, aborting the current transaction. Setting "
1259  "ignore_checksum_failure to true causes the system to ignore the failure "
1260  "(but still report a warning), and continue processing. This "
1261  "behavior could cause crashes or other serious problems. Only "
1262  "has an effect if checksums are enabled."),
1264  },
1266  false,
1267  NULL, NULL, NULL
1268  },
1269  {
1270  {"zero_damaged_pages", PGC_SUSET, DEVELOPER_OPTIONS,
1271  gettext_noop("Continues processing past damaged page headers."),
1272  gettext_noop("Detection of a damaged page header normally causes PostgreSQL to "
1273  "report an error, aborting the current transaction. Setting "
1274  "zero_damaged_pages to true causes the system to instead report a "
1275  "warning, zero out the damaged page, and continue processing. This "
1276  "behavior will destroy data, namely all the rows on the damaged page."),
1278  },
1280  false,
1281  NULL, NULL, NULL
1282  },
1283  {
1284  {"ignore_invalid_pages", PGC_POSTMASTER, DEVELOPER_OPTIONS,
1285  gettext_noop("Continues recovery after an invalid pages failure."),
1286  gettext_noop("Detection of WAL records having references to "
1287  "invalid pages during recovery causes PostgreSQL to "
1288  "raise a PANIC-level error, aborting the recovery. "
1289  "Setting ignore_invalid_pages to true causes "
1290  "the system to ignore invalid page references "
1291  "in WAL records (but still report a warning), "
1292  "and continue recovery. This behavior may cause "
1293  "crashes, data loss, propagate or hide corruption, "
1294  "or other serious problems. Only has an effect "
1295  "during recovery or in standby mode."),
1297  },
1299  false,
1300  NULL, NULL, NULL
1301  },
1302  {
1303  {"full_page_writes", PGC_SIGHUP, WAL_SETTINGS,
1304  gettext_noop("Writes full pages to WAL when first modified after a checkpoint."),
1305  gettext_noop("A page write in process during an operating system crash might be "
1306  "only partially written to disk. During recovery, the row changes "
1307  "stored in WAL are not enough to recover. This option writes "
1308  "pages when first modified after a checkpoint to WAL so full recovery "
1309  "is possible.")
1310  },
1311  &fullPageWrites,
1312  true,
1313  NULL, NULL, NULL
1314  },
1315 
1316  {
1317  {"wal_log_hints", PGC_POSTMASTER, WAL_SETTINGS,
1318  gettext_noop("Writes full pages to WAL when first modified after a checkpoint, even for a non-critical modification."),
1319  NULL
1320  },
1321  &wal_log_hints,
1322  false,
1323  NULL, NULL, NULL
1324  },
1325 
1326  {
1327  {"wal_init_zero", PGC_SUSET, WAL_SETTINGS,
1328  gettext_noop("Writes zeroes to new WAL files before first use."),
1329  NULL
1330  },
1331  &wal_init_zero,
1332  true,
1333  NULL, NULL, NULL
1334  },
1335 
1336  {
1337  {"wal_recycle", PGC_SUSET, WAL_SETTINGS,
1338  gettext_noop("Recycles WAL files by renaming them."),
1339  NULL
1340  },
1341  &wal_recycle,
1342  true,
1343  NULL, NULL, NULL
1344  },
1345 
1346  {
1347  {"log_checkpoints", PGC_SIGHUP, LOGGING_WHAT,
1348  gettext_noop("Logs each checkpoint."),
1349  NULL
1350  },
1351  &log_checkpoints,
1352  false,
1353  NULL, NULL, NULL
1354  },
1355  {
1356  {"log_connections", PGC_SU_BACKEND, LOGGING_WHAT,
1357  gettext_noop("Logs each successful connection."),
1358  NULL
1359  },
1360  &Log_connections,
1361  false,
1362  NULL, NULL, NULL
1363  },
1364  {
1365  {"log_disconnections", PGC_SU_BACKEND, LOGGING_WHAT,
1366  gettext_noop("Logs end of a session, including duration."),
1367  NULL
1368  },
1370  false,
1371  NULL, NULL, NULL
1372  },
1373  {
1374  {"log_replication_commands", PGC_SUSET, LOGGING_WHAT,
1375  gettext_noop("Logs each replication command."),
1376  NULL
1377  },
1379  false,
1380  NULL, NULL, NULL
1381  },
1382  {
1383  {"debug_assertions", PGC_INTERNAL, PRESET_OPTIONS,
1384  gettext_noop("Shows whether the running server has assertion checks enabled."),
1385  NULL,
1387  },
1388  &assert_enabled,
1389 #ifdef USE_ASSERT_CHECKING
1390  true,
1391 #else
1392  false,
1393 #endif
1394  NULL, NULL, NULL
1395  },
1396 
1397  {
1398  {"exit_on_error", PGC_USERSET, ERROR_HANDLING_OPTIONS,
1399  gettext_noop("Terminate session on any error."),
1400  NULL
1401  },
1402  &ExitOnAnyError,
1403  false,
1404  NULL, NULL, NULL
1405  },
1406  {
1407  {"restart_after_crash", PGC_SIGHUP, ERROR_HANDLING_OPTIONS,
1408  gettext_noop("Reinitialize server after backend crash."),
1409  NULL
1410  },
1412  true,
1413  NULL, NULL, NULL
1414  },
1415  {
1416  {"remove_temp_files_after_crash", PGC_SIGHUP, DEVELOPER_OPTIONS,
1417  gettext_noop("Remove temporary files after backend crash."),
1418  NULL,
1420  },
1422  true,
1423  NULL, NULL, NULL
1424  },
1425 
1426  {
1427  {"log_duration", PGC_SUSET, LOGGING_WHAT,
1428  gettext_noop("Logs the duration of each completed SQL statement."),
1429  NULL
1430  },
1431  &log_duration,
1432  false,
1433  NULL, NULL, NULL
1434  },
1435  {
1436  {"debug_print_parse", PGC_USERSET, LOGGING_WHAT,
1437  gettext_noop("Logs each query's parse tree."),
1438  NULL
1439  },
1441  false,
1442  NULL, NULL, NULL
1443  },
1444  {
1445  {"debug_print_rewritten", PGC_USERSET, LOGGING_WHAT,
1446  gettext_noop("Logs each query's rewritten parse tree."),
1447  NULL
1448  },
1450  false,
1451  NULL, NULL, NULL
1452  },
1453  {
1454  {"debug_print_plan", PGC_USERSET, LOGGING_WHAT,
1455  gettext_noop("Logs each query's execution plan."),
1456  NULL
1457  },
1459  false,
1460  NULL, NULL, NULL
1461  },
1462  {
1463  {"debug_pretty_print", PGC_USERSET, LOGGING_WHAT,
1464  gettext_noop("Indents parse and plan tree displays."),
1465  NULL
1466  },
1468  true,
1469  NULL, NULL, NULL
1470  },
1471  {
1472  {"log_parser_stats", PGC_SUSET, STATS_MONITORING,
1473  gettext_noop("Writes parser performance statistics to the server log."),
1474  NULL
1475  },
1477  false,
1478  check_stage_log_stats, NULL, NULL
1479  },
1480  {
1481  {"log_planner_stats", PGC_SUSET, STATS_MONITORING,
1482  gettext_noop("Writes planner performance statistics to the server log."),
1483  NULL
1484  },
1486  false,
1487  check_stage_log_stats, NULL, NULL
1488  },
1489  {
1490  {"log_executor_stats", PGC_SUSET, STATS_MONITORING,
1491  gettext_noop("Writes executor performance statistics to the server log."),
1492  NULL
1493  },
1495  false,
1496  check_stage_log_stats, NULL, NULL
1497  },
1498  {
1499  {"log_statement_stats", PGC_SUSET, STATS_MONITORING,
1500  gettext_noop("Writes cumulative performance statistics to the server log."),
1501  NULL
1502  },
1504  false,
1505  check_log_stats, NULL, NULL
1506  },
1507 #ifdef BTREE_BUILD_STATS
1508  {
1509  {"log_btree_build_stats", PGC_SUSET, DEVELOPER_OPTIONS,
1510  gettext_noop("Logs system resource usage statistics (memory and CPU) on various B-tree operations."),
1511  NULL,
1513  },
1515  false,
1516  NULL, NULL, NULL
1517  },
1518 #endif
1519 
1520  {
1521  {"track_activities", PGC_SUSET, STATS_COLLECTOR,
1522  gettext_noop("Collects information about executing commands."),
1523  gettext_noop("Enables the collection of information on the currently "
1524  "executing command of each session, along with "
1525  "the time at which that command began execution.")
1526  },
1528  true,
1529  NULL, NULL, NULL
1530  },
1531  {
1532  {"track_counts", PGC_SUSET, STATS_COLLECTOR,
1533  gettext_noop("Collects statistics on database activity."),
1534  NULL
1535  },
1537  true,
1538  NULL, NULL, NULL
1539  },
1540  {
1541  {"track_io_timing", PGC_SUSET, STATS_COLLECTOR,
1542  gettext_noop("Collects timing statistics for database I/O activity."),
1543  NULL
1544  },
1545  &track_io_timing,
1546  false,
1547  NULL, NULL, NULL
1548  },
1549  {
1550  {"track_wal_io_timing", PGC_SUSET, STATS_COLLECTOR,
1551  gettext_noop("Collects timing statistics for WAL I/O activity."),
1552  NULL
1553  },
1555  false,
1556  NULL, NULL, NULL
1557  },
1558 
1559  {
1560  {"update_process_title", PGC_SUSET, PROCESS_TITLE,
1561  gettext_noop("Updates the process title to show the active SQL command."),
1562  gettext_noop("Enables updating of the process title every time a new SQL command is received by the server.")
1563  },
1565 #ifdef WIN32
1566  false,
1567 #else
1568  true,
1569 #endif
1570  NULL, NULL, NULL
1571  },
1572 
1573  {
1574  {"autovacuum", PGC_SIGHUP, AUTOVACUUM,
1575  gettext_noop("Starts the autovacuum subprocess."),
1576  NULL
1577  },
1579  true,
1580  NULL, NULL, NULL
1581  },
1582 
1583  {
1584  {"trace_notify", PGC_USERSET, DEVELOPER_OPTIONS,
1585  gettext_noop("Generates debugging output for LISTEN and NOTIFY."),
1586  NULL,
1588  },
1589  &Trace_notify,
1590  false,
1591  NULL, NULL, NULL
1592  },
1593 
1594 #ifdef LOCK_DEBUG
1595  {
1596  {"trace_locks", PGC_SUSET, DEVELOPER_OPTIONS,
1597  gettext_noop("Emits information about lock usage."),
1598  NULL,
1600  },
1601  &Trace_locks,
1602  false,
1603  NULL, NULL, NULL
1604  },
1605  {
1606  {"trace_userlocks", PGC_SUSET, DEVELOPER_OPTIONS,
1607  gettext_noop("Emits information about user lock usage."),
1608  NULL,
1610  },
1611  &Trace_userlocks,
1612  false,
1613  NULL, NULL, NULL
1614  },
1615  {
1616  {"trace_lwlocks", PGC_SUSET, DEVELOPER_OPTIONS,
1617  gettext_noop("Emits information about lightweight lock usage."),
1618  NULL,
1620  },
1621  &Trace_lwlocks,
1622  false,
1623  NULL, NULL, NULL
1624  },
1625  {
1626  {"debug_deadlocks", PGC_SUSET, DEVELOPER_OPTIONS,
1627  gettext_noop("Dumps information about all current locks when a deadlock timeout occurs."),
1628  NULL,
1630  },
1631  &Debug_deadlocks,
1632  false,
1633  NULL, NULL, NULL
1634  },
1635 #endif
1636 
1637  {
1638  {"log_lock_waits", PGC_SUSET, LOGGING_WHAT,
1639  gettext_noop("Logs long lock waits."),
1640  NULL
1641  },
1642  &log_lock_waits,
1643  false,
1644  NULL, NULL, NULL
1645  },
1646  {
1647  {"log_recovery_conflict_waits", PGC_SIGHUP, LOGGING_WHAT,
1648  gettext_noop("Logs standby recovery conflict waits."),
1649  NULL
1650  },
1652  false,
1653  NULL, NULL, NULL
1654  },
1655  {
1656  {"log_hostname", PGC_SIGHUP, LOGGING_WHAT,
1657  gettext_noop("Logs the host name in the connection logs."),
1658  gettext_noop("By default, connection logs only show the IP address "
1659  "of the connecting host. If you want them to show the host name you "
1660  "can turn this on, but depending on your host name resolution "
1661  "setup it might impose a non-negligible performance penalty.")
1662  },
1663  &log_hostname,
1664  false,
1665  NULL, NULL, NULL
1666  },
1667  {
1668  {"transform_null_equals", PGC_USERSET, COMPAT_OPTIONS_CLIENT,
1669  gettext_noop("Treats \"expr=NULL\" as \"expr IS NULL\"."),
1670  gettext_noop("When turned on, expressions of the form expr = NULL "
1671  "(or NULL = expr) are treated as expr IS NULL, that is, they "
1672  "return true if expr evaluates to the null value, and false "
1673  "otherwise. The correct behavior of expr = NULL is to always "
1674  "return null (unknown).")
1675  },
1677  false,
1678  NULL, NULL, NULL
1679  },
1680  {
1681  {"db_user_namespace", PGC_SIGHUP, CONN_AUTH_AUTH,
1682  gettext_noop("Enables per-database user names."),
1683  NULL
1684  },
1686  false,
1687  NULL, NULL, NULL
1688  },
1689  {
1690  {"default_transaction_read_only", PGC_USERSET, CLIENT_CONN_STATEMENT,
1691  gettext_noop("Sets the default read-only status of new transactions."),
1692  NULL,
1693  GUC_REPORT
1694  },
1696  false,
1697  NULL, NULL, NULL
1698  },
1699  {
1700  {"transaction_read_only", PGC_USERSET, CLIENT_CONN_STATEMENT,
1701  gettext_noop("Sets the current transaction's read-only status."),
1702  NULL,
1704  },
1705  &XactReadOnly,
1706  false,
1707  check_transaction_read_only, NULL, NULL
1708  },
1709  {
1710  {"default_transaction_deferrable", PGC_USERSET, CLIENT_CONN_STATEMENT,
1711  gettext_noop("Sets the default deferrable status of new transactions."),
1712  NULL
1713  },
1715  false,
1716  NULL, NULL, NULL
1717  },
1718  {
1719  {"transaction_deferrable", PGC_USERSET, CLIENT_CONN_STATEMENT,
1720  gettext_noop("Whether to defer a read-only serializable transaction until it can be executed with no possible serialization failures."),
1721  NULL,
1723  },
1724  &XactDeferrable,
1725  false,
1726  check_transaction_deferrable, NULL, NULL
1727  },
1728  {
1729  {"row_security", PGC_USERSET, CLIENT_CONN_STATEMENT,
1730  gettext_noop("Enable row security."),
1731  gettext_noop("When enabled, row security will be applied to all users.")
1732  },
1733  &row_security,
1734  true,
1735  NULL, NULL, NULL
1736  },
1737  {
1738  {"check_function_bodies", PGC_USERSET, CLIENT_CONN_STATEMENT,
1739  gettext_noop("Check routine bodies during CREATE FUNCTION and CREATE PROCEDURE."),
1740  NULL
1741  },
1743  true,
1744  NULL, NULL, NULL
1745  },
1746  {
1747  {"array_nulls", PGC_USERSET, COMPAT_OPTIONS_PREVIOUS,
1748  gettext_noop("Enable input of NULL elements in arrays."),
1749  gettext_noop("When turned on, unquoted NULL in an array input "
1750  "value means a null value; "
1751  "otherwise it is taken literally.")
1752  },
1753  &Array_nulls,
1754  true,
1755  NULL, NULL, NULL
1756  },
1757 
1758  /*
1759  * WITH OIDS support, and consequently default_with_oids, was removed in
1760  * PostgreSQL 12, but we tolerate the parameter being set to false to
1761  * avoid unnecessarily breaking older dump files.
1762  */
1763  {
1764  {"default_with_oids", PGC_USERSET, COMPAT_OPTIONS_PREVIOUS,
1765  gettext_noop("WITH OIDS is no longer supported; this can only be false."),
1766  NULL,
1768  },
1770  false,
1771  check_default_with_oids, NULL, NULL
1772  },
1773  {
1774  {"logging_collector", PGC_POSTMASTER, LOGGING_WHERE,
1775  gettext_noop("Start a subprocess to capture stderr output and/or csvlogs into log files."),
1776  NULL
1777  },
1779  false,
1780  NULL, NULL, NULL
1781  },
1782  {
1783  {"log_truncate_on_rotation", PGC_SIGHUP, LOGGING_WHERE,
1784  gettext_noop("Truncate existing log files of same name during log rotation."),
1785  NULL
1786  },
1788  false,
1789  NULL, NULL, NULL
1790  },
1791 
1792 #ifdef TRACE_SORT
1793  {
1794  {"trace_sort", PGC_USERSET, DEVELOPER_OPTIONS,
1795  gettext_noop("Emit information about resource usage in sorting."),
1796  NULL,
1798  },
1799  &trace_sort,
1800  false,
1801  NULL, NULL, NULL
1802  },
1803 #endif
1804 
1805 #ifdef TRACE_SYNCSCAN
1806  /* this is undocumented because not exposed in a standard build */
1807  {
1808  {"trace_syncscan", PGC_USERSET, DEVELOPER_OPTIONS,
1809  gettext_noop("Generate debugging output for synchronized scanning."),
1810  NULL,
1812  },
1813  &trace_syncscan,
1814  false,
1815  NULL, NULL, NULL
1816  },
1817 #endif
1818 
1819 #ifdef DEBUG_BOUNDED_SORT
1820  /* this is undocumented because not exposed in a standard build */
1821  {
1822  {
1823  "optimize_bounded_sort", PGC_USERSET, QUERY_TUNING_METHOD,
1824  gettext_noop("Enable bounded sorting using heap sort."),
1825  NULL,
1827  },
1828  &optimize_bounded_sort,
1829  true,
1830  NULL, NULL, NULL
1831  },
1832 #endif
1833 
1834 #ifdef WAL_DEBUG
1835  {
1836  {"wal_debug", PGC_SUSET, DEVELOPER_OPTIONS,
1837  gettext_noop("Emit WAL-related debugging output."),
1838  NULL,
1840  },
1841  &XLOG_DEBUG,
1842  false,
1843  NULL, NULL, NULL
1844  },
1845 #endif
1846 
1847  {
1848  {"integer_datetimes", PGC_INTERNAL, PRESET_OPTIONS,
1849  gettext_noop("Shows whether datetimes are integer based."),
1850  NULL,
1852  },
1854  true,
1855  NULL, NULL, NULL
1856  },
1857 
1858  {
1859  {"krb_caseins_users", PGC_SIGHUP, CONN_AUTH_AUTH,
1860  gettext_noop("Sets whether Kerberos and GSSAPI user names should be treated as case-insensitive."),
1861  NULL
1862  },
1864  false,
1865  NULL, NULL, NULL
1866  },
1867 
1868  {
1869  {"escape_string_warning", PGC_USERSET, COMPAT_OPTIONS_PREVIOUS,
1870  gettext_noop("Warn about backslash escapes in ordinary string literals."),
1871  NULL
1872  },
1874  true,
1875  NULL, NULL, NULL
1876  },
1877 
1878  {
1879  {"standard_conforming_strings", PGC_USERSET, COMPAT_OPTIONS_PREVIOUS,
1880  gettext_noop("Causes '...' strings to treat backslashes literally."),
1881  NULL,
1882  GUC_REPORT
1883  },
1885  true,
1886  NULL, NULL, NULL
1887  },
1888 
1889  {
1890  {"synchronize_seqscans", PGC_USERSET, COMPAT_OPTIONS_PREVIOUS,
1891  gettext_noop("Enable synchronized sequential scans."),
1892  NULL
1893  },
1895  true,
1896  NULL, NULL, NULL
1897  },
1898 
1899  {
1900  {"recovery_target_inclusive", PGC_POSTMASTER, WAL_RECOVERY_TARGET,
1901  gettext_noop("Sets whether to include or exclude transaction with recovery target."),
1902  NULL
1903  },
1905  true,
1906  NULL, NULL, NULL
1907  },
1908 
1909  {
1910  {"hot_standby", PGC_POSTMASTER, REPLICATION_STANDBY,
1911  gettext_noop("Allows connections and queries during recovery."),
1912  NULL
1913  },
1915  true,
1916  NULL, NULL, NULL
1917  },
1918 
1919  {
1920  {"hot_standby_feedback", PGC_SIGHUP, REPLICATION_STANDBY,
1921  gettext_noop("Allows feedback from a hot standby to the primary that will avoid query conflicts."),
1922  NULL
1923  },
1925  false,
1926  NULL, NULL, NULL
1927  },
1928 
1929  {
1930  {"in_hot_standby", PGC_INTERNAL, PRESET_OPTIONS,
1931  gettext_noop("Shows whether hot standby is currently active."),
1932  NULL,
1934  },
1935  &in_hot_standby,
1936  false,
1937  NULL, NULL, show_in_hot_standby
1938  },
1939 
1940  {
1941  {"allow_system_table_mods", PGC_SUSET, DEVELOPER_OPTIONS,
1942  gettext_noop("Allows modifications of the structure of system tables."),
1943  NULL,
1945  },
1947  false,
1948  NULL, NULL, NULL
1949  },
1950 
1951  {
1952  {"ignore_system_indexes", PGC_BACKEND, DEVELOPER_OPTIONS,
1953  gettext_noop("Disables reading from system indexes."),
1954  gettext_noop("It does not prevent updating the indexes, so it is safe "
1955  "to use. The worst consequence is slowness."),
1957  },
1959  false,
1960  NULL, NULL, NULL
1961  },
1962 
1963  {
1964  {"lo_compat_privileges", PGC_SUSET, COMPAT_OPTIONS_PREVIOUS,
1965  gettext_noop("Enables backward compatibility mode for privilege checks on large objects."),
1966  gettext_noop("Skips privilege checks when reading or modifying large objects, "
1967  "for compatibility with PostgreSQL releases prior to 9.0.")
1968  },
1970  false,
1971  NULL, NULL, NULL
1972  },
1973 
1974  {
1975  {"quote_all_identifiers", PGC_USERSET, COMPAT_OPTIONS_PREVIOUS,
1976  gettext_noop("When generating SQL fragments, quote all identifiers."),
1977  NULL,
1978  },
1980  false,
1981  NULL, NULL, NULL
1982  },
1983 
1984  {
1985  {"data_checksums", PGC_INTERNAL, PRESET_OPTIONS,
1986  gettext_noop("Shows whether data checksums are turned on for this cluster."),
1987  NULL,
1989  },
1990  &data_checksums,
1991  false,
1992  NULL, NULL, NULL
1993  },
1994 
1995  {
1996  {"syslog_sequence_numbers", PGC_SIGHUP, LOGGING_WHERE,
1997  gettext_noop("Add sequence number to syslog messages to avoid duplicate suppression."),
1998  NULL
1999  },
2001  true,
2002  NULL, NULL, NULL
2003  },
2004 
2005  {
2006  {"syslog_split_messages", PGC_SIGHUP, LOGGING_WHERE,
2007  gettext_noop("Split messages sent to syslog by lines and to fit into 1024 bytes."),
2008  NULL
2009  },
2011  true,
2012  NULL, NULL, NULL
2013  },
2014 
2015  {
2016  {"parallel_leader_participation", PGC_USERSET, RESOURCES_ASYNCHRONOUS,
2017  gettext_noop("Controls whether Gather and Gather Merge also run subplans."),
2018  gettext_noop("Should gather nodes also run subplans or just gather tuples?"),
2019  GUC_EXPLAIN
2020  },
2022  true,
2023  NULL, NULL, NULL
2024  },
2025 
2026  {
2028  gettext_noop("Allow JIT compilation."),
2029  NULL,
2030  GUC_EXPLAIN
2031  },
2032  &jit_enabled,
2033  true,
2034  NULL, NULL, NULL
2035  },
2036 
2037  {
2038  {"jit_debugging_support", PGC_SU_BACKEND, DEVELOPER_OPTIONS,
2039  gettext_noop("Register JIT-compiled functions with debugger."),
2040  NULL,
2042  },
2044  false,
2045 
2046  /*
2047  * This is not guaranteed to be available, but given it's a developer
2048  * oriented option, it doesn't seem worth adding code checking
2049  * availability.
2050  */
2051  NULL, NULL, NULL
2052  },
2053 
2054  {
2055  {"jit_dump_bitcode", PGC_SUSET, DEVELOPER_OPTIONS,
2056  gettext_noop("Write out LLVM bitcode to facilitate JIT debugging."),
2057  NULL,
2059  },
2061  false,
2062  NULL, NULL, NULL
2063  },
2064 
2065  {
2066  {"jit_expressions", PGC_USERSET, DEVELOPER_OPTIONS,
2067  gettext_noop("Allow JIT compilation of expressions."),
2068  NULL,
2070  },
2071  &jit_expressions,
2072  true,
2073  NULL, NULL, NULL
2074  },
2075 
2076  {
2077  {"jit_profiling_support", PGC_SU_BACKEND, DEVELOPER_OPTIONS,
2078  gettext_noop("Register JIT-compiled functions with perf profiler."),
2079  NULL,
2081  },
2083  false,
2084 
2085  /*
2086  * This is not guaranteed to be available, but given it's a developer
2087  * oriented option, it doesn't seem worth adding code checking
2088  * availability.
2089  */
2090  NULL, NULL, NULL
2091  },
2092 
2093  {
2094  {"jit_tuple_deforming", PGC_USERSET, DEVELOPER_OPTIONS,
2095  gettext_noop("Allow JIT compilation of tuple deforming."),
2096  NULL,
2098  },
2100  true,
2101  NULL, NULL, NULL
2102  },
2103 
2104  {
2105  {"data_sync_retry", PGC_POSTMASTER, ERROR_HANDLING_OPTIONS,
2106  gettext_noop("Whether to continue running after a failure to sync data files."),
2107  },
2108  &data_sync_retry,
2109  false,
2110  NULL, NULL, NULL
2111  },
2112 
2113  {
2114  {"wal_receiver_create_temp_slot", PGC_SIGHUP, REPLICATION_STANDBY,
2115  gettext_noop("Sets whether a WAL receiver should create a temporary replication slot if no permanent slot is configured."),
2116  },
2118  false,
2119  NULL, NULL, NULL
2120  },
2121 
2122  /* End-of-list marker */
2123  {
2124  {NULL, 0, 0, NULL, NULL}, NULL, false, NULL, NULL, NULL
2125  }
2126 };
2127 
2128 
2130 {
2131  {
2132  {"archive_timeout", PGC_SIGHUP, WAL_ARCHIVING,
2133  gettext_noop("Forces a switch to the next WAL file if a "
2134  "new file has not been started within N seconds."),
2135  NULL,
2136  GUC_UNIT_S
2137  },
2139  0, 0, INT_MAX / 2,
2140  NULL, NULL, NULL
2141  },
2142  {
2143  {"post_auth_delay", PGC_BACKEND, DEVELOPER_OPTIONS,
2144  gettext_noop("Waits N seconds on connection startup after authentication."),
2145  gettext_noop("This allows attaching a debugger to the process."),
2147  },
2148  &PostAuthDelay,
2149  0, 0, INT_MAX / 1000000,
2150  NULL, NULL, NULL
2151  },
2152  {
2153  {"default_statistics_target", PGC_USERSET, QUERY_TUNING_OTHER,
2154  gettext_noop("Sets the default statistics target."),
2155  gettext_noop("This applies to table columns that have not had a "
2156  "column-specific target set via ALTER TABLE SET STATISTICS.")
2157  },
2159  100, 1, 10000,
2160  NULL, NULL, NULL
2161  },
2162  {
2163  {"from_collapse_limit", PGC_USERSET, QUERY_TUNING_OTHER,
2164  gettext_noop("Sets the FROM-list size beyond which subqueries "
2165  "are not collapsed."),
2166  gettext_noop("The planner will merge subqueries into upper "
2167  "queries if the resulting FROM list would have no more than "
2168  "this many items."),
2169  GUC_EXPLAIN
2170  },
2172  8, 1, INT_MAX,
2173  NULL, NULL, NULL
2174  },
2175  {
2176  {"join_collapse_limit", PGC_USERSET, QUERY_TUNING_OTHER,
2177  gettext_noop("Sets the FROM-list size beyond which JOIN "
2178  "constructs are not flattened."),
2179  gettext_noop("The planner will flatten explicit JOIN "
2180  "constructs into lists of FROM items whenever a "
2181  "list of no more than this many items would result."),
2182  GUC_EXPLAIN
2183  },
2185  8, 1, INT_MAX,
2186  NULL, NULL, NULL
2187  },
2188  {
2189  {"geqo_threshold", PGC_USERSET, QUERY_TUNING_GEQO,
2190  gettext_noop("Sets the threshold of FROM items beyond which GEQO is used."),
2191  NULL,
2192  GUC_EXPLAIN
2193  },
2194  &geqo_threshold,
2195  12, 2, INT_MAX,
2196  NULL, NULL, NULL
2197  },
2198  {
2199  {"geqo_effort", PGC_USERSET, QUERY_TUNING_GEQO,
2200  gettext_noop("GEQO: effort is used to set the default for other GEQO parameters."),
2201  NULL,
2202  GUC_EXPLAIN
2203  },
2204  &Geqo_effort,
2206  NULL, NULL, NULL
2207  },
2208  {
2209  {"geqo_pool_size", PGC_USERSET, QUERY_TUNING_GEQO,
2210  gettext_noop("GEQO: number of individuals in the population."),
2211  gettext_noop("Zero selects a suitable default value."),
2212  GUC_EXPLAIN
2213  },
2214  &Geqo_pool_size,
2215  0, 0, INT_MAX,
2216  NULL, NULL, NULL
2217  },
2218  {
2219  {"geqo_generations", PGC_USERSET, QUERY_TUNING_GEQO,
2220  gettext_noop("GEQO: number of iterations of the algorithm."),
2221  gettext_noop("Zero selects a suitable default value."),
2222  GUC_EXPLAIN
2223  },
2225  0, 0, INT_MAX,
2226  NULL, NULL, NULL
2227  },
2228 
2229  {
2230  /* This is PGC_SUSET to prevent hiding from log_lock_waits. */
2231  {"deadlock_timeout", PGC_SUSET, LOCK_MANAGEMENT,
2232  gettext_noop("Sets the time to wait on a lock before checking for deadlock."),
2233  NULL,
2234  GUC_UNIT_MS
2235  },
2236  &DeadlockTimeout,
2237  1000, 1, INT_MAX,
2238  NULL, NULL, NULL
2239  },
2240 
2241  {
2242  {"max_standby_archive_delay", PGC_SIGHUP, REPLICATION_STANDBY,
2243  gettext_noop("Sets the maximum delay before canceling queries when a hot standby server is processing archived WAL data."),
2244  NULL,
2245  GUC_UNIT_MS
2246  },
2248  30 * 1000, -1, INT_MAX,
2249  NULL, NULL, NULL
2250  },
2251 
2252  {
2253  {"max_standby_streaming_delay", PGC_SIGHUP, REPLICATION_STANDBY,
2254  gettext_noop("Sets the maximum delay before canceling queries when a hot standby server is processing streamed WAL data."),
2255  NULL,
2256  GUC_UNIT_MS
2257  },
2259  30 * 1000, -1, INT_MAX,
2260  NULL, NULL, NULL
2261  },
2262 
2263  {
2264  {"recovery_min_apply_delay", PGC_SIGHUP, REPLICATION_STANDBY,
2265  gettext_noop("Sets the minimum delay for applying changes during recovery."),
2266  NULL,
2267  GUC_UNIT_MS
2268  },
2270  0, 0, INT_MAX,
2271  NULL, NULL, NULL
2272  },
2273 
2274  {
2275  {"wal_receiver_status_interval", PGC_SIGHUP, REPLICATION_STANDBY,
2276  gettext_noop("Sets the maximum interval between WAL receiver status reports to the sending server."),
2277  NULL,
2278  GUC_UNIT_S
2279  },
2281  10, 0, INT_MAX / 1000,
2282  NULL, NULL, NULL
2283  },
2284 
2285  {
2286  {"wal_receiver_timeout", PGC_SIGHUP, REPLICATION_STANDBY,
2287  gettext_noop("Sets the maximum wait time to receive data from the sending server."),
2288  NULL,
2289  GUC_UNIT_MS
2290  },
2292  60 * 1000, 0, INT_MAX,
2293  NULL, NULL, NULL
2294  },
2295 
2296  {
2297  {"max_connections", PGC_POSTMASTER, CONN_AUTH_SETTINGS,
2298  gettext_noop("Sets the maximum number of concurrent connections."),
2299  NULL
2300  },
2301  &MaxConnections,
2302  100, 1, MAX_BACKENDS,
2303  check_maxconnections, NULL, NULL
2304  },
2305 
2306  {
2307  /* see max_connections */
2308  {"superuser_reserved_connections", PGC_POSTMASTER, CONN_AUTH_SETTINGS,
2309  gettext_noop("Sets the number of connection slots reserved for superusers."),
2310  NULL
2311  },
2313  3, 0, MAX_BACKENDS,
2314  NULL, NULL, NULL
2315  },
2316 
2317  {
2318  {"min_dynamic_shared_memory", PGC_POSTMASTER, RESOURCES_MEM,
2319  gettext_noop("Amount of dynamic shared memory reserved at startup."),
2320  NULL,
2321  GUC_UNIT_MB
2322  },
2324  0, 0, (int) Min((size_t) INT_MAX, SIZE_MAX / (1024 * 1024)),
2325  NULL, NULL, NULL
2326  },
2327 
2328  /*
2329  * We sometimes multiply the number of shared buffers by two without
2330  * checking for overflow, so we mustn't allow more than INT_MAX / 2.
2331  */
2332  {
2333  {"shared_buffers", PGC_POSTMASTER, RESOURCES_MEM,
2334  gettext_noop("Sets the number of shared memory buffers used by the server."),
2335  NULL,
2337  },
2338  &NBuffers,
2339  16384, 16, INT_MAX / 2,
2340  NULL, NULL, NULL
2341  },
2342 
2343  {
2344  {"shared_memory_size", PGC_INTERNAL, PRESET_OPTIONS,
2345  gettext_noop("Shows the size of the server's main shared memory area (rounded up to the nearest MB)."),
2346  NULL,
2348  },
2350  0, 0, INT_MAX,
2351  NULL, NULL, NULL
2352  },
2353 
2354  {
2355  {"shared_memory_size_in_huge_pages", PGC_INTERNAL, PRESET_OPTIONS,
2356  gettext_noop("Shows the number of huge pages needed for the main shared memory area."),
2357  gettext_noop("-1 indicates that the value could not be determined."),
2359  },
2361  -1, -1, INT_MAX,
2362  NULL, NULL, NULL
2363  },
2364 
2365  {
2366  {"temp_buffers", PGC_USERSET, RESOURCES_MEM,
2367  gettext_noop("Sets the maximum number of temporary buffers used by each session."),
2368  NULL,
2370  },
2372  1024, 100, INT_MAX / 2,
2373  check_temp_buffers, NULL, NULL
2374  },
2375 
2376  {
2378  gettext_noop("Sets the TCP port the server listens on."),
2379  NULL
2380  },
2381  &PostPortNumber,
2382  DEF_PGPORT, 1, 65535,
2383  NULL, NULL, NULL
2384  },
2385 
2386  {
2387  {"unix_socket_permissions", PGC_POSTMASTER, CONN_AUTH_SETTINGS,
2388  gettext_noop("Sets the access permissions of the Unix-domain socket."),
2389  gettext_noop("Unix-domain sockets use the usual Unix file system "
2390  "permission set. The parameter value is expected "
2391  "to be a numeric mode specification in the form "
2392  "accepted by the chmod and umask system calls. "
2393  "(To use the customary octal format the number must "
2394  "start with a 0 (zero).)")
2395  },
2397  0777, 0000, 0777,
2398  NULL, NULL, show_unix_socket_permissions
2399  },
2400 
2401  {
2402  {"log_file_mode", PGC_SIGHUP, LOGGING_WHERE,
2403  gettext_noop("Sets the file permissions for log files."),
2404  gettext_noop("The parameter value is expected "
2405  "to be a numeric mode specification in the form "
2406  "accepted by the chmod and umask system calls. "
2407  "(To use the customary octal format the number must "
2408  "start with a 0 (zero).)")
2409  },
2410  &Log_file_mode,
2411  0600, 0000, 0777,
2412  NULL, NULL, show_log_file_mode
2413  },
2414 
2415 
2416  {
2417  {"data_directory_mode", PGC_INTERNAL, PRESET_OPTIONS,
2418  gettext_noop("Shows the mode of the data directory."),
2419  gettext_noop("The parameter value is a numeric mode specification "
2420  "in the form accepted by the chmod and umask system "
2421  "calls. (To use the customary octal format the number "
2422  "must start with a 0 (zero).)"),
2424  },
2426  0700, 0000, 0777,
2427  NULL, NULL, show_data_directory_mode
2428  },
2429 
2430  {
2431  {"work_mem", PGC_USERSET, RESOURCES_MEM,
2432  gettext_noop("Sets the maximum memory to be used for query workspaces."),
2433  gettext_noop("This much memory can be used by each internal "
2434  "sort operation and hash table before switching to "
2435  "temporary disk files."),
2437  },
2438  &work_mem,
2439  4096, 64, MAX_KILOBYTES,
2440  NULL, NULL, NULL
2441  },
2442 
2443  {
2444  {"maintenance_work_mem", PGC_USERSET, RESOURCES_MEM,
2445  gettext_noop("Sets the maximum memory to be used for maintenance operations."),
2446  gettext_noop("This includes operations such as VACUUM and CREATE INDEX."),
2447  GUC_UNIT_KB
2448  },
2450  65536, 1024, MAX_KILOBYTES,
2451  NULL, NULL, NULL
2452  },
2453 
2454  {
2455  {"logical_decoding_work_mem", PGC_USERSET, RESOURCES_MEM,
2456  gettext_noop("Sets the maximum memory to be used for logical decoding."),
2457  gettext_noop("This much memory can be used by each internal "
2458  "reorder buffer before spilling to disk."),
2459  GUC_UNIT_KB
2460  },
2462  65536, 64, MAX_KILOBYTES,
2463  NULL, NULL, NULL
2464  },
2465 
2466  /*
2467  * We use the hopefully-safely-small value of 100kB as the compiled-in
2468  * default for max_stack_depth. InitializeGUCOptions will increase it if
2469  * possible, depending on the actual platform-specific stack limit.
2470  */
2471  {
2472  {"max_stack_depth", PGC_SUSET, RESOURCES_MEM,
2473  gettext_noop("Sets the maximum stack depth, in kilobytes."),
2474  NULL,
2475  GUC_UNIT_KB
2476  },
2477  &max_stack_depth,
2478  100, 100, MAX_KILOBYTES,
2480  },
2481 
2482  {
2483  {"temp_file_limit", PGC_SUSET, RESOURCES_DISK,
2484  gettext_noop("Limits the total size of all temporary files used by each process."),
2485  gettext_noop("-1 means no limit."),
2486  GUC_UNIT_KB
2487  },
2488  &temp_file_limit,
2489  -1, -1, INT_MAX,
2490  NULL, NULL, NULL
2491  },
2492 
2493  {
2494  {"vacuum_cost_page_hit", PGC_USERSET, RESOURCES_VACUUM_DELAY,
2495  gettext_noop("Vacuum cost for a page found in the buffer cache."),
2496  NULL
2497  },
2499  1, 0, 10000,
2500  NULL, NULL, NULL
2501  },
2502 
2503  {
2504  {"vacuum_cost_page_miss", PGC_USERSET, RESOURCES_VACUUM_DELAY,
2505  gettext_noop("Vacuum cost for a page not found in the buffer cache."),
2506  NULL
2507  },
2509  2, 0, 10000,
2510  NULL, NULL, NULL
2511  },
2512 
2513  {
2514  {"vacuum_cost_page_dirty", PGC_USERSET, RESOURCES_VACUUM_DELAY,
2515  gettext_noop("Vacuum cost for a page dirtied by vacuum."),
2516  NULL
2517  },
2519  20, 0, 10000,
2520  NULL, NULL, NULL
2521  },
2522 
2523  {
2524  {"vacuum_cost_limit", PGC_USERSET, RESOURCES_VACUUM_DELAY,
2525  gettext_noop("Vacuum cost amount available before napping."),
2526  NULL
2527  },
2528  &VacuumCostLimit,
2529  200, 1, 10000,
2530  NULL, NULL, NULL
2531  },
2532 
2533  {
2534  {"autovacuum_vacuum_cost_limit", PGC_SIGHUP, AUTOVACUUM,
2535  gettext_noop("Vacuum cost amount available before napping, for autovacuum."),
2536  NULL
2537  },
2539  -1, -1, 10000,
2540  NULL, NULL, NULL
2541  },
2542 
2543  {
2544  {"max_files_per_process", PGC_POSTMASTER, RESOURCES_KERNEL,
2545  gettext_noop("Sets the maximum number of simultaneously open files for each server process."),
2546  NULL
2547  },
2549  1000, 64, INT_MAX,
2550  NULL, NULL, NULL
2551  },
2552 
2553  /*
2554  * See also CheckRequiredParameterValues() if this parameter changes
2555  */
2556  {
2557  {"max_prepared_transactions", PGC_POSTMASTER, RESOURCES_MEM,
2558  gettext_noop("Sets the maximum number of simultaneously prepared transactions."),
2559  NULL
2560  },
2562  0, 0, MAX_BACKENDS,
2563  NULL, NULL, NULL
2564  },
2565 
2566 #ifdef LOCK_DEBUG
2567  {
2568  {"trace_lock_oidmin", PGC_SUSET, DEVELOPER_OPTIONS,
2569  gettext_noop("Sets the minimum OID of tables for tracking locks."),
2570  gettext_noop("Is used to avoid output on system tables."),
2572  },
2573  &Trace_lock_oidmin,
2574  FirstNormalObjectId, 0, INT_MAX,
2575  NULL, NULL, NULL
2576  },
2577  {
2578  {"trace_lock_table", PGC_SUSET, DEVELOPER_OPTIONS,
2579  gettext_noop("Sets the OID of the table with unconditionally lock tracing."),
2580  NULL,
2582  },
2583  &Trace_lock_table,
2584  0, 0, INT_MAX,
2585  NULL, NULL, NULL
2586  },
2587 #endif
2588 
2589  {
2590  {"statement_timeout", PGC_USERSET, CLIENT_CONN_STATEMENT,
2591  gettext_noop("Sets the maximum allowed duration of any statement."),
2592  gettext_noop("A value of 0 turns off the timeout."),
2593  GUC_UNIT_MS
2594  },
2596  0, 0, INT_MAX,
2597  NULL, NULL, NULL
2598  },
2599 
2600  {
2601  {"lock_timeout", PGC_USERSET, CLIENT_CONN_STATEMENT,
2602  gettext_noop("Sets the maximum allowed duration of any wait for a lock."),
2603  gettext_noop("A value of 0 turns off the timeout."),
2604  GUC_UNIT_MS
2605  },
2606  &LockTimeout,
2607  0, 0, INT_MAX,
2608  NULL, NULL, NULL
2609  },
2610 
2611  {
2612  {"idle_in_transaction_session_timeout", PGC_USERSET, CLIENT_CONN_STATEMENT,
2613  gettext_noop("Sets the maximum allowed idle time between queries, when in a transaction."),
2614  gettext_noop("A value of 0 turns off the timeout."),
2615  GUC_UNIT_MS
2616  },
2618  0, 0, INT_MAX,
2619  NULL, NULL, NULL
2620  },
2621 
2622  {
2623  {"idle_session_timeout", PGC_USERSET, CLIENT_CONN_STATEMENT,
2624  gettext_noop("Sets the maximum allowed idle time between queries, when not in a transaction."),
2625  gettext_noop("A value of 0 turns off the timeout."),
2626  GUC_UNIT_MS
2627  },
2629  0, 0, INT_MAX,
2630  NULL, NULL, NULL
2631  },
2632 
2633  {
2634  {"vacuum_freeze_min_age", PGC_USERSET, CLIENT_CONN_STATEMENT,
2635  gettext_noop("Minimum age at which VACUUM should freeze a table row."),
2636  NULL
2637  },
2639  50000000, 0, 1000000000,
2640  NULL, NULL, NULL
2641  },
2642 
2643  {
2644  {"vacuum_freeze_table_age", PGC_USERSET, CLIENT_CONN_STATEMENT,
2645  gettext_noop("Age at which VACUUM should scan whole table to freeze tuples."),
2646  NULL
2647  },
2649  150000000, 0, 2000000000,
2650  NULL, NULL, NULL
2651  },
2652 
2653  {
2654  {"vacuum_multixact_freeze_min_age", PGC_USERSET, CLIENT_CONN_STATEMENT,
2655  gettext_noop("Minimum age at which VACUUM should freeze a MultiXactId in a table row."),
2656  NULL
2657  },
2659  5000000, 0, 1000000000,
2660  NULL, NULL, NULL
2661  },
2662 
2663  {
2664  {"vacuum_multixact_freeze_table_age", PGC_USERSET, CLIENT_CONN_STATEMENT,
2665  gettext_noop("Multixact age at which VACUUM should scan whole table to freeze tuples."),
2666  NULL
2667  },
2669  150000000, 0, 2000000000,
2670  NULL, NULL, NULL
2671  },
2672 
2673  {
2674  {"vacuum_defer_cleanup_age", PGC_SIGHUP, REPLICATION_PRIMARY,
2675  gettext_noop("Number of transactions by which VACUUM and HOT cleanup should be deferred, if any."),
2676  NULL
2677  },
2679  0, 0, 1000000, /* see ComputeXidHorizons */
2680  NULL, NULL, NULL
2681  },
2682  {
2683  {"vacuum_failsafe_age", PGC_USERSET, CLIENT_CONN_STATEMENT,
2684  gettext_noop("Age at which VACUUM should trigger failsafe to avoid a wraparound outage."),
2685  NULL
2686  },
2688  1600000000, 0, 2100000000,
2689  NULL, NULL, NULL
2690  },
2691  {
2692  {"vacuum_multixact_failsafe_age", PGC_USERSET, CLIENT_CONN_STATEMENT,
2693  gettext_noop("Multixact age at which VACUUM should trigger failsafe to avoid a wraparound outage."),
2694  NULL
2695  },
2697  1600000000, 0, 2100000000,
2698  NULL, NULL, NULL
2699  },
2700 
2701  /*
2702  * See also CheckRequiredParameterValues() if this parameter changes
2703  */
2704  {
2705  {"max_locks_per_transaction", PGC_POSTMASTER, LOCK_MANAGEMENT,
2706  gettext_noop("Sets the maximum number of locks per transaction."),
2707  gettext_noop("The shared lock table is sized on the assumption that "
2708  "at most max_locks_per_transaction * max_connections distinct "
2709  "objects will need to be locked at any one time.")
2710  },
2712  64, 10, INT_MAX,
2713  NULL, NULL, NULL
2714  },
2715 
2716  {
2717  {"max_pred_locks_per_transaction", PGC_POSTMASTER, LOCK_MANAGEMENT,
2718  gettext_noop("Sets the maximum number of predicate locks per transaction."),
2719  gettext_noop("The shared predicate lock table is sized on the assumption that "
2720  "at most max_pred_locks_per_transaction * max_connections distinct "
2721  "objects will need to be locked at any one time.")
2722  },
2724  64, 10, INT_MAX,
2725  NULL, NULL, NULL
2726  },
2727 
2728  {
2729  {"max_pred_locks_per_relation", PGC_SIGHUP, LOCK_MANAGEMENT,
2730  gettext_noop("Sets the maximum number of predicate-locked pages and tuples per relation."),
2731  gettext_noop("If more than this total of pages and tuples in the same relation are locked "
2732  "by a connection, those locks are replaced by a relation-level lock.")
2733  },
2735  -2, INT_MIN, INT_MAX,
2736  NULL, NULL, NULL
2737  },
2738 
2739  {
2740  {"max_pred_locks_per_page", PGC_SIGHUP, LOCK_MANAGEMENT,
2741  gettext_noop("Sets the maximum number of predicate-locked tuples per page."),
2742  gettext_noop("If more than this number of tuples on the same page are locked "
2743  "by a connection, those locks are replaced by a page-level lock.")
2744  },
2746  2, 0, INT_MAX,
2747  NULL, NULL, NULL
2748  },
2749 
2750  {
2751  {"authentication_timeout", PGC_SIGHUP, CONN_AUTH_AUTH,
2752  gettext_noop("Sets the maximum allowed time to complete client authentication."),
2753  NULL,
2754  GUC_UNIT_S
2755  },
2757  60, 1, 600,
2758  NULL, NULL, NULL
2759  },
2760 
2761  {
2762  /* Not for general use */
2763  {"pre_auth_delay", PGC_SIGHUP, DEVELOPER_OPTIONS,
2764  gettext_noop("Waits N seconds on connection startup before authentication."),
2765  gettext_noop("This allows attaching a debugger to the process."),
2767  },
2768  &PreAuthDelay,
2769  0, 0, 60,
2770  NULL, NULL, NULL
2771  },
2772 
2773  {
2774  {"wal_keep_size", PGC_SIGHUP, REPLICATION_SENDING,
2775  gettext_noop("Sets the size of WAL files held for standby servers."),
2776  NULL,
2777  GUC_UNIT_MB
2778  },
2780  0, 0, MAX_KILOBYTES,
2781  NULL, NULL, NULL
2782  },
2783 
2784  {
2785  {"min_wal_size", PGC_SIGHUP, WAL_CHECKPOINTS,
2786  gettext_noop("Sets the minimum size to shrink the WAL to."),
2787  NULL,
2788  GUC_UNIT_MB
2789  },
2790  &min_wal_size_mb,
2791  DEFAULT_MIN_WAL_SEGS * (DEFAULT_XLOG_SEG_SIZE / (1024 * 1024)),
2792  2, MAX_KILOBYTES,
2793  NULL, NULL, NULL
2794  },
2795 
2796  {
2797  {"max_wal_size", PGC_SIGHUP, WAL_CHECKPOINTS,
2798  gettext_noop("Sets the WAL size that triggers a checkpoint."),
2799  NULL,
2800  GUC_UNIT_MB
2801  },
2802  &max_wal_size_mb,
2803  DEFAULT_MAX_WAL_SEGS * (DEFAULT_XLOG_SEG_SIZE / (1024 * 1024)),
2804  2, MAX_KILOBYTES,
2805  NULL, assign_max_wal_size, NULL
2806  },
2807 
2808  {
2809  {"checkpoint_timeout", PGC_SIGHUP, WAL_CHECKPOINTS,
2810  gettext_noop("Sets the maximum time between automatic WAL checkpoints."),
2811  NULL,
2812  GUC_UNIT_S
2813  },
2815  300, 30, 86400,
2816  NULL, NULL, NULL
2817  },
2818 
2819  {
2820  {"checkpoint_warning", PGC_SIGHUP, WAL_CHECKPOINTS,
2821  gettext_noop("Enables warnings if checkpoint segments are filled more "
2822  "frequently than this."),
2823  gettext_noop("Write a message to the server log if checkpoints "
2824  "caused by the filling of checkpoint segment files happens more "
2825  "frequently than this number of seconds. Zero turns off the warning."),
2826  GUC_UNIT_S
2827  },
2829  30, 0, INT_MAX,
2830  NULL, NULL, NULL
2831  },
2832 
2833  {
2834  {"checkpoint_flush_after", PGC_SIGHUP, WAL_CHECKPOINTS,
2835  gettext_noop("Number of pages after which previously performed writes are flushed to disk."),
2836  NULL,
2838  },
2841  NULL, NULL, NULL
2842  },
2843 
2844  {
2845  {"wal_buffers", PGC_POSTMASTER, WAL_SETTINGS,
2846  gettext_noop("Sets the number of disk-page buffers in shared memory for WAL."),
2847  NULL,
2849  },
2850  &XLOGbuffers,
2851  -1, -1, (INT_MAX / XLOG_BLCKSZ),
2852  check_wal_buffers, NULL, NULL
2853  },
2854 
2855  {
2856  {"wal_writer_delay", PGC_SIGHUP, WAL_SETTINGS,
2857  gettext_noop("Time between WAL flushes performed in the WAL writer."),
2858  NULL,
2859  GUC_UNIT_MS
2860  },
2861  &WalWriterDelay,
2862  200, 1, 10000,
2863  NULL, NULL, NULL
2864  },
2865 
2866  {
2867  {"wal_writer_flush_after", PGC_SIGHUP, WAL_SETTINGS,
2868  gettext_noop("Amount of WAL written out by WAL writer that triggers a flush."),
2869  NULL,
2871  },
2873  (1024 * 1024) / XLOG_BLCKSZ, 0, INT_MAX,
2874  NULL, NULL, NULL
2875  },
2876 
2877  {
2878  {"wal_skip_threshold", PGC_USERSET, WAL_SETTINGS,
2879  gettext_noop("Minimum size of new file to fsync instead of writing WAL."),
2880  NULL,
2881  GUC_UNIT_KB
2882  },
2884  2048, 0, MAX_KILOBYTES,
2885  NULL, NULL, NULL
2886  },
2887 
2888  {
2889  {"max_wal_senders", PGC_POSTMASTER, REPLICATION_SENDING,
2890  gettext_noop("Sets the maximum number of simultaneously running WAL sender processes."),
2891  NULL
2892  },
2893  &max_wal_senders,
2894  10, 0, MAX_BACKENDS,
2895  check_max_wal_senders, NULL, NULL
2896  },
2897 
2898  {
2899  /* see max_wal_senders */
2900  {"max_replication_slots", PGC_POSTMASTER, REPLICATION_SENDING,
2901  gettext_noop("Sets the maximum number of simultaneously defined replication slots."),
2902  NULL
2903  },
2905  10, 0, MAX_BACKENDS /* XXX? */ ,
2906  NULL, NULL, NULL
2907  },
2908 
2909  {
2910  {"max_slot_wal_keep_size", PGC_SIGHUP, REPLICATION_SENDING,
2911  gettext_noop("Sets the maximum WAL size that can be reserved by replication slots."),
2912  gettext_noop("Replication slots will be marked as failed, and segments released "
2913  "for deletion or recycling, if this much space is occupied by WAL "
2914  "on disk."),
2915  GUC_UNIT_MB
2916  },
2918  -1, -1, MAX_KILOBYTES,
2919  NULL, NULL, NULL
2920  },
2921 
2922  {
2923  {"wal_sender_timeout", PGC_USERSET, REPLICATION_SENDING,
2924  gettext_noop("Sets the maximum time to wait for WAL replication."),
2925  NULL,
2926  GUC_UNIT_MS
2927  },
2929  60 * 1000, 0, INT_MAX,
2930  NULL, NULL, NULL
2931  },
2932 
2933  {
2934  {"commit_delay", PGC_SUSET, WAL_SETTINGS,
2935  gettext_noop("Sets the delay in microseconds between transaction commit and "
2936  "flushing WAL to disk."),
2937  NULL
2938  /* we have no microseconds designation, so can't supply units here */
2939  },
2940  &CommitDelay,
2941  0, 0, 100000,
2942  NULL, NULL, NULL
2943  },
2944 
2945  {
2946  {"commit_siblings", PGC_USERSET, WAL_SETTINGS,
2947  gettext_noop("Sets the minimum concurrent open transactions before performing "
2948  "commit_delay."),
2949  NULL
2950  },
2951  &CommitSiblings,
2952  5, 0, 1000,
2953  NULL, NULL, NULL
2954  },
2955 
2956  {
2957  {"extra_float_digits", PGC_USERSET, CLIENT_CONN_LOCALE,
2958  gettext_noop("Sets the number of digits displayed for floating-point values."),
2959  gettext_noop("This affects real, double precision, and geometric data types. "
2960  "A zero or negative parameter value is added to the standard "
2961  "number of digits (FLT_DIG or DBL_DIG as appropriate). "
2962  "Any value greater than zero selects precise output mode.")
2963  },
2965  1, -15, 3,
2966  NULL, NULL, NULL
2967  },
2968 
2969  {
2970  {"log_min_duration_sample", PGC_SUSET, LOGGING_WHEN,
2971  gettext_noop("Sets the minimum execution time above which "
2972  "a sample of statements will be logged."
2973  " Sampling is determined by log_statement_sample_rate."),
2974  gettext_noop("Zero logs a sample of all queries. -1 turns this feature off."),
2975  GUC_UNIT_MS
2976  },
2978  -1, -1, INT_MAX,
2979  NULL, NULL, NULL
2980  },
2981 
2982  {
2983  {"log_min_duration_statement", PGC_SUSET, LOGGING_WHEN,
2984  gettext_noop("Sets the minimum execution time above which "
2985  "all statements will be logged."),
2986  gettext_noop("Zero prints 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_autovacuum_min_duration", PGC_SIGHUP, LOGGING_WHAT,
2996  gettext_noop("Sets the minimum execution time above which "
2997  "autovacuum actions will be logged."),
2998  gettext_noop("Zero prints all actions. -1 turns autovacuum logging off."),
2999  GUC_UNIT_MS
3000  },
3002  -1, -1, INT_MAX,
3003  NULL, NULL, NULL
3004  },
3005 
3006  {
3007  {"log_parameter_max_length", PGC_SUSET, LOGGING_WHAT,
3008  gettext_noop("When logging statements, limit logged parameter values to first N bytes."),
3009  gettext_noop("-1 to print values in full."),
3011  },
3013  -1, -1, INT_MAX / 2,
3014  NULL, NULL, NULL
3015  },
3016 
3017  {
3018  {"log_parameter_max_length_on_error", PGC_USERSET, LOGGING_WHAT,
3019  gettext_noop("When reporting an error, limit logged parameter values to first N bytes."),
3020  gettext_noop("-1 to print values in full."),
3022  },
3024  0, -1, INT_MAX / 2,
3025  NULL, NULL, NULL
3026  },
3027 
3028  {
3029  {"bgwriter_delay", PGC_SIGHUP, RESOURCES_BGWRITER,
3030  gettext_noop("Background writer sleep time between rounds."),
3031  NULL,
3032  GUC_UNIT_MS
3033  },
3034  &BgWriterDelay,
3035  200, 10, 10000,
3036  NULL, NULL, NULL
3037  },
3038 
3039  {
3040  {"bgwriter_lru_maxpages", PGC_SIGHUP, RESOURCES_BGWRITER,
3041  gettext_noop("Background writer maximum number of LRU pages to flush per round."),
3042  NULL
3043  },
3045  100, 0, INT_MAX / 2, /* Same upper limit as shared_buffers */
3046  NULL, NULL, NULL
3047  },
3048 
3049  {
3050  {"bgwriter_flush_after", PGC_SIGHUP, RESOURCES_BGWRITER,
3051  gettext_noop("Number of pages after which previously performed writes are flushed to disk."),
3052  NULL,
3054  },
3057  NULL, NULL, NULL
3058  },
3059 
3060  {
3061  {"effective_io_concurrency",
3062  PGC_USERSET,
3064  gettext_noop("Number of simultaneous requests that can be handled efficiently by the disk subsystem."),
3065  NULL,
3066  GUC_EXPLAIN
3067  },
3069 #ifdef USE_PREFETCH
3070  1,
3071 #else
3072  0,
3073 #endif
3074  0, MAX_IO_CONCURRENCY,
3075  check_effective_io_concurrency, NULL, NULL
3076  },
3077 
3078  {
3079  {"maintenance_io_concurrency",
3080  PGC_USERSET,
3082  gettext_noop("A variant of effective_io_concurrency that is used for maintenance work."),
3083  NULL,
3084  GUC_EXPLAIN
3085  },
3087 #ifdef USE_PREFETCH
3088  10,
3089 #else
3090  0,
3091 #endif
3092  0, MAX_IO_CONCURRENCY,
3094  },
3095 
3096  {
3097  {"backend_flush_after", PGC_USERSET, RESOURCES_ASYNCHRONOUS,
3098  gettext_noop("Number of pages after which previously performed writes are flushed to disk."),
3099  NULL,
3101  },
3104  NULL, NULL, NULL
3105  },
3106 
3107  {
3108  {"max_worker_processes",
3111  gettext_noop("Maximum number of concurrent worker processes."),
3112  NULL,
3113  },
3115  8, 0, MAX_BACKENDS,
3116  check_max_worker_processes, NULL, NULL
3117  },
3118 
3119  {
3120  {"max_logical_replication_workers",
3123  gettext_noop("Maximum number of logical replication worker processes."),
3124  NULL,
3125  },
3127  4, 0, MAX_BACKENDS,
3128  NULL, NULL, NULL
3129  },
3130 
3131  {
3132  {"max_sync_workers_per_subscription",
3133  PGC_SIGHUP,
3135  gettext_noop("Maximum number of table synchronization workers per subscription."),
3136  NULL,
3137  },
3139  2, 0, MAX_BACKENDS,
3140  NULL, NULL, NULL
3141  },
3142 
3143  {
3144  {"log_rotation_age", PGC_SIGHUP, LOGGING_WHERE,
3145  gettext_noop("Automatic log file rotation will occur after N minutes."),
3146  NULL,
3147  GUC_UNIT_MIN
3148  },
3149  &Log_RotationAge,
3151  NULL, NULL, NULL
3152  },
3153 
3154  {
3155  {"log_rotation_size", PGC_SIGHUP, LOGGING_WHERE,
3156  gettext_noop("Automatic log file rotation will occur after N kilobytes."),
3157  NULL,
3158  GUC_UNIT_KB
3159  },
3161  10 * 1024, 0, INT_MAX / 1024,
3162  NULL, NULL, NULL
3163  },
3164 
3165  {
3166  {"max_function_args", PGC_INTERNAL, PRESET_OPTIONS,
3167  gettext_noop("Shows the maximum number of function arguments."),
3168  NULL,
3170  },
3173  NULL, NULL, NULL
3174  },
3175 
3176  {
3177  {"max_index_keys", PGC_INTERNAL, PRESET_OPTIONS,
3178  gettext_noop("Shows the maximum number of index keys."),
3179  NULL,
3181  },
3182  &max_index_keys,
3184  NULL, NULL, NULL
3185  },
3186 
3187  {
3188  {"max_identifier_length", PGC_INTERNAL, PRESET_OPTIONS,
3189  gettext_noop("Shows the maximum identifier length."),
3190  NULL,
3192  },
3194  NAMEDATALEN - 1, NAMEDATALEN - 1, NAMEDATALEN - 1,
3195  NULL, NULL, NULL
3196  },
3197 
3198  {
3199  {"block_size", PGC_INTERNAL, PRESET_OPTIONS,
3200  gettext_noop("Shows the size of a disk block."),
3201  NULL,
3203  },
3204  &block_size,
3205  BLCKSZ, BLCKSZ, BLCKSZ,
3206  NULL, NULL, NULL
3207  },
3208 
3209  {
3210  {"segment_size", PGC_INTERNAL, PRESET_OPTIONS,
3211  gettext_noop("Shows the number of pages per disk file."),
3212  NULL,
3214  },
3215  &segment_size,
3216  RELSEG_SIZE, RELSEG_SIZE, RELSEG_SIZE,
3217  NULL, NULL, NULL
3218  },
3219 
3220  {
3221  {"wal_block_size", PGC_INTERNAL, PRESET_OPTIONS,
3222  gettext_noop("Shows the block size in the write ahead log."),
3223  NULL,
3225  },
3226  &wal_block_size,
3227  XLOG_BLCKSZ, XLOG_BLCKSZ, XLOG_BLCKSZ,
3228  NULL, NULL, NULL
3229  },
3230 
3231  {
3232  {"wal_retrieve_retry_interval", PGC_SIGHUP, REPLICATION_STANDBY,
3233  gettext_noop("Sets the time to wait before retrying to retrieve WAL "
3234  "after a failed attempt."),
3235  NULL,
3236  GUC_UNIT_MS
3237  },
3239  5000, 1, INT_MAX,
3240  NULL, NULL, NULL
3241  },
3242 
3243  {
3244  {"wal_segment_size", PGC_INTERNAL, PRESET_OPTIONS,
3245  gettext_noop("Shows the size of write ahead log segments."),
3246  NULL,
3248  },
3251  WalSegMinSize,
3252  WalSegMaxSize,
3253  NULL, NULL, NULL
3254  },
3255 
3256  {
3257  {"autovacuum_naptime", PGC_SIGHUP, AUTOVACUUM,
3258  gettext_noop("Time to sleep between autovacuum runs."),
3259  NULL,
3260  GUC_UNIT_S
3261  },
3263  60, 1, INT_MAX / 1000,
3264  NULL, NULL, NULL
3265  },
3266  {
3267  {"autovacuum_vacuum_threshold", PGC_SIGHUP, AUTOVACUUM,
3268  gettext_noop("Minimum number of tuple updates or deletes prior to vacuum."),
3269  NULL
3270  },
3272  50, 0, INT_MAX,
3273  NULL, NULL, NULL
3274  },
3275  {
3276  {"autovacuum_vacuum_insert_threshold", PGC_SIGHUP, AUTOVACUUM,
3277  gettext_noop("Minimum number of tuple inserts prior to vacuum, or -1 to disable insert vacuums."),
3278  NULL
3279  },
3281  1000, -1, INT_MAX,
3282  NULL, NULL, NULL
3283  },
3284  {
3285  {"autovacuum_analyze_threshold", PGC_SIGHUP, AUTOVACUUM,
3286  gettext_noop("Minimum number of tuple inserts, updates, or deletes prior to analyze."),
3287  NULL
3288  },
3290  50, 0, INT_MAX,
3291  NULL, NULL, NULL
3292  },
3293  {
3294  /* see varsup.c for why this is PGC_POSTMASTER not PGC_SIGHUP */
3295  {"autovacuum_freeze_max_age", PGC_POSTMASTER, AUTOVACUUM,
3296  gettext_noop("Age at which to autovacuum a table to prevent transaction ID wraparound."),
3297  NULL
3298  },
3300 
3301  /*
3302  * see pg_resetwal and vacuum_failsafe_age if you change the
3303  * upper-limit value.
3304  */
3305  200000000, 100000, 2000000000,
3306  NULL, NULL, NULL
3307  },
3308  {
3309  /* see multixact.c for why this is PGC_POSTMASTER not PGC_SIGHUP */
3310  {"autovacuum_multixact_freeze_max_age", PGC_POSTMASTER, AUTOVACUUM,
3311  gettext_noop("Multixact age at which to autovacuum a table to prevent multixact wraparound."),
3312  NULL
3313  },
3315  400000000, 10000, 2000000000,
3316  NULL, NULL, NULL
3317  },
3318  {
3319  /* see max_connections */
3320  {"autovacuum_max_workers", PGC_POSTMASTER, AUTOVACUUM,
3321  gettext_noop("Sets the maximum number of simultaneously running autovacuum worker processes."),
3322  NULL
3323  },
3325  3, 1, MAX_BACKENDS,
3326  check_autovacuum_max_workers, NULL, NULL
3327  },
3328 
3329  {
3330  {"max_parallel_maintenance_workers", PGC_USERSET, RESOURCES_ASYNCHRONOUS,
3331  gettext_noop("Sets the maximum number of parallel processes per maintenance operation."),
3332  NULL
3333  },
3335  2, 0, 1024,
3336  NULL, NULL, NULL
3337  },
3338 
3339  {
3340  {"max_parallel_workers_per_gather", PGC_USERSET, RESOURCES_ASYNCHRONOUS,
3341  gettext_noop("Sets the maximum number of parallel processes per executor node."),
3342  NULL,
3343  GUC_EXPLAIN
3344  },
3347  NULL, NULL, NULL
3348  },
3349 
3350  {
3351  {"max_parallel_workers", PGC_USERSET, RESOURCES_ASYNCHRONOUS,
3352  gettext_noop("Sets the maximum number of parallel workers that can be active at one time."),
3353  NULL,
3354  GUC_EXPLAIN
3355  },
3358  NULL, NULL, NULL
3359  },
3360 
3361  {
3362  {"autovacuum_work_mem", PGC_SIGHUP, RESOURCES_MEM,
3363  gettext_noop("Sets the maximum memory to be used by each autovacuum worker process."),
3364  NULL,
3365  GUC_UNIT_KB
3366  },
3368  -1, -1, MAX_KILOBYTES,
3369  check_autovacuum_work_mem, NULL, NULL
3370  },
3371 
3372  {
3373  {"old_snapshot_threshold", PGC_POSTMASTER, RESOURCES_ASYNCHRONOUS,
3374  gettext_noop("Time before a snapshot is too old to read pages changed after the snapshot was taken."),
3375  gettext_noop("A value of -1 disables this feature."),
3376  GUC_UNIT_MIN
3377  },
3379  -1, -1, MINS_PER_HOUR * HOURS_PER_DAY * 60,
3380  NULL, NULL, NULL
3381  },
3382 
3383  {
3384  {"tcp_keepalives_idle", PGC_USERSET, CONN_AUTH_SETTINGS,
3385  gettext_noop("Time between issuing TCP keepalives."),
3386  gettext_noop("A value of 0 uses the system default."),
3387  GUC_UNIT_S
3388  },
3390  0, 0, INT_MAX,
3392  },
3393 
3394  {
3395  {"tcp_keepalives_interval", PGC_USERSET, CONN_AUTH_SETTINGS,
3396  gettext_noop("Time between TCP keepalive retransmits."),
3397  gettext_noop("A value of 0 uses the system default."),
3398  GUC_UNIT_S
3399  },
3401  0, 0, INT_MAX,
3403  },
3404 
3405  {
3406  {"ssl_renegotiation_limit", PGC_USERSET, CONN_AUTH_SSL,
3407  gettext_noop("SSL renegotiation is no longer supported; this can only be 0."),
3408  NULL,
3410  },
3412  0, 0, 0,
3413  NULL, NULL, NULL
3414  },
3415 
3416  {
3417  {"tcp_keepalives_count", PGC_USERSET, CONN_AUTH_SETTINGS,
3418  gettext_noop("Maximum number of TCP keepalive retransmits."),
3419  gettext_noop("This controls the number of consecutive keepalive retransmits that can be "
3420  "lost before a connection is considered dead. A value of 0 uses the "
3421  "system default."),
3422  },
3424  0, 0, INT_MAX,
3426  },
3427 
3428  {
3429  {"gin_fuzzy_search_limit", PGC_USERSET, CLIENT_CONN_OTHER,
3430  gettext_noop("Sets the maximum allowed result for exact search by GIN."),
3431  NULL,
3432  0
3433  },
3435  0, 0, INT_MAX,
3436  NULL, NULL, NULL
3437  },
3438 
3439  {
3440  {"effective_cache_size", PGC_USERSET, QUERY_TUNING_COST,
3441  gettext_noop("Sets the planner's assumption about the total size of the data caches."),
3442  gettext_noop("That is, the total size of the caches (kernel cache and shared buffers) used for PostgreSQL data files. "
3443  "This is measured in disk pages, which are normally 8 kB each."),
3445  },
3447  DEFAULT_EFFECTIVE_CACHE_SIZE, 1, INT_MAX,
3448  NULL, NULL, NULL
3449  },
3450 
3451  {
3452  {"min_parallel_table_scan_size", PGC_USERSET, QUERY_TUNING_COST,
3453  gettext_noop("Sets the minimum amount of table data for a parallel scan."),
3454  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."),
3456  },
3458  (8 * 1024 * 1024) / BLCKSZ, 0, INT_MAX / 3,
3459  NULL, NULL, NULL
3460  },
3461 
3462  {
3463  {"min_parallel_index_scan_size", PGC_USERSET, QUERY_TUNING_COST,
3464  gettext_noop("Sets the minimum amount of index data for a parallel scan."),
3465  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."),
3467  },
3469  (512 * 1024) / BLCKSZ, 0, INT_MAX / 3,
3470  NULL, NULL, NULL
3471  },
3472 
3473  {
3474  /* Can't be set in postgresql.conf */
3475  {"server_version_num", PGC_INTERNAL, PRESET_OPTIONS,
3476  gettext_noop("Shows the server version as an integer."),
3477  NULL,
3479  },
3481  PG_VERSION_NUM, PG_VERSION_NUM, PG_VERSION_NUM,
3482  NULL, NULL, NULL
3483  },
3484 
3485  {
3486  {"log_temp_files", PGC_SUSET, LOGGING_WHAT,
3487  gettext_noop("Log the use of temporary files larger than this number of kilobytes."),
3488  gettext_noop("Zero logs all files. The default is -1 (turning this feature off)."),
3489  GUC_UNIT_KB
3490  },
3491  &log_temp_files,
3492  -1, -1, INT_MAX,
3493  NULL, NULL, NULL
3494  },
3495 
3496  {
3497  {"track_activity_query_size", PGC_POSTMASTER, STATS_COLLECTOR,
3498  gettext_noop("Sets the size reserved for pg_stat_activity.query, in bytes."),
3499  NULL,
3501  },
3503  1024, 100, 1048576,
3504  NULL, NULL, NULL
3505  },
3506 
3507  {
3508  {"gin_pending_list_limit", PGC_USERSET, CLIENT_CONN_STATEMENT,
3509  gettext_noop("Sets the maximum size of the pending list for GIN index."),
3510  NULL,
3511  GUC_UNIT_KB
3512  },
3514  4096, 64, MAX_KILOBYTES,
3515  NULL, NULL, NULL
3516  },
3517 
3518  {
3519  {"tcp_user_timeout", PGC_USERSET, CONN_AUTH_SETTINGS,
3520  gettext_noop("TCP user timeout."),
3521  gettext_noop("A value of 0 uses the system default."),
3522  GUC_UNIT_MS
3523  },
3525  0, 0, INT_MAX,
3527  },
3528 
3529  {
3530  {"huge_page_size", PGC_POSTMASTER, RESOURCES_MEM,
3531  gettext_noop("The size of huge page that should be requested."),
3532  NULL,
3533  GUC_UNIT_KB
3534  },
3535  &huge_page_size,
3536  0, 0, INT_MAX,
3537  check_huge_page_size, NULL, NULL
3538  },
3539 
3540  {
3541  {"debug_discard_caches", PGC_SUSET, DEVELOPER_OPTIONS,
3542  gettext_noop("Aggressively flush system caches for debugging purposes."),
3543  NULL,
3545  },
3547 #ifdef DISCARD_CACHES_ENABLED
3548  /* Set default based on older compile-time-only cache clobber macros */
3549 #if defined(CLOBBER_CACHE_RECURSIVELY)
3550  3,
3551 #elif defined(CLOBBER_CACHE_ALWAYS)
3552  1,
3553 #else
3554  0,
3555 #endif
3556  0, 5,
3557 #else /* not DISCARD_CACHES_ENABLED */
3558  0, 0, 0,
3559 #endif /* not DISCARD_CACHES_ENABLED */
3560  NULL, NULL, NULL
3561  },
3562 
3563  {
3564  {"client_connection_check_interval", PGC_USERSET, CONN_AUTH_SETTINGS,
3565  gettext_noop("Sets the time interval between checks for disconnection while running queries."),
3566  NULL,
3567  GUC_UNIT_MS
3568  },
3570  0, 0, INT_MAX,
3572  },
3573 
3574  {
3575  {"log_startup_progress_interval", PGC_SIGHUP, LOGGING_WHEN,
3576  gettext_noop("Time between progress updates for "
3577  "long-running startup operations."),
3578  gettext_noop("0 turns this feature off."),
3579  GUC_UNIT_MS,
3580  },
3582  10000, 0, INT_MAX,
3583  NULL, NULL, NULL
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 from which to log all statements."),
3847  gettext_noop("Use a value between 0.0 (never log) and 1.0 (log all "
3848  "statements for all transactions).")
3849  },
3851  0.0, 0.0, 1.0,
3852  NULL, NULL, NULL
3853  },
3854 
3855  /* End-of-list marker */
3856  {
3857  {NULL, 0, 0, NULL, NULL}, NULL, 0.0, 0.0, 0.0, NULL, NULL, NULL
3858  }
3859 };
3860 
3861 
3863 {
3864  {
3865  {"archive_command", PGC_SIGHUP, WAL_ARCHIVING,
3866  gettext_noop("Sets the shell command that will be called to archive a WAL file."),
3867  NULL
3868  },
3870  "",
3871  NULL, NULL, show_archive_command
3872  },
3873 
3874  {
3875  {"restore_command", PGC_SIGHUP, WAL_ARCHIVE_RECOVERY,
3876  gettext_noop("Sets the shell command that will be called to retrieve an archived WAL file."),
3877  NULL
3878  },
3880  "",
3881  NULL, NULL, NULL
3882  },
3883 
3884  {
3885  {"archive_cleanup_command", PGC_SIGHUP, WAL_ARCHIVE_RECOVERY,
3886  gettext_noop("Sets the shell command that will be executed at every restart point."),
3887  NULL
3888  },
3890  "",
3891  NULL, NULL, NULL
3892  },
3893 
3894  {
3895  {"recovery_end_command", PGC_SIGHUP, WAL_ARCHIVE_RECOVERY,
3896  gettext_noop("Sets the shell command that will be executed once at the end of recovery."),
3897  NULL
3898  },
3900  "",
3901  NULL, NULL, NULL
3902  },
3903 
3904  {
3905  {"recovery_target_timeline", PGC_POSTMASTER, WAL_RECOVERY_TARGET,
3906  gettext_noop("Specifies the timeline to recover into."),
3907  NULL
3908  },
3910  "latest",
3912  },
3913 
3914  {
3915  {"recovery_target", PGC_POSTMASTER, WAL_RECOVERY_TARGET,
3916  gettext_noop("Set to \"immediate\" to end recovery as soon as a consistent state is reached."),
3917  NULL
3918  },
3920  "",
3922  },
3923  {
3924  {"recovery_target_xid", PGC_POSTMASTER, WAL_RECOVERY_TARGET,
3925  gettext_noop("Sets the transaction ID up to which recovery will proceed."),
3926  NULL
3927  },
3929  "",
3931  },
3932  {
3933  {"recovery_target_time", PGC_POSTMASTER, WAL_RECOVERY_TARGET,
3934  gettext_noop("Sets the time stamp up to which recovery will proceed."),
3935  NULL
3936  },
3938  "",
3940  },
3941  {
3942  {"recovery_target_name", PGC_POSTMASTER, WAL_RECOVERY_TARGET,
3943  gettext_noop("Sets the named restore point up to which recovery will proceed."),
3944  NULL
3945  },
3947  "",
3949  },
3950  {
3951  {"recovery_target_lsn", PGC_POSTMASTER, WAL_RECOVERY_TARGET,
3952  gettext_noop("Sets the LSN of the write-ahead log location up to which recovery will proceed."),
3953  NULL
3954  },
3956  "",
3958  },
3959 
3960  {
3961  {"promote_trigger_file", PGC_SIGHUP, REPLICATION_STANDBY,
3962  gettext_noop("Specifies a file name whose presence ends recovery in the standby."),
3963  NULL
3964  },
3966  "",
3967  NULL, NULL, NULL
3968  },
3969 
3970  {
3971  {"primary_conninfo", PGC_SIGHUP, REPLICATION_STANDBY,
3972  gettext_noop("Sets the connection string to be used to connect to the sending server."),
3973  NULL,
3975  },
3976  &PrimaryConnInfo,
3977  "",
3978  NULL, NULL, NULL
3979  },
3980 
3981  {
3982  {"primary_slot_name", PGC_SIGHUP, REPLICATION_STANDBY,
3983  gettext_noop("Sets the name of the replication slot to use on the sending server."),
3984  NULL
3985  },
3986  &PrimarySlotName,
3987  "",
3988  check_primary_slot_name, NULL, NULL
3989  },
3990 
3991  {
3992  {"client_encoding", PGC_USERSET, CLIENT_CONN_LOCALE,
3993  gettext_noop("Sets the client's character set encoding."),
3994  NULL,
3996  },
3998  "SQL_ASCII",
4000  },
4001 
4002  {
4003  {"log_line_prefix", PGC_SIGHUP, LOGGING_WHAT,
4004  gettext_noop("Controls information prefixed to each log line."),
4005  gettext_noop("If blank, no prefix is used.")
4006  },
4007  &Log_line_prefix,
4008  "%m [%p] ",
4009  NULL, NULL, NULL
4010  },
4011 
4012  {
4013  {"log_timezone", PGC_SIGHUP, LOGGING_WHAT,
4014  gettext_noop("Sets the time zone to use in log messages."),
4015  NULL
4016  },
4018  "GMT",
4020  },
4021 
4022  {
4023  {"DateStyle", PGC_USERSET, CLIENT_CONN_LOCALE,
4024  gettext_noop("Sets the display format for date and time values."),
4025  gettext_noop("Also controls interpretation of ambiguous "
4026  "date inputs."),
4028  },
4030  "ISO, MDY",
4032  },
4033 
4034  {
4035  {"default_table_access_method", PGC_USERSET, CLIENT_CONN_STATEMENT,
4036  gettext_noop("Sets the default table access method for new tables."),
4037  NULL,
4038  GUC_IS_NAME
4039  },
4043  },
4044 
4045  {
4046  {"default_tablespace", PGC_USERSET, CLIENT_CONN_STATEMENT,
4047  gettext_noop("Sets the default tablespace to create tables and indexes in."),
4048  gettext_noop("An empty string selects the database's default tablespace."),
4049  GUC_IS_NAME
4050  },
4052  "",
4053  check_default_tablespace, NULL, NULL
4054  },
4055 
4056  {
4057  {"temp_tablespaces", PGC_USERSET, CLIENT_CONN_STATEMENT,
4058  gettext_noop("Sets the tablespace(s) to use for temporary tables and sort files."),
4059  NULL,
4061  },
4063  "",
4065  },
4066 
4067  {
4068  {"dynamic_library_path", PGC_SUSET, CLIENT_CONN_OTHER,
4069  gettext_noop("Sets the path for dynamically loadable modules."),
4070  gettext_noop("If a dynamically loadable module needs to be opened and "
4071  "the specified name does not have a directory component (i.e., the "
4072  "name does not contain a slash), the system will search this path for "
4073  "the specified file."),
4075  },
4077  "$libdir",
4078  NULL, NULL, NULL
4079  },
4080 
4081  {
4082  {"krb_server_keyfile", PGC_SIGHUP, CONN_AUTH_AUTH,
4083  gettext_noop("Sets the location of the Kerberos server key file."),
4084  NULL,
4086  },
4088  PG_KRB_SRVTAB,
4089  NULL, NULL, NULL
4090  },
4091 
4092  {
4093  {"bonjour_name", PGC_POSTMASTER, CONN_AUTH_SETTINGS,
4094  gettext_noop("Sets the Bonjour service name."),
4095  NULL
4096  },
4097  &bonjour_name,
4098  "",
4099  NULL, NULL, NULL
4100  },
4101 
4102  /* See main.c about why defaults for LC_foo are not all alike */
4103 
4104  {
4105  {"lc_collate", PGC_INTERNAL, PRESET_OPTIONS,
4106  gettext_noop("Shows the collation order locale."),
4107  NULL,
4109  },
4110  &locale_collate,
4111  "C",
4112  NULL, NULL, NULL
4113  },
4114 
4115  {
4116  {"lc_ctype", PGC_INTERNAL, PRESET_OPTIONS,
4117  gettext_noop("Shows the character classification and case conversion locale."),
4118  NULL,
4120  },
4121  &locale_ctype,
4122  "C",
4123  NULL, NULL, NULL
4124  },
4125 
4126  {
4127  {"lc_messages", PGC_SUSET, CLIENT_CONN_LOCALE,
4128  gettext_noop("Sets the language in which messages are displayed."),
4129  NULL
4130  },
4131  &locale_messages,
4132  "",
4134  },
4135 
4136  {
4137  {"lc_monetary", PGC_USERSET, CLIENT_CONN_LOCALE,
4138  gettext_noop("Sets the locale for formatting monetary amounts."),
4139  NULL
4140  },
4141  &locale_monetary,
4142  "C",
4144  },
4145 
4146  {
4147  {"lc_numeric", PGC_USERSET, CLIENT_CONN_LOCALE,
4148  gettext_noop("Sets the locale for formatting numbers."),
4149  NULL
4150  },
4151  &locale_numeric,
4152  "C",
4154  },
4155 
4156  {
4157  {"lc_time", PGC_USERSET, CLIENT_CONN_LOCALE,
4158  gettext_noop("Sets the locale for formatting date and time values."),
4159  NULL
4160  },
4161  &locale_time,
4162  "C",
4164  },
4165 
4166  {
4167  {"session_preload_libraries", PGC_SUSET, CLIENT_CONN_PRELOAD,
4168  gettext_noop("Lists shared libraries to preload into each backend."),
4169  NULL,
4171  },
4173  "",
4174  NULL, NULL, NULL
4175  },
4176 
4177  {
4178  {"shared_preload_libraries", PGC_POSTMASTER, CLIENT_CONN_PRELOAD,
4179  gettext_noop("Lists shared libraries to preload into server."),
4180  NULL,
4182  },
4184  "",
4185  NULL, NULL, NULL
4186  },
4187 
4188  {
4189  {"local_preload_libraries", PGC_USERSET, CLIENT_CONN_PRELOAD,
4190  gettext_noop("Lists unprivileged shared libraries to preload into each backend."),
4191  NULL,
4193  },
4195  "",
4196  NULL, NULL, NULL
4197  },
4198 
4199  {
4200  {"search_path", PGC_USERSET, CLIENT_CONN_STATEMENT,
4201  gettext_noop("Sets the schema search order for names that are not schema-qualified."),
4202  NULL,
4204  },
4206  "\"$user\", public",
4208  },
4209 
4210  {
4211  /* Can't be set in postgresql.conf */
4212  {"server_encoding", PGC_INTERNAL, PRESET_OPTIONS,
4213  gettext_noop("Shows the server (database) character set encoding."),
4214  NULL,
4216  },
4218  "SQL_ASCII",
4219  NULL, NULL, NULL
4220  },
4221 
4222  {
4223  /* Can't be set in postgresql.conf */
4224  {"server_version", PGC_INTERNAL, PRESET_OPTIONS,
4225  gettext_noop("Shows the server version."),
4226  NULL,
4228  },
4230  PG_VERSION,
4231  NULL, NULL, NULL
4232  },
4233 
4234  {
4235  /* Not for general use --- used by SET ROLE */
4236  {"role", PGC_USERSET, UNGROUPED,
4237  gettext_noop("Sets the current role."),
4238  NULL,
4240  },
4241  &role_string,
4242  "none",
4244  },
4245 
4246  {
4247  /* Not for general use --- used by SET SESSION AUTHORIZATION */
4248  {"session_authorization", PGC_USERSET, UNGROUPED,
4249  gettext_noop("Sets the session user name."),
4250  NULL,
4252  },
4254  NULL,
4256  },
4257 
4258  {
4259  {"log_destination", PGC_SIGHUP, LOGGING_WHERE,
4260  gettext_noop("Sets the destination for server log output."),
4261  gettext_noop("Valid values are combinations of \"stderr\", "
4262  "\"syslog\", \"csvlog\", and \"eventlog\", "
4263  "depending on the platform."),
4265  },
4267  "stderr",
4269  },
4270  {
4271  {"log_directory", PGC_SIGHUP, LOGGING_WHERE,
4272  gettext_noop("Sets the destination directory for log files."),
4273  gettext_noop("Can be specified as relative to the data directory "
4274  "or as absolute path."),
4276  },
4277  &Log_directory,
4278  "log",
4279  check_canonical_path, NULL, NULL
4280  },
4281  {
4282  {"log_filename", PGC_SIGHUP, LOGGING_WHERE,
4283  gettext_noop("Sets the file name pattern for log files."),
4284  NULL,
4286  },
4287  &Log_filename,
4288  "postgresql-%Y-%m-%d_%H%M%S.log",
4289  NULL, NULL, NULL
4290  },
4291 
4292  {
4293  {"syslog_ident", PGC_SIGHUP, LOGGING_WHERE,
4294  gettext_noop("Sets the program name used to identify PostgreSQL "
4295  "messages in syslog."),
4296  NULL
4297  },
4299  "postgres",
4300  NULL, assign_syslog_ident, NULL
4301  },
4302 
4303  {
4304  {"event_source", PGC_POSTMASTER, LOGGING_WHERE,
4305  gettext_noop("Sets the application name used to identify "
4306  "PostgreSQL messages in the event log."),
4307  NULL
4308  },
4309  &event_source,
4311  NULL, NULL, NULL
4312  },
4313 
4314  {
4315  {"TimeZone", PGC_USERSET, CLIENT_CONN_LOCALE,
4316  gettext_noop("Sets the time zone for displaying and interpreting time stamps."),
4317  NULL,
4318  GUC_REPORT
4319  },
4320  &timezone_string,
4321  "GMT",
4323  },
4324  {
4325  {"timezone_abbreviations", PGC_USERSET, CLIENT_CONN_LOCALE,
4326  gettext_noop("Selects a file of time zone abbreviations."),
4327  NULL
4328  },
4330  NULL,
4332  },
4333 
4334  {
4335  {"unix_socket_group", PGC_POSTMASTER, CONN_AUTH_SETTINGS,
4336  gettext_noop("Sets the owning group of the Unix-domain socket."),
4337  gettext_noop("The owning user of the socket is always the user "
4338  "that starts the server.")
4339  },
4341  "",
4342  NULL, NULL, NULL
4343  },
4344 
4345  {
4346  {"unix_socket_directories", PGC_POSTMASTER, CONN_AUTH_SETTINGS,
4347  gettext_noop("Sets the directories where Unix-domain sockets will be created."),
4348  NULL,
4350  },
4352 #ifdef HAVE_UNIX_SOCKETS
4354 #else
4355  "",
4356 #endif
4357  NULL, NULL, NULL
4358  },
4359 
4360  {
4361  {"listen_addresses", PGC_POSTMASTER, CONN_AUTH_SETTINGS,
4362  gettext_noop("Sets the host name or IP address(es) to listen to."),
4363  NULL,
4365  },
4366  &ListenAddresses,
4367  "localhost",
4368  NULL, NULL, NULL
4369  },
4370 
4371  {
4372  /*
4373  * Can't be set by ALTER SYSTEM as it can lead to recursive definition
4374  * of data_directory.
4375  */
4376  {"data_directory", PGC_POSTMASTER, FILE_LOCATIONS,
4377  gettext_noop("Sets the server's data directory."),
4378  NULL,
4380  },
4381  &data_directory,
4382  NULL,
4383  NULL, NULL, NULL
4384  },
4385 
4386  {
4387  {"config_file", PGC_POSTMASTER, FILE_LOCATIONS,
4388  gettext_noop("Sets the server's main configuration file."),
4389  NULL,
4391  },
4392  &ConfigFileName,
4393  NULL,
4394  NULL, NULL, NULL
4395  },
4396 
4397  {
4398  {"hba_file", PGC_POSTMASTER, FILE_LOCATIONS,
4399  gettext_noop("Sets the server's \"hba\" configuration file."),
4400  NULL,
4402  },
4403  &HbaFileName,
4404  NULL,
4405  NULL, NULL, NULL
4406  },
4407 
4408  {
4409  {"ident_file", PGC_POSTMASTER, FILE_LOCATIONS,
4410  gettext_noop("Sets the server's \"ident\" configuration file."),
4411  NULL,
4413  },
4414  &IdentFileName,
4415  NULL,
4416  NULL, NULL, NULL
4417  },
4418 
4419  {
4420  {"external_pid_file", PGC_POSTMASTER, FILE_LOCATIONS,
4421  gettext_noop("Writes the postmaster PID to the specified file."),
4422  NULL,
4424  },
4426  NULL,
4427  check_canonical_path, NULL, NULL
4428  },
4429 
4430  {
4431  {"ssl_library", PGC_INTERNAL, PRESET_OPTIONS,
4432  gettext_noop("Shows the name of the SSL library."),
4433  NULL,
4435  },
4436  &ssl_library,
4437 #ifdef USE_SSL
4438  "OpenSSL",
4439 #else
4440  "",
4441 #endif
4442  NULL, NULL, NULL
4443  },
4444 
4445  {
4446  {"ssl_cert_file", PGC_SIGHUP, CONN_AUTH_SSL,
4447  gettext_noop("Location of the SSL server certificate file."),
4448  NULL
4449  },
4450  &ssl_cert_file,
4451  "server.crt",
4452  NULL, NULL, NULL
4453  },
4454 
4455  {
4456  {"ssl_key_file", PGC_SIGHUP, CONN_AUTH_SSL,
4457  gettext_noop("Location of the SSL server private key file."),
4458  NULL
4459  },
4460  &ssl_key_file,
4461  "server.key",
4462  NULL, NULL, NULL
4463  },
4464 
4465  {
4466  {"ssl_ca_file", PGC_SIGHUP, CONN_AUTH_SSL,
4467  gettext_noop("Location of the SSL certificate authority file."),
4468  NULL
4469  },
4470  &ssl_ca_file,
4471  "",
4472  NULL, NULL, NULL
4473  },
4474 
4475  {
4476  {"ssl_crl_file", PGC_SIGHUP, CONN_AUTH_SSL,
4477  gettext_noop("Location of the SSL certificate revocation list file."),
4478  NULL
4479  },
4480  &ssl_crl_file,
4481  "",
4482  NULL, NULL, NULL
4483  },
4484 
4485  {
4486  {"ssl_crl_dir", PGC_SIGHUP, CONN_AUTH_SSL,
4487  gettext_noop("Location of the SSL certificate revocation list directory."),
4488  NULL
4489  },
4490  &ssl_crl_dir,
4491  "",
4492  NULL, NULL, NULL
4493  },
4494 
4495  {
4496  {"stats_temp_directory", PGC_SIGHUP, STATS_COLLECTOR,
4497  gettext_noop("Writes temporary statistics files to the specified directory."),
4498  NULL,
4500  },
4504  },
4505 
4506  {
4507  {"synchronous_standby_names", PGC_SIGHUP, REPLICATION_PRIMARY,
4508  gettext_noop("Number of synchronous standbys and list of names of potential synchronous ones."),
4509  NULL,
4511  },
4513  "",
4515  },
4516 
4517  {
4518  {"default_text_search_config", PGC_USERSET, CLIENT_CONN_LOCALE,
4519  gettext_noop("Sets default text search configuration."),
4520  NULL
4521  },
4522  &TSCurrentConfig,
4523  "pg_catalog.simple",
4525  },
4526 
4527  {
4528  {"ssl_ciphers", PGC_SIGHUP, CONN_AUTH_SSL,
4529  gettext_noop("Sets the list of allowed SSL ciphers."),
4530  NULL,
4532  },
4533  &SSLCipherSuites,
4534 #ifdef USE_OPENSSL
4535  "HIGH:MEDIUM:+3DES:!aNULL",
4536 #else
4537  "none",
4538 #endif
4539  NULL, NULL, NULL
4540  },
4541 
4542  {
4543  {"ssl_ecdh_curve", PGC_SIGHUP, CONN_AUTH_SSL,
4544  gettext_noop("Sets the curve to use for ECDH."),
4545  NULL,
4547  },
4548  &SSLECDHCurve,
4549 #ifdef USE_SSL
4550  "prime256v1",
4551 #else
4552  "none",
4553 #endif
4554  NULL, NULL, NULL
4555  },
4556 
4557  {
4558  {"ssl_dh_params_file", PGC_SIGHUP, CONN_AUTH_SSL,
4559  gettext_noop("Location of the SSL DH parameters file."),
4560  NULL,
4562  },
4564  "",
4565  NULL, NULL, NULL
4566  },
4567 
4568  {
4569  {"ssl_passphrase_command", PGC_SIGHUP, CONN_AUTH_SSL,
4570  gettext_noop("Command to obtain passphrases for SSL."),
4571  NULL,
4573  },
4575  "",
4576  NULL, NULL, NULL
4577  },
4578 
4579  {
4580  {"application_name", PGC_USERSET, LOGGING_WHAT,
4581  gettext_noop("Sets the application name to be reported in statistics and logs."),
4582  NULL,
4584  },
4586  "",
4588  },
4589 
4590  {
4591  {"cluster_name", PGC_POSTMASTER, PROCESS_TITLE,
4592  gettext_noop("Sets the name of the cluster, which is included in the process title."),
4593  NULL,
4594  GUC_IS_NAME
4595  },
4596  &cluster_name,
4597  "",
4598  check_cluster_name, NULL, NULL
4599  },
4600 
4601  {
4602  {"wal_consistency_checking", PGC_SUSET, DEVELOPER_OPTIONS,
4603  gettext_noop("Sets the WAL resource managers for which WAL consistency checks are done."),
4604  gettext_noop("Full-page images will be logged for all data blocks and cross-checked against the results of WAL replay."),
4606  },
4608  "",
4610  },
4611 
4612  {
4613  {"jit_provider", PGC_POSTMASTER, CLIENT_CONN_PRELOAD,
4614  gettext_noop("JIT provider to use."),
4615  NULL,
4617  },
4618  &jit_provider,
4619  "llvmjit",
4620  NULL, NULL, NULL
4621  },
4622 
4623  {
4624  {"backtrace_functions", PGC_SUSET, DEVELOPER_OPTIONS,
4625  gettext_noop("Log backtrace for errors in these functions."),
4626  NULL,
4628  },
4630  "",
4632  },
4633 
4634  /* End-of-list marker */
4635  {
4636  {NULL, 0, 0, NULL, NULL}, NULL, NULL, NULL, NULL, NULL
4637  }
4638 };
4639 
4640 
4642 {
4643  {
4644  {"backslash_quote", PGC_USERSET, COMPAT_OPTIONS_PREVIOUS,
4645  gettext_noop("Sets whether \"\\'\" is allowed in string literals."),
4646  NULL
4647  },
4648  &backslash_quote,
4650  NULL, NULL, NULL
4651  },
4652 
4653  {
4654  {"bytea_output", PGC_USERSET, CLIENT_CONN_STATEMENT,
4655  gettext_noop("Sets the output format for bytea."),
4656  NULL
4657  },
4658  &bytea_output,
4660  NULL, NULL, NULL
4661  },
4662 
4663  {
4664  {"client_min_messages", PGC_USERSET, CLIENT_CONN_STATEMENT,
4665  gettext_noop("Sets the message levels that are sent to the client."),
4666  gettext_noop("Each level includes all the levels that follow it. The later"
4667  " the level, the fewer messages are sent.")
4668  },
4671  NULL, NULL, NULL
4672  },
4673 
4674  {
4675  {"compute_query_id", PGC_SUSET, STATS_MONITORING,
4676  gettext_noop("Compute query identifiers."),
4677  NULL
4678  },
4681  NULL, NULL, NULL
4682  },
4683 
4684  {
4685  {"constraint_exclusion", PGC_USERSET, QUERY_TUNING_OTHER,
4686  gettext_noop("Enables the planner to use constraints to optimize queries."),
4687  gettext_noop("Table scans will be skipped if their constraints"
4688  " guarantee that no rows match the query."),
4689  GUC_EXPLAIN
4690  },
4693  NULL, NULL, NULL
4694  },
4695 
4696  {
4697  {"default_toast_compression", PGC_USERSET, CLIENT_CONN_STATEMENT,
4698  gettext_noop("Sets the default compression method for compressible values."),
4699  NULL
4700  },
4704  NULL, NULL, NULL
4705  },
4706 
4707  {
4708  {"default_transaction_isolation", PGC_USERSET, CLIENT_CONN_STATEMENT,
4709  gettext_noop("Sets the transaction isolation level of each new transaction."),
4710  NULL
4711  },
4714  NULL, NULL, NULL
4715  },
4716 
4717  {
4718  {"transaction_isolation", PGC_USERSET, CLIENT_CONN_STATEMENT,
4719  gettext_noop("Sets the current transaction's isolation level."),
4720  NULL,
4722  },
4723  &XactIsoLevel,
4725  check_XactIsoLevel, NULL, NULL
4726  },
4727 
4728  {
4729  {"IntervalStyle", PGC_USERSET, CLIENT_CONN_LOCALE,
4730  gettext_noop("Sets the display format for interval values."),
4731  NULL,
4732  GUC_REPORT
4733  },
4734  &IntervalStyle,
4736  NULL, NULL, NULL
4737  },
4738 
4739  {
4740  {"log_error_verbosity", PGC_SUSET, LOGGING_WHAT,
4741  gettext_noop("Sets the verbosity of logged messages."),
4742  NULL
4743  },
4746  NULL, NULL, NULL
4747  },
4748 
4749  {
4750  {"log_min_messages", PGC_SUSET, LOGGING_WHEN,
4751  gettext_noop("Sets the message levels that are logged."),
4752  gettext_noop("Each level includes all the levels that follow it. The later"
4753  " the level, the fewer messages are sent.")
4754  },
4757  NULL, NULL, NULL
4758  },
4759 
4760  {
4761  {"log_min_error_statement", PGC_SUSET, LOGGING_WHEN,
4762  gettext_noop("Causes all statements generating error at or above this level to be logged."),
4763  gettext_noop("Each level includes all the levels that follow it. The later"
4764  " the level, the fewer messages are sent.")
4765  },
4768  NULL, NULL, NULL
4769  },
4770 
4771  {
4772  {"log_statement", PGC_SUSET, LOGGING_WHAT,
4773  gettext_noop("Sets the type of statements logged."),
4774  NULL
4775  },
4776  &log_statement,
4778  NULL, NULL, NULL
4779  },
4780 
4781  {
4782  {"syslog_facility", PGC_SIGHUP, LOGGING_WHERE,
4783  gettext_noop("Sets the syslog \"facility\" to be used when syslog enabled."),
4784  NULL
4785  },
4786  &syslog_facility,
4787 #ifdef HAVE_SYSLOG
4788  LOG_LOCAL0,
4789 #else
4790  0,
4791 #endif
4793  NULL, assign_syslog_facility, NULL
4794  },
4795 
4796  {
4797  {"session_replication_role", PGC_SUSET, CLIENT_CONN_STATEMENT,
4798  gettext_noop("Sets the session's behavior for triggers and rewrite rules."),
4799  NULL
4800  },
4804  },
4805 
4806  {
4807  {"synchronous_commit", PGC_USERSET, WAL_SETTINGS,
4808  gettext_noop("Sets the current transaction's synchronization level."),
4809  NULL
4810  },
4813  NULL, assign_synchronous_commit, NULL
4814  },
4815 
4816  {
4817  {"archive_mode", PGC_POSTMASTER, WAL_ARCHIVING,
4818  gettext_noop("Allows archiving of WAL files using archive_command."),
4819  NULL
4820  },
4821  &XLogArchiveMode,
4823  NULL, NULL, NULL
4824  },
4825 
4826  {
4827  {"recovery_target_action", PGC_POSTMASTER, WAL_RECOVERY_TARGET,
4828  gettext_noop("Sets the action to perform upon reaching the recovery target."),
4829  NULL
4830  },
4833  NULL, NULL, NULL
4834  },
4835 
4836  {
4837  {"trace_recovery_messages", PGC_SIGHUP, DEVELOPER_OPTIONS,
4838  gettext_noop("Enables logging of recovery-related debugging information."),
4839  gettext_noop("Each level includes all the levels that follow it. The later"
4840  " the level, the fewer messages are sent.")
4841  },
4843 
4844  /*
4845  * client_message_level_options allows too many values, really, but
4846  * it's not worth having a separate options array for this.
4847  */
4849  NULL, NULL, NULL
4850  },
4851 
4852  {
4853  {"track_functions", PGC_SUSET, STATS_COLLECTOR,
4854  gettext_noop("Collects function-level statistics on database activity."),
4855  NULL
4856  },
4859  NULL, NULL, NULL
4860  },
4861 
4862  {
4863  {"wal_compression", PGC_SUSET, WAL_SETTINGS,
4864  gettext_noop("Compresses full-page writes written in WAL file with specified method."),
4865  NULL
4866  },
4867  &wal_compression,
4869  NULL, NULL, NULL
4870  },
4871 
4872  {
4873  {"wal_level", PGC_POSTMASTER, WAL_SETTINGS,
4874  gettext_noop("Sets the level of information written to the WAL."),
4875  NULL
4876  },
4877  &wal_level,
4879  NULL, NULL, NULL
4880  },
4881 
4882  {
4883  {"dynamic_shared_memory_type", PGC_POSTMASTER, RESOURCES_MEM,
4884  gettext_noop("Selects the dynamic shared memory implementation used."),
4885  NULL
4886  },
4889  NULL, NULL, NULL
4890  },
4891 
4892  {
4893  {"shared_memory_type", PGC_POSTMASTER, RESOURCES_MEM,
4894  gettext_noop("Selects the shared memory implementation used for the main shared memory region."),
4895  NULL
4896  },
4899  NULL, NULL, NULL
4900  },
4901 
4902  {
4903  {"wal_sync_method", PGC_SIGHUP, WAL_SETTINGS,
4904  gettext_noop("Selects the method used for forcing WAL updates to disk."),
4905  NULL
4906  },
4907  &sync_method,
4909  NULL, assign_xlog_sync_method, NULL
4910  },
4911 
4912  {
4913  {"xmlbinary", PGC_USERSET, CLIENT_CONN_STATEMENT,
4914  gettext_noop("Sets how binary values are to be encoded in XML."),
4915  NULL
4916  },
4917  &xmlbinary,
4919  NULL, NULL, NULL
4920  },
4921 
4922  {
4923  {"xmloption", PGC_USERSET, CLIENT_CONN_STATEMENT,
4924  gettext_noop("Sets whether XML data in implicit parsing and serialization "
4925  "operations is to be considered as documents or content fragments."),
4926  NULL
4927  },
4928  &xmloption,
4930  NULL, NULL, NULL
4931  },
4932 
4933  {
4934  {"huge_pages", PGC_POSTMASTER, RESOURCES_MEM,
4935  gettext_noop("Use of huge pages on Linux or Windows."),
4936  NULL
4937  },
4938  &huge_pages,
4940  NULL, NULL, NULL
4941  },
4942 
4943  {
4944  {"force_parallel_mode", PGC_USERSET, DEVELOPER_OPTIONS,
4945  gettext_noop("Forces use of parallel query facilities."),
4946  gettext_noop("If possible, run query using a parallel worker and with parallel restrictions."),
4948  },
4951  NULL, NULL, NULL
4952  },
4953 
4954  {
4955  {"password_encryption", PGC_USERSET, CONN_AUTH_AUTH,
4956  gettext_noop("Chooses the algorithm for encrypting passwords."),
4957  NULL
4958  },
4961  NULL, NULL, NULL
4962  },
4963 
4964  {
4965  {"plan_cache_mode", PGC_USERSET, QUERY_TUNING_OTHER,
4966  gettext_noop("Controls the planner's selection of custom or generic plan."),
4967  gettext_noop("Prepared statements can have custom and generic plans, and the planner "
4968  "will attempt to choose which is better. This can be set to override "
4969  "the default behavior."),
4970  GUC_EXPLAIN
4971  },
4972  &plan_cache_mode,
4974  NULL, NULL, NULL
4975  },
4976 
4977  {
4978  {"ssl_min_protocol_version", PGC_SIGHUP, CONN_AUTH_SSL,
4979  gettext_noop("Sets the minimum SSL/TLS protocol version to use."),
4980  NULL,
4982  },
4985  ssl_protocol_versions_info + 1, /* don't allow PG_TLS_ANY */
4986  NULL, NULL, NULL
4987  },
4988 
4989  {
4990  {"ssl_max_protocol_version", PGC_SIGHUP, CONN_AUTH_SSL,
4991  gettext_noop("Sets the maximum SSL/TLS protocol version to use."),
4992  NULL,
4994  },
4996  PG_TLS_ANY,
4998  NULL, NULL, NULL
4999  },
5000 
5001  {
5002  {"recovery_init_sync_method", PGC_SIGHUP, ERROR_HANDLING_OPTIONS,
5003  gettext_noop("Sets the method for synchronizing the data directory before crash recovery."),
5004  },
5007  NULL, NULL, NULL
5008  },
5009 
5010  /* End-of-list marker */
5011  {
5012  {NULL, 0, 0, NULL, NULL}, NULL, 0, NULL, NULL, NULL, NULL
5013  }
5014 };
5015 
5016 /******** end of options list ********/
5017 
5018 
5019 /*
5020  * To allow continued support of obsolete names for GUC variables, we apply
5021  * the following mappings to any unrecognized name. Note that an old name
5022  * should be mapped to a new one only if the new variable has very similar
5023  * semantics to the old.
5024  */
5025 static const char *const map_old_guc_names[] = {
5026  "sort_mem", "work_mem",
5027  "vacuum_mem", "maintenance_work_mem",
5028  NULL
5029 };
5030 
5031 
5032 /*
5033  * Actual lookup of variables is done through this single, sorted array.
5034  */
5036 
5037 /* Current number of variables contained in the vector */
5039 
5040 /* Vector capacity */
5042 
5043 
5044 static bool guc_dirty; /* true if need to do commit/abort work */
5045 
5046 static bool reporting_enabled; /* true to enable GUC_REPORT */
5047 
5048 static bool report_needed; /* true if any GUC_REPORT reports are needed */
5049 
5050 static int GUCNestLevel = 0; /* 1 when in main transaction */
5051 
5052 
5053 static int guc_var_compare(const void *a, const void *b);
5054 static int guc_name_compare(const char *namea, const char *nameb);
5055 static void InitializeGUCOptionsFromEnvironment(void);
5056 static void InitializeOneGUCOption(struct config_generic *gconf);
5057 static void push_old_value(struct config_generic *gconf, GucAction action);
5058 static void ReportGUCOption(struct config_generic *record);
5059 static void reapply_stacked_values(struct config_generic *variable,
5060  struct config_string *pHolder,
5061  GucStack *stack,
5062  const char *curvalue,
5063  GucContext curscontext, GucSource cursource);
5064 static void ShowGUCConfigOption(const char *name, DestReceiver *dest);
5065 static void ShowAllGUCConfig(DestReceiver *dest);
5066 static char *_ShowOption(struct config_generic *record, bool use_units);
5067 static bool validate_option_array_item(const char *name, const char *value,
5068  bool skipIfNoPermissions);
5069 static void write_auto_conf_file(int fd, const char *filename, ConfigVariable *head_p);
5070 static void replace_auto_config_value(ConfigVariable **head_p, ConfigVariable **tail_p,
5071  const char *name, const char *value);
5072 
5073 
5074 /*
5075  * Some infrastructure for checking malloc/strdup/realloc calls
5076  */
5077 static void *
5078 guc_malloc(int elevel, size_t size)
5079 {
5080  void *data;
5081 
5082  /* Avoid unportable behavior of malloc(0) */
5083  if (size == 0)
5084  size = 1;
5085  data = malloc(size);
5086  if (data == NULL)
5087  ereport(elevel,
5088  (errcode(ERRCODE_OUT_OF_MEMORY),
5089  errmsg("out of memory")));
5090  return data;
5091 }
5092 
5093 static void *
5094 guc_realloc(int elevel, void *old, size_t size)
5095 {
5096  void *data;
5097 
5098  /* Avoid unportable behavior of realloc(NULL, 0) */
5099  if (old == NULL && size == 0)
5100  size = 1;
5101  data = realloc(old, size);
5102  if (data == NULL)
5103  ereport(elevel,
5104  (errcode(ERRCODE_OUT_OF_MEMORY),
5105  errmsg("out of memory")));
5106  return data;
5107 }
5108 
5109 static char *
5110 guc_strdup(int elevel, const char *src)
5111 {
5112  char *data;
5113 
5114  data = strdup(src);
5115  if (data == NULL)
5116  ereport(elevel,
5117  (errcode(ERRCODE_OUT_OF_MEMORY),
5118  errmsg("out of memory")));
5119  return data;
5120 }
5121 
5122 
5123 /*
5124  * Detect whether strval is referenced anywhere in a GUC string item
5125  */
5126 static bool
5127 string_field_used(struct config_string *conf, char *strval)
5128 {
5129  GucStack *stack;
5130 
5131  if (strval == *(conf->variable) ||
5132  strval == conf->reset_val ||
5133  strval == conf->boot_val)
5134  return true;
5135  for (stack = conf->gen.stack; stack; stack = stack->prev)
5136  {
5137  if (strval == stack->prior.val.stringval ||
5138  strval == stack->masked.val.stringval)
5139  return true;
5140  }
5141  return false;
5142 }
5143 
5144 /*
5145  * Support for assigning to a field of a string GUC item. Free the prior
5146  * value if it's not referenced anywhere else in the item (including stacked
5147  * states).
5148  */
5149 static void
5150 set_string_field(struct config_string *conf, char **field, char *newval)
5151 {
5152  char *oldval = *field;
5153 
5154  /* Do the assignment */
5155  *field = newval;
5156 
5157  /* Free old value if it's not NULL and isn't referenced anymore */
5158  if (oldval && !string_field_used(conf, oldval))
5159  free(oldval);
5160 }
5161 
5162 /*
5163  * Detect whether an "extra" struct is referenced anywhere in a GUC item
5164  */
5165 static bool
5166 extra_field_used(struct config_generic *gconf, void *extra)
5167 {
5168  GucStack *stack;
5169 
5170  if (extra == gconf->extra)
5171  return true;
5172  switch (gconf->vartype)
5173  {
5174  case PGC_BOOL:
5175  if (extra == ((struct config_bool *) gconf)->reset_extra)
5176  return true;
5177  break;
5178  case PGC_INT:
5179  if (extra == ((struct config_int *) gconf)->reset_extra)
5180  return true;
5181  break;
5182  case PGC_REAL:
5183  if (extra == ((struct config_real *) gconf)->reset_extra)
5184  return true;
5185  break;
5186  case PGC_STRING:
5187  if (extra == ((struct config_string *) gconf)->reset_extra)
5188  return true;
5189  break;
5190  case PGC_ENUM:
5191  if (extra == ((struct config_enum *) gconf)->reset_extra)
5192  return true;
5193  break;
5194  }
5195  for (stack = gconf->stack; stack; stack = stack->prev)
5196  {
5197  if (extra == stack->prior.extra ||
5198  extra == stack->masked.extra)
5199  return true;
5200  }
5201 
5202  return false;
5203 }
5204 
5205 /*
5206  * Support for assigning to an "extra" field of a GUC item. Free the prior
5207  * value if it's not referenced anywhere else in the item (including stacked
5208  * states).
5209  */
5210 static void
5211 set_extra_field(struct config_generic *gconf, void **field, void *newval)
5212 {
5213  void *oldval = *field;
5214 
5215  /* Do the assignment */
5216  *field = newval;
5217 
5218  /* Free old value if it's not NULL and isn't referenced anymore */
5219  if (oldval && !extra_field_used(gconf, oldval))
5220  free(oldval);
5221 }
5222 
5223 /*
5224  * Support for copying a variable's active value into a stack entry.
5225  * The "extra" field associated with the active value is copied, too.
5226  *
5227  * NB: be sure stringval and extra fields of a new stack entry are
5228  * initialized to NULL before this is used, else we'll try to free() them.
5229  */
5230 static void
5232 {
5233  switch (gconf->vartype)
5234  {
5235  case PGC_BOOL:
5236  val->val.boolval =
5237  *((struct config_bool *) gconf)->variable;
5238  break;
5239  case PGC_INT:
5240  val->val.intval =
5241  *((struct config_int *) gconf)->variable;
5242  break;
5243  case PGC_REAL:
5244  val->val.realval =
5245  *((struct config_real *) gconf)->variable;
5246  break;
5247  case PGC_STRING:
5248  set_string_field((struct config_string *) gconf,
5249  &(val->val.stringval),
5250  *((struct config_string *) gconf)->variable);
5251  break;
5252  case PGC_ENUM:
5253  val->val.enumval =
5254  *((struct config_enum *) gconf)->variable;
5255  break;
5256  }
5257  set_extra_field(gconf, &(val->extra), gconf->extra);
5258 }
5259 
5260 /*
5261  * Support for discarding a no-longer-needed value in a stack entry.
5262  * The "extra" field associated with the stack entry is cleared, too.
5263  */
5264 static void
5266 {
5267  switch (gconf->vartype)
5268  {
5269  case PGC_BOOL:
5270  case PGC_INT:
5271  case PGC_REAL:
5272  case PGC_ENUM:
5273  /* no need to do anything */
5274  break;
5275  case PGC_STRING:
5276  set_string_field((struct config_string *) gconf,
5277  &(val->val.stringval),
5278  NULL);
5279  break;
5280  }
5281  set_extra_field(gconf, &(val->extra), NULL);
5282 }
5283 
5284 
5285 /*
5286  * Fetch the sorted array pointer (exported for help_config.c's use ONLY)
5287  */
5288 struct config_generic **
5290 {
5291  return guc_variables;
5292 }
5293 
5294 
5295 /*
5296  * Build the sorted array. This is split out so that it could be
5297  * re-executed after startup (e.g., we could allow loadable modules to
5298  * add vars, and then we'd need to re-sort).
5299  */
5300 void
5302 {
5303  int size_vars;
5304  int num_vars = 0;
5305  struct config_generic **guc_vars;
5306  int i;
5307 
5308  for (i = 0; ConfigureNamesBool[i].gen.name; i++)
5309  {
5310  struct config_bool *conf = &ConfigureNamesBool[i];
5311 
5312  /* Rather than requiring vartype to be filled in by hand, do this: */
5313  conf->gen.vartype = PGC_BOOL;
5314  num_vars++;
5315  }
5316 
5317  for (i = 0; ConfigureNamesInt[i].gen.name; i++)
5318  {
5319  struct config_int *conf = &ConfigureNamesInt[i];
5320 
5321  conf->gen.vartype = PGC_INT;
5322  num_vars++;
5323  }
5324 
5325  for (i = 0; ConfigureNamesReal[i].gen.name; i++)
5326  {
5327  struct config_real *conf = &ConfigureNamesReal[i];
5328 
5329  conf->gen.vartype = PGC_REAL;
5330  num_vars++;
5331  }
5332 
5333  for (i = 0; ConfigureNamesString[i].gen.name; i++)
5334  {
5335  struct config_string *conf = &ConfigureNamesString[i];
5336 
5337  conf->gen.vartype = PGC_STRING;
5338  num_vars++;
5339  }
5340 
5341  for (i = 0; ConfigureNamesEnum[i].gen.name; i++)
5342  {
5343  struct config_enum *conf = &ConfigureNamesEnum[i];
5344 
5345  conf->gen.vartype = PGC_ENUM;
5346  num_vars++;
5347  }
5348 
5349  /*
5350  * Create table with 20% slack
5351  */
5352  size_vars = num_vars + num_vars / 4;
5353 
5354  guc_vars = (struct config_generic **)
5355  guc_malloc(FATAL, size_vars * sizeof(struct config_generic *));
5356 
5357  num_vars = 0;
5358 
5359  for (i = 0; ConfigureNamesBool[i].gen.name; i++)
5360  guc_vars[num_vars++] = &ConfigureNamesBool[i].gen;
5361 
5362  for (i = 0; ConfigureNamesInt[i].gen.name; i++)
5363  guc_vars[num_vars++] = &ConfigureNamesInt[i].gen;
5364 
5365  for (i = 0; ConfigureNamesReal[i].gen.name; i++)
5366  guc_vars[num_vars++] = &ConfigureNamesReal[i].gen;
5367 
5368  for (i = 0; ConfigureNamesString[i].gen.name; i++)
5369  guc_vars[num_vars++] = &ConfigureNamesString[i].gen;
5370 
5371  for (i = 0; ConfigureNamesEnum[i].gen.name; i++)
5372  guc_vars[num_vars++] = &ConfigureNamesEnum[i].gen;
5373 
5374  if (guc_variables)
5375  free(guc_variables);
5376  guc_variables = guc_vars;
5377  num_guc_variables = num_vars;
5378  size_guc_variables = size_vars;
5379  qsort((void *) guc_variables, num_guc_variables,
5380  sizeof(struct config_generic *), guc_var_compare);
5381 }
5382 
5383 /*
5384  * Add a new GUC variable to the list of known variables. The
5385  * list is expanded if needed.
5386  */
5387 static bool
5388 add_guc_variable(struct config_generic *var, int elevel)
5389 {
5390  if (num_guc_variables + 1 >= size_guc_variables)
5391  {
5392  /*
5393  * Increase the vector by 25%
5394  */
5395  int size_vars = size_guc_variables + size_guc_variables / 4;
5396  struct config_generic **guc_vars;
5397 
5398  if (size_vars == 0)
5399  {
5400  size_vars = 100;
5401  guc_vars = (struct config_generic **)
5402  guc_malloc(elevel, size_vars * sizeof(struct config_generic *));
5403  }
5404  else
5405  {
5406  guc_vars = (struct config_generic **)
5407  guc_realloc(elevel, guc_variables, size_vars * sizeof(struct config_generic *));
5408  }
5409 
5410  if (guc_vars == NULL)
5411  return false; /* out of memory */
5412 
5413  guc_variables = guc_vars;
5414  size_guc_variables = size_vars;
5415  }
5416  guc_variables[num_guc_variables++] = var;
5417  qsort((void *) guc_variables, num_guc_variables,
5418  sizeof(struct config_generic *), guc_var_compare);
5419  return true;
5420 }
5421 
5422 /*
5423  * Decide whether a proposed custom variable name is allowed.
5424  *
5425  * It must be two or more identifiers separated by dots, where the rules
5426  * for what is an identifier agree with scan.l. (If you change this rule,
5427  * adjust the errdetail in find_option().)
5428  */
5429 static bool
5431 {
5432  bool saw_sep = false;
5433  bool name_start = true;
5434 
5435  for (const char *p = name; *p; p++)
5436  {
5437  if (*p == GUC_QUALIFIER_SEPARATOR)
5438  {
5439  if (name_start)
5440  return false; /* empty name component */
5441  saw_sep = true;
5442  name_start = true;
5443  }
5444  else if (strchr("ABCDEFGHIJKLMNOPQRSTUVWXYZ"
5445  "abcdefghijklmnopqrstuvwxyz", *p) != NULL ||
5446  IS_HIGHBIT_SET(*p))
5447  {
5448  /* okay as first or non-first character */
5449  name_start = false;
5450  }
5451  else if (!name_start && strchr("0123456789_$", *p) != NULL)
5452  /* okay as non-first character */ ;
5453  else
5454  return false;
5455  }
5456  if (name_start)
5457  return false; /* empty name component */
5458  /* OK if we found at least one separator */
5459  return saw_sep;
5460 }
5461 
5462 /*
5463  * Create and add a placeholder variable for a custom variable name.
5464  */
5465 static struct config_generic *
5466 add_placeholder_variable(const char *name, int elevel)
5467 {
5468  size_t sz = sizeof(struct config_string) + sizeof(char *);
5469  struct config_string *var;
5470  struct config_generic *gen;
5471 
5472  var = (struct config_string *) guc_malloc(elevel, sz);
5473  if (var == NULL)
5474  return NULL;
5475  memset(var, 0, sz);
5476  gen = &var->gen;
5477 
5478  gen->name = guc_strdup(elevel, name);
5479  if (gen->name == NULL)
5480  {
5481  free(var);
5482  return NULL;
5483  }
5484 
5485  gen->context = PGC_USERSET;
5486  gen->group = CUSTOM_OPTIONS;
5487  gen->short_desc = "GUC placeholder variable";
5489  gen->vartype = PGC_STRING;
5490 
5491  /*
5492  * The char* is allocated at the end of the struct since we have no
5493  * 'static' place to point to. Note that the current value, as well as
5494  * the boot and reset values, start out NULL.
5495  */
5496  var->variable = (char **) (var + 1);
5497 
5498  if (!add_guc_variable((struct config_generic *) var, elevel))
5499  {
5500  free(unconstify(char *, gen->name));
5501  free(var);
5502  return NULL;
5503  }
5504 
5505  return gen;
5506 }
5507 
5508 /*
5509  * Look up option "name". If it exists, return a pointer to its record.
5510  * Otherwise, if create_placeholders is true and name is a valid-looking
5511  * custom variable name, we'll create and return a placeholder record.
5512  * Otherwise, if skip_errors is true, then we silently return NULL for
5513  * an unrecognized or invalid name. Otherwise, the error is reported at
5514  * error level elevel (and we return NULL if that's less than ERROR).
5515  *
5516  * Note: internal errors, primarily out-of-memory, draw an elevel-level
5517  * report and NULL return regardless of skip_errors. Hence, callers must
5518  * handle a NULL return whenever elevel < ERROR, but they should not need
5519  * to emit any additional error message. (In practice, internal errors
5520  * can only happen when create_placeholders is true, so callers passing
5521  * false need not think terribly hard about this.)
5522  */
5523 static struct config_generic *
5524 find_option(const char *name, bool create_placeholders, bool skip_errors,
5525  int elevel)
5526 {
5527  const char **key = &name;
5528  struct config_generic **res;
5529  int i;
5530 
5531  Assert(name);
5532 
5533  /*
5534  * By equating const char ** with struct config_generic *, we are assuming
5535  * the name field is first in config_generic.
5536  */
5537  res = (struct config_generic **) bsearch((void *) &key,
5538  (void *) guc_variables,
5539  num_guc_variables,
5540  sizeof(struct config_generic *),
5541  guc_var_compare);
5542  if (res)
5543  return *res;
5544 
5545  /*
5546  * See if the name is an obsolete name for a variable. We assume that the
5547  * set of supported old names is short enough that a brute-force search is
5548  * the best way.
5549  */
5550  for (i = 0; map_old_guc_names[i] != NULL; i += 2)
5551  {
5552  if (guc_name_compare(name, map_old_guc_names[i]) == 0)
5553  return find_option(map_old_guc_names[i + 1], false,
5554  skip_errors, elevel);
5555  }
5556 
5557  if (create_placeholders)
5558  {
5559  /*
5560  * Check if the name is valid, and if so, add a placeholder. If it
5561  * doesn't contain a separator, don't assume that it was meant to be a
5562  * placeholder.
5563  */
5564  if (strchr(name, GUC_QUALIFIER_SEPARATOR) != NULL)
5565  {
5566  if (valid_custom_variable_name(name))
5567  return add_placeholder_variable(name, elevel);
5568  /* A special error message seems desirable here */
5569  if (!skip_errors)
5570  ereport(elevel,
5571  (errcode(ERRCODE_INVALID_NAME),
5572  errmsg("invalid configuration parameter name \"%s\"",
5573  name),
5574  errdetail("Custom parameter names must be two or more simple identifiers separated by dots.")));
5575  return NULL;
5576  }
5577  }
5578 
5579  /* Unknown name */
5580  if (!skip_errors)
5581  ereport(elevel,
5582  (errcode(ERRCODE_UNDEFINED_OBJECT),
5583  errmsg("unrecognized configuration parameter \"%s\"",
5584  name)));
5585  return NULL;
5586 }
5587 
5588 
5589 /*
5590  * comparator for qsorting and bsearching guc_variables array
5591  */
5592 static int
5593 guc_var_compare(const void *a, const void *b)
5594 {
5595  const struct config_generic *confa = *(struct config_generic *const *) a;
5596  const struct config_generic *confb = *(struct config_generic *const *) b;
5597 
5598  return guc_name_compare(confa->name, confb->name);
5599 }
5600 
5601 /*
5602  * the bare comparison function for GUC names
5603  */
5604 static int
5605 guc_name_compare(const char *namea, const char *nameb)
5606 {
5607  /*
5608  * The temptation to use strcasecmp() here must be resisted, because the
5609  * array ordering has to remain stable across setlocale() calls. So, build
5610  * our own with a simple ASCII-only downcasing.
5611  */
5612  while (*namea && *nameb)
5613  {
5614  char cha = *namea++;
5615  char chb = *nameb++;
5616 
5617  if (cha >= 'A' && cha <= 'Z')
5618  cha += 'a' - 'A';
5619  if (chb >= 'A' && chb <= 'Z')
5620  chb += 'a' - 'A';
5621  if (cha != chb)
5622  return cha - chb;
5623  }
5624  if (*namea)
5625  return 1; /* a is longer */
5626  if (*nameb)
5627  return -1; /* b is longer */
5628  return 0;
5629 }
5630 
5631 
5632 /*
5633  * Initialize GUC options during program startup.
5634  *
5635  * Note that we cannot read the config file yet, since we have not yet
5636  * processed command-line switches.
5637  */
5638 void
5640 {
5641  int i;
5642 
5643  /*
5644  * Before log_line_prefix could possibly receive a nonempty setting, make
5645  * sure that timezone processing is minimally alive (see elog.c).
5646  */
5648 
5649  /*
5650  * Build sorted array of all GUC variables.
5651  */
5653 
5654  /*
5655  * Load all variables with their compiled-in defaults, and initialize
5656  * status fields as needed.
5657  */
5658  for (i = 0; i < num_guc_variables; i++)
5659  {
5660  InitializeOneGUCOption(guc_variables[i]);
5661  }
5662 
5663  guc_dirty = false;
5664 
5665  reporting_enabled = false;
5666 
5667  /*
5668  * Prevent any attempt to override the transaction modes from
5669  * non-interactive sources.
5670  */
5671  SetConfigOption("transaction_isolation", "read committed",
5673  SetConfigOption("transaction_read_only", "no",
5675  SetConfigOption("transaction_deferrable", "no",
5677 
5678  /*
5679  * For historical reasons, some GUC parameters can receive defaults from
5680  * environment variables. Process those settings.
5681  */
5683 }
5684 
5685 /*
5686  * Assign any GUC values that can come from the server's environment.
5687  *
5688  * This is called from InitializeGUCOptions, and also from ProcessConfigFile
5689  * to deal with the possibility that a setting has been removed from
5690  * postgresql.conf and should now get a value from the environment.
5691  * (The latter is a kludge that should probably go away someday; if so,
5692  * fold this back into InitializeGUCOptions.)
5693  */
5694 static void
5696 {
5697  char *env;
5698  long stack_rlimit;
5699 
5700  env = getenv("PGPORT");
5701  if (env != NULL)
5703 
5704  env = getenv("PGDATESTYLE");
5705  if (env != NULL)
5706  SetConfigOption("datestyle", env, PGC_POSTMASTER, PGC_S_ENV_VAR);
5707 
5708  env = getenv("PGCLIENTENCODING");
5709  if (env != NULL)
5710  SetConfigOption("client_encoding", env, PGC_POSTMASTER, PGC_S_ENV_VAR);
5711 
5712  /*
5713  * rlimit isn't exactly an "environment variable", but it behaves about
5714  * the same. If we can identify the platform stack depth rlimit, increase
5715  * default stack depth setting up to whatever is safe (but at most 2MB).
5716  */
5717  stack_rlimit = get_stack_depth_rlimit();
5718  if (stack_rlimit > 0)
5719  {
5720  long new_limit = (stack_rlimit - STACK_DEPTH_SLOP) / 1024L;
5721 
5722  if (new_limit > 100)
5723  {
5724  char limbuf[16];
5725 
5726  new_limit = Min(new_limit, 2048);
5727  sprintf(limbuf, "%ld", new_limit);
5728  SetConfigOption("max_stack_depth", limbuf,
5730  }
5731  }
5732 }
5733 
5734 /*
5735  * Initialize one GUC option variable to its compiled-in default.
5736  *
5737  * Note: the reason for calling check_hooks is not that we think the boot_val
5738  * might fail, but that the hooks might wish to compute an "extra" struct.
5739  */
5740 static void
5742 {
5743  gconf->status = 0;
5744  gconf->source = PGC_S_DEFAULT;
5745  gconf->reset_source = PGC_S_DEFAULT;
5746  gconf->scontext = PGC_INTERNAL;
5747  gconf->reset_scontext = PGC_INTERNAL;
5748  gconf->stack = NULL;
5749  gconf->extra = NULL;
5750  gconf->last_reported = NULL;
5751  gconf->sourcefile = NULL;
5752  gconf->sourceline = 0;
5753 
5754  switch (gconf->vartype)
5755  {
5756  case PGC_BOOL:
5757  {
5758  struct config_bool *conf = (struct config_bool *) gconf;
5759  bool newval = conf->boot_val;
5760  void *extra = NULL;
5761 
5762  if (!call_bool_check_hook(conf, &newval, &extra,
5763  PGC_S_DEFAULT, LOG))
5764  elog(FATAL, "failed to initialize %s to %d",
5765  conf->gen.name, (int) newval);