» PostgreSQL – ERROR: cannot drop the currently open database
Posted by Kasper Tidemann on Wednesday 17th of March 2010 10:35:06 PM
You might come across the following error when trying to drop a database in your PostgreSQL:
ERROR: cannot drop the currently open database
This is because you are trying to delete the database that you are currently connected to (or in MySQL jargon: the database you are current USEing). To fix the problem, try to issue the following command:
\connect postgres
This will connect you to the postgres database in PostgreSQL, sometimes referred to as the maintenance database. From here, try to issue your drop command again – it will now work out for you as expected.





