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