This section is from the "Practical PostgreSQL" book, by John Worsley and Joshua Drake. Also available from Amazon: Practical PostgreSQL.
To destroy an existing database, use this command at the Unix shell:
dropdb databasename
The alternative way is to use psql to remove this database:
DROP DATABASE databasename;
![]() | Dropping a Database |
|---|---|
Upon dropping a database, all tables, data, relations, or objects in that database are destroyed. The Unix files associated with the database are also physically removed. It does not prompt you to make sure if you want to delete the database or not. This action cannot be undone, so you should weigh the consequences carefully before performing a drop database command. |
![]() | ERROR: DROP DATABASE: cannot be executed... |
|---|---|
If another user is logged onto this database while you are performing a drop database, then the database deletion will fail. |
Help us make a better book, leave feedback. (http://www.opendocspublishing.com/entry.lxp?lxpe=92)
 
Continue to: