Skip to main content
Kill -9 Club
Sign in

dropdb

DatabasesPackage: postgresql-clientHandle with care

Deletes an entire database. --if-exists avoids the error when it does not exist, which makes a script rerunnable — and also makes the command silent.

A mistake with this command can destroy data or lock you out

  • There is no confirmation outside -i, and no undo. Check the name with psql -l, and that a backup has been restored once already, before typing it.

What its options do in the lessons

From the same glossary the lessons render under their commands, so the two cannot disagree.

dropdb --if-exists
Returns no error if the database is absent — which is what a cleanup that must succeed either way needs.

Lessons that teach it

No lesson names it among its useful commands; it appears inside other lessons' command lines.