ALTER DATABASE

Changes the attributes of a database.

Synopsis

ALTER DATABASE <name> SET <parameter> { TO | = } { <value> | DEFAULT } 

ALTER DATABASE <name> RESET <parameter>

Description

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

<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 for information about user-settable configuration parameters.

Notes

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.

Examples

To set the default schema search path for the mydatabase database:

ALTER DATABASE mydatabase SET search_path TO myschema, 
public, pg_catalog;

Compatibility

The ALTER DATABASE statement is a HAWQ extension.

See Also

CREATE DATABASE, DROP DATABASE, SET