ALTER_SYSTEM(7pg14)

πŸ“¦ version 14.24, in opensuse-leap 16.0

🌸 NAME 🌸

ALTER_SYSTEM β€” change a server configuration parameter. Yep, bestie, that's the whole assignment, and it's lowkey iconic πŸ’…βœ¨


πŸ¦‹ SYNOPSIS πŸ¦‹

ALTER SYSTEM SET configuration_parameter { TO | = } { value [, ...] | DEFAULT }

ALTER SYSTEM RESET configuration_parameter
ALTER SYSTEM RESET ALL

πŸ’– DESCRIPTION πŸ’–

okay so ALTER SYSTEM is your girl for changing server configuration parameters across the entire database cluster. It can be way more convenient than the traditional method of manually editing the postgresql.conf file, fr fr.

ALTER SYSTEM writes the given parameter setting to the postgresql.auto.conf file, which is read in addition to postgresql.conf. Setting a parameter to DEFAULT, or using the RESET variant, removes that configuration entry from the postgresql.auto.conf file. Use RESET ALL to remove all such configuration entries. slay.

Values set with ALTER SYSTEM will be effective after the next server configuration reload, or after the next server restart in the case of parameters that can only be changed at server start. A server configuration reload can be commanded by calling the SQL function pg_reload_conf(), running pg_ctl reload, or sending a SIGHUP signal to the main server process. the way that whole reload pipeline works is genuinely so real.

Only superusers can use ALTER SYSTEM. Also, since this command acts directly on the file system and cannot be rolled back, it is not allowed inside a transaction block or function.

🚨 no cap: this one touches the file system directly and cannot be rolled back, so it is not allowed inside a transaction block or function. periodt.

πŸŽ€ PARAMETERS πŸŽ€

  • configuration_parameter β€” name of a settable configuration parameter. Available parameters are documented in Chapter 20.
  • value β€” new value of the parameter. Values can be specified as string constants, identifiers, numbers, or comma-separated lists of these, as appropriate for the particular parameter. Values that are neither numbers nor valid identifiers must be quoted. DEFAULT can be written to specify removing the parameter and its value from postgresql.auto.conf.

For some list-accepting parameters, quoted values will produce double-quoted output to preserve whitespace and commas; for others, double-quotes must be used inside single-quoted strings to get this effect. iykyk πŸ’«


πŸ”₯ NOTES πŸ”₯

This command can't be used to set data_directory, nor parameters that are not allowed in postgresql.conf (e.g., preset options). not me trying to sneak around the rules β€” it's literally a no πŸ’€

See Section 20.1 for other ways to set the parameters.


🌈 EXAMPLES 🌈

Set the wal_level:

ALTER SYSTEM SET wal_level = replica;

Undo that, restoring whatever setting was effective in postgresql.conf:

ALTER SYSTEM RESET wal_level;

πŸ‘‘ COMPATIBILITY πŸ‘‘

The ALTER SYSTEM statement is a PostgreSQL extension. she's special like that πŸ’…


🫢 SEE ALSO 🫢

SET(7), SHOW(7)


Brought to you by PostgreSQL 14.24 Documentation, dated 2026 β€” and yes, this whole vibe is a certified main character moment, bestie πŸ’–βœ¨πŸŽ€

πŸ“¦ where this page comes from