4 ALTER SYSTEM — change a server configuration parameter
8 ALTER SYSTEM SET configuration_parameter { TO | = } { value [, ...] | DEFAULT }
10 ALTER SYSTEM RESET configuration_parameter
11 ALTER SYSTEM RESET ALL
15 ALTER SYSTEM is used for changing server configuration parameters
16 across the entire database cluster. It can be more convenient than the
17 traditional method of manually editing the postgresql.conf file. ALTER
18 SYSTEM writes the given parameter setting to the postgresql.auto.conf
19 file, which is read in addition to postgresql.conf. Setting a parameter
20 to DEFAULT, or using the RESET variant, removes that configuration
21 entry from the postgresql.auto.conf file. Use RESET ALL to remove all
22 such configuration entries.
24 Values set with ALTER SYSTEM will be effective after the next server
25 configuration reload, or after the next server restart in the case of
26 parameters that can only be changed at server start. A server
27 configuration reload can be commanded by calling the SQL function
28 pg_reload_conf(), running pg_ctl reload, or sending a SIGHUP signal to
29 the main server process.
31 Only superusers and users granted ALTER SYSTEM privilege on a parameter
32 can change it using ALTER SYSTEM. Also, since this command acts
33 directly on the file system and cannot be rolled back, it is not
34 allowed inside a transaction block or function.
38 configuration_parameter
39 Name of a settable configuration parameter. Available parameters
40 are documented in Chapter 19.
43 New value of the parameter. Values can be specified as string
44 constants, identifiers, numbers, or comma-separated lists of
45 these, as appropriate for the particular parameter. Values that
46 are neither numbers nor valid identifiers must be quoted.
47 DEFAULT can be written to specify removing the parameter and its
48 value from postgresql.auto.conf.
50 For some list-accepting parameters, quoted values will produce
51 double-quoted output to preserve whitespace and commas; for
52 others, double-quotes must be used inside single-quoted strings
57 This command can't be used to set data_directory, allow_alter_system,
58 nor parameters that are not allowed in postgresql.conf (e.g., preset
61 See Section 19.1 for other ways to set the parameters.
63 ALTER SYSTEM can be disabled by setting allow_alter_system to off, but
64 this is not a security mechanism (as explained in detail in the
65 documentation for this parameter).
70 ALTER SYSTEM SET wal_level = replica;
72 Undo that, restoring whatever setting was effective in postgresql.conf:
73 ALTER SYSTEM RESET wal_level;
77 The ALTER SYSTEM statement is a PostgreSQL extension.