dropdb
A core utility for dropping a database
dropdb
is a core utility for dropping (deleting) a database and is essentially a wrapper around the DROP DATABASE
SQL command.
dropdb
was added in PostgreSQL 7.0.
Source code
The dropdb
source code is located at src/bin/scripts/dropdb.c.
Change history
- PostgreSQL 13
--force
option added (commit 80e05a08)
- PostgreSQL 9.2
--maintenance-db
option added (commit 68281e00)
- PostgreSQL 8.4
-w
/--no-password
option added (commit 9de59fd1)
- PostgreSQL 8.3
--quiet
option removed (commit 9539e64b)
- PostgreSQL 7.4
- converted from a shell script into a C program (commit 9e0ab712)
- PostgreSQL 7.3
- support for identifiers containing spaces added (commit 5804a7ce)
- PostgreSQL 7.0
- added (commit 240e4c98)
Examples
$ psql -c 'SELECT datname FROM pg_database' datname ----------- postgres template1 template0 foo (4 rows) $ dropdb foo $ psql -c 'SELECT datname FROM pg_database' datname ----------- postgres template1 template0 (3 rows)
References
- PostgreSQL documentation: dropdb