Take the 2-minute tour ×
Database Administrators Stack Exchange is a question and answer site for database professionals who wish to improve their database skills and learn from others in the community. It's 100% free, no registration required.

According to the documentation, so long as I'm not connected to a database, I can either delete a database in the console using:

DROP DATABASE dbname;

Or I can drop it using the wrapper tool dropdb.

Both give me an error saying the database doesn't exist, yet when in the console and typing the command \l, I get a list of databases including the one I want to delete.

                                          List of databases
           Name            |   Owner   | Encoding |   Collate   |    Ctype    |   Access privileges   
---------------------------+-----------+----------+-------------+-------------+-----------------------
 Blog_development          | myusername | UTF8     | en_US.UTF-8 | en_US.UTF-8 | 
 Blog_test                 | myusername | UTF8     | en_US.UTF-8 | en_US.UTF-8 | 

The database name is Blog_development (and the one below it). I was playing with rails and trying to learn from the online documentation. I wanted to start over and delete everything.

When trying to delete it however, it says it doesn't exist. I'm brand new to PostgreSQL so I'm a bit lost, nothing in the documentation about this error other than it popping up when it doesn't exist. Of course it exists, it's right there.

share|improve this question
2  
Please always show the full, exact text of any error messages, and show your PostgreSQL version. –  Craig Ringer Dec 27 '12 at 2:34
    
Check the port your DB is running on. The tools such as dropdb, createdb etc will connect by default to 5432. This caught me out when my DB was actually running on 5433. –  DavidF Mar 17 at 11:32

1 Answer 1

up vote 9 down vote accepted

Your database was created using double quotes so its name is now case-sensitive. Therefore, you now need to always use double quotes when referring to it:

drop database "Blog_test";

More details about quoted identifiers (a database name is an identifier just like a column or table name) can be found in the manual:
http://www.postgresql.org/docs/current/static/sql-syntax-lexical.html#SQL-SYNTAX-IDENTIFIERS

share|improve this answer
    
Wooohoo! Thanks. –  Sephethus Dec 27 '12 at 15:03
    
my rule of thumb always use lower case :( I had this same problem. –  chris hough Oct 19 '13 at 21:09

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.