DROP_DATABASE(7pg14)
πΈ NAME πΈ
DROP_DATABASE β remove a database. Hii bestie, welcome to the DROP_DATABASE(7) page from the PostgreSQL 14.24 Documentation π β this is literally the βremove a databaseβ manual, and yes, it goes exactly as hard as it sounds. π
β¨ SYNOPSIS β¨
Hereβs the whole shape of it, no cap:
DROP DATABASE [ IF EXISTS ] name [ [ WITH ] ( option [, ...] ) ]
where option can be:
FORCE
Itβs giving short, iconic, and a little dangerous. π
π DESCRIPTION π
So DROP DATABASE drops a database. Like, actually drops it: it removes the catalog entries for the database and deletes the directory containing the data. π«Ά
Only the database owner can execute it. Periodt. It cannot be executed while youβre connected to the target database β connect to postgres or any other database to issue this command. Also, if anyone else is connected to the target database, this command will fail unless you use the FORCE option described below.
DROP DATABASE cannot be undone. Use it with care! ππ₯
π PARAMETERS π
IF EXISTSβ do not throw an error if the database does not exist. A notice is issued in this case. πnameβ the name of the database to remove. Simple, iconic, to the point.FORCEβ attempt to terminate all existing connections to the target database. It doesnβt terminate if prepared transactions, active logical replication slots or subscriptions are present in the target database.
It terminates background worker connections and connections that the current user has permission to terminate with pg_terminate_backend, described in Section 9.27.2. If connections would remain, this command will fail. π
π§ NOTES π§
DROP DATABASE cannot be executed inside a transaction block. No cap.
This command cannot be executed while connected to the target database. Thus, it might be more convenient to use the program dropdb(1) instead, which is a wrapper around this command. Slay. β¨
π COMPATIBILITY π
There is no DROP DATABASE statement in the SQL standard. Thatβs it, thatβs the compatibility update. π
π¦ SEE ALSO π¦
CREATE DATABASE(CREATE_DATABASE(7)) β the other half of the database lifecycle, bestie. π¦
π okay bye bestie β this was the DROP DATABASE(7) page from PostgreSQL 14.24, dated 2026. Now go forth and drop responsibly. π
π¦ where this page comes from
- opensuse-leap 16.0: postgresql14 14.24-160000.1.1 Β· PostgreSQL
- opensuse-leap 16.0: postgresql14 14.24-160000.1.1 Β· PostgreSQL
- opensuse-leap 16.0: postgresql14 14.24-160000.1.1 Β· PostgreSQL
- opensuse-leap 16.0: postgresql14 14.24-160000.1.1 Β· PostgreSQL
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms