ALTER DATABASE

Synopsis

Use the ALTER DATABASE statement to redefine the attributes of a database.

Syntax

alter_database ::= ALTER DATABASE name 
                   [ [ WITH ] alter_database_option [ ... ]
                     | RENAME TO name
                     | OWNER TO { new_owner
                                  | CURRENT_USER
                                  | SESSION_USER }
                     | SET configuration_parameter { TO | = } 
                       { value | DEFAULT }
                     | SET configuration_parameter FROM CURRENT
                     | RESET configuration_parameter
                     | RESET ALL ]

alter_database_option ::= ALLOW_CONNECTIONS allowconn
                          | CONNECTION LIMIT connlimit
                          | IS_TEMPLATE istemplate

alter_database

ALTERDATABASEnameWITHalter_database_optionRENAMETOnameOWNERTOnew_ownerCURRENT_USERSESSION_USERSETconfiguration_parameterTO=valueDEFAULTSETconfiguration_parameterFROMCURRENTRESETconfiguration_parameterRESETALL

alter_database_option

ALLOW_CONNECTIONSallowconnCONNECTIONLIMITconnlimitIS_TEMPLATEistemplate

Semantics

Note

Some options in DATABASE are under development.

name

Specify the name of the database to be altered.

ALLOW_CONNECTIONS

Specify false to disallow connections to this database. Default is true, which allows this database to be cloned by any user with CREATEDB privileges.

CONNECTION_LIMIT

Specify how many concurrent connections can be made to this database. Default of -1 allows unlimited concurrent connections.

IS_TEMPLATE

Strue — This database can be cloned by any user with CREATEDB privileges. Specify false to Only superusers or the owner of the database can clone it.

See also