PostgreSQL: Drop Database but DB is still there

neurix picture neurix · Jan 28, 2012 · Viewed 17.9k times · Source

I am new to PostgreSQL and I try to get my head around it. I am familiar to db's and MySQL.

I am trying to delete database, which I created since psql seems to ignore the changes I try to push through Django.

When I execute \l I get the following response:

                                  List of databases
       Name       | Owner  | Encoding |   Collate   |    Ctype    | Access privileges 
------------------+--------+----------+-------------+-------------+-------------------
 postgres         | neurix | UTF8     | en_AU.UTF-8 | en_AU.UTF-8 | 
 test_db          | neurix | UTF8     | en_AU.UTF-8 | en_AU.UTF-8 | 
 template0        | neurix | UTF8     | en_AU.UTF-8 | en_AU.UTF-8 | =c/neurix        +
                  |        |          |             |             | neurix=CTc/neurix
 template1        | neurix | UTF8     | en_AU.UTF-8 | en_AU.UTF-8 | =c/neurix        +
                  |        |          |             |             | neurix=CTc/neurix
 template_postgis | neurix | UTF8     | en_AU.UTF-8 | en_AU.UTF-8 | 
(5 rows)

Now I wan to drop the database "test_db" with

DROP DATABASE test_db

but when I execute \l afterwards, the table is still there and the overview looks like about.

Answer

Tom Anderson picture Tom Anderson · Jan 28, 2012

Did you type a ; after the DROP DATABASE test_db? Did PostgreSQL print a response to your command?