ALTER_SYSTEM(7pg15)

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

πŸ’– NAME πŸ’–

Okay so bestie, this is ALTER_SYSTEM β€” change a server configuration parameter β€” from the PostgreSQL 15.19 docs. It’s giving cluster-wide config makeover, and honestly? 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 how you change 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. The way that it works: it 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 postgresql.auto.conf. 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. Vibe check: reload first, restart if the parameter says so. ⭐

Only superusers and users granted ALTER SYSTEM privilege on a parameter can change it using 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. That’s a hard no, bestie β€” no cap, take it seriously. πŸš«πŸ’…

πŸŽ€ 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. That’s the little quote gremlin detail, 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). 🚫
  • 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. That’s the whole vibe. πŸ’«


🫢 SEE ALSO 🫢

SET(7), SHOW(7) β€” go read those too, bestie. πŸ“š


Alright, that’s the page! Sending you off with the official footer energy: PostgreSQL 15.19, dated 2026 β€” xoxo, your ALTER SYSTEM(7) bestie πŸ’–βœ¨

πŸ“¦ where this page comes from