4 DROP DATABASE — remove a database
8 DROP DATABASE [ IF EXISTS ] name [ [ WITH ] ( option [, ...] ) ]
16 DROP DATABASE drops a database. It removes the catalog entries for the
17 database and deletes the directory containing the data. It can only be
18 executed by the database owner. It cannot be executed while you are
19 connected to the target database. (Connect to postgres or any other
20 database to issue this command.) Also, if anyone else is connected to
21 the target database, this command will fail unless you use the FORCE
22 option described below.
24 DROP DATABASE cannot be undone. Use it with care!
29 Do not throw an error if the database does not exist. A notice
30 is issued in this case.
33 The name of the database to remove.
36 Attempt to terminate all existing connections to the target
37 database. It doesn't terminate if prepared transactions, active
38 logical replication slots or subscriptions are present in the
41 This terminates background worker connections and connections
42 that the current user has permission to terminate with
43 pg_terminate_backend, described in Section 9.28.2. If
44 connections would remain, this command will fail.
48 DROP DATABASE cannot be executed inside a transaction block.
50 This command cannot be executed while connected to the target database.
51 Thus, it might be more convenient to use the program dropdb instead,
52 which is a wrapper around this command.
56 There is no DROP DATABASE statement in the SQL standard.