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