The ALTER DATABASE statement modifies a database.
Syntax
ALTER DATABASE <dbname> SET configuration_parameter { TO | = } { value | DEFAULT }
ALTER DATABASE <dbname> SET configuration_parameter FROM CURRENT
ALTER DATABASE <dbname> RESET configuration_parameter
ALTER DATABASE <dbname> RESET ALL| Parameter | Description |
|---|---|
configuration_parameter | A Hologres configuration parameter. |
value | The new value for the configuration parameter. |
DEFAULT | Sets the configuration parameter to its default value. |
RESET | Resets the specified configuration parameter. |
RESET ALL | Resets all configuration parameters for the database. |
SET FROM CURRENT | Sets the configuration parameter to the value of the current session. |
Examples
The following examples set the time zone to GMT+8:00.
Set the time zone for the current session only:
SET timezone='GMT+8:00';Set the time zone at the database level so all new sessions in the postgres database use GMT+8:00 by default:
ALTER DATABASE postgres SET timezone='GMT+8:00';