ALTER SYSTEM is a utility command for modifying the PostgreSQL configuration.
ALTER SYSTEM was added in PostgreSQL 9.4.
ALTER SYSTEM can only be executed by a superuser. It is not possible to grant a non-superuser privileges to execute
ALTER SYSTEM; however, from PostgreSQL 15 permission to alter individual configuration parameters can be granted to non-superusers.
It is not possible to wrap the command in a transaction or security definer function.
ALTER SYSTEM is used to set the value of a configuration parameter to
'DEFAULT' (for example
log_error_verbosity), the value must be enclosed in single quotes, otherwise
ALTER SYSTEM will interpret it as
ALTER SYSTEM SET ... TO DEFAULT, which removes the configuration parameter from
ALTER SYSTEM is handled by the function
AlterSystemSetConfigFile() in src/backend/utils/misc/guc.c.