| --- |
| title: ALTER DATABASE |
| --- |
| |
| Changes the attributes of a database. |
| |
| ## Synopsis<a id="alterrole__section2"></a> |
| |
| ``` pre |
| ALTER DATABASE name SET parameter { TO | + } { value | DEFAULT } |
| |
| ALTER DATABASE name RESET parameter |
| ``` |
| |
| ## Description<a id="desc"></a> |
| |
| `ALTER DATABASE` changes the attributes of a HAWQ database. |
| |
| `SET` and `RESET` *parameter* changes the session default for a configuration parameter for a HAWQ database. Whenever a new session is subsequently started in that database, the specified value becomes the session default value. The database-specific default overrides whatever setting is present in the server configuration file (`hawq-site.xml`). Only the database owner or a superuser can change the session defaults for a database. Certain parameters cannot be set this way, or can only be set by a superuser. |
| |
| ## Parameters<a id="alterrole__section4"></a> |
| |
| *name* |
| The name of the database whose attributes are to be altered. |
| |
| **Note:** HAWQ reserves the database "hcatalog" for system use. You cannot connect to or alter the system "hcatalog" database. |
| |
| *parameter* |
| Set this database's session default for the specified configuration parameter to the given value. If value is `DEFAULT` or if `RESET` is used, the database-specific setting is removed, so the system-wide default setting will be inherited in new sessions. Use `RESET ALL` to clear all database-specific settings. See [About Server Configuration Parameters](../guc/guc_config.html#topic1) for information about user-settable configuration parameters. |
| |
| ## Notes<a id="notes"></a> |
| |
| It is also possible to set a configuration parameter session default for a specific role (user) rather than to a database. Role-specific settings override database-specific ones if there is a conflict. See [ALTER ROLE](ALTER-ROLE.html). |
| |
| ## Examples<a id="examples"></a> |
| |
| To set the default schema search path for the `mydatabase` database: |
| |
| ``` pre |
| ALTER DATABASE mydatabase SET search_path TO myschema, |
| public, pg_catalog; |
| ``` |
| |
| ## Compatibility<a id="compat"></a> |
| |
| The `ALTER DATABASE` statement is a HAWQ extension. |
| |
| ## See Also<a id="see"></a> |
| |
| [CREATE DATABASE](CREATE-DATABASE.html#topic1), [DROP DATABASE](DROP-DATABASE.html#topic1), [SET](SET.html) |
| |
| |