Wednesday, April 6, 2011

Drop a database being accessed by another users?

I'm trying to drop a database from PgAdmin 3 and I get this error message:

ERROR: can't delete current database
SQL state: 55006

how can I force the delete/fix this error, of this database?

From stackoverflow
  • Quick fix in PgAdmin: just create another empty database. Select it. Delete the first one. Voila.

    You can also connect to the command line without selecting a specific database, and drop your database.

    The problem here is not that other users are connected to the database, but that you are.

    Milen A. Radev : "You can also connect to the command line without selecting a specific database, ..." - not true. Probably you're misled because when you start psql and do not specify a DB name psql tries to connect to a DB named after the user you have specified (or the system user if that's missing too).
  • Instead of creating new database he can simply connect to postgres database, which is created by default in all new PostgreSQL installations. And even if it is not there - template1 should be always there.

0 comments:

Post a Comment