ALTER DATABASE

This page documents the preview version (v2.23). Preview includes features under active development and is for development and testing only. For production, use the stable version (v2024.1). To learn more, see Versioning.

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 run_time_parameter { TO | = } 
                       { value | DEFAULT }
                     | SET run_time_parameter FROM CURRENT
                     | RESET run_time_parameter
                     | RESET ALL ]

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

alter_database

ALTERDATABASEnameWITHalter_database_optionRENAMETOnameOWNERTOnew_ownerCURRENT_USERSESSION_USERSETrun_time_parameterTO=valueDEFAULTSETrun_time_parameterFROMCURRENTRESETrun_time_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