DROP DATABASE

DROP DATABASE can be used to remove a database and all of its objects.

Permissions

The role must have the DDL permission at the database level.

Syntax

drop_database_statement ::=
    DROP DATABASE database_name
    ;

database_name ::= identifier

Parameters

Parameter Description
database_name The name of the database to drop. This can not be the current database in use.

Examples

Dropping a database and all of its objects

master=> DROP DATABASE raviga;
executed

Dropping the current database

The current database in use can’t be dropped. Switch to another database first.

raviga=> DROP DATABASE raviga;
Current open database 'raviga' cannot be dropped.

raviga=> \c master
master=> DROP DATABASE raviga;
executed