reset_db: OperationalError: cannot drop the currently open database
See original GitHub issue#73 was marked as closed with the instruction to reopen if the issue still exists.
I ran into the issue today with the latest form PIP using a postgresql database with the following in settings.py:
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.postgresql_psycopg2',
'NAME': '***_db',
'USER': '***_admin',
'PASSWORD': '***',
}
}
running the following command:
$ python manage.py reset_db --router=default
You have requested a database reset.
This will IRREVERSIBLY DESTROY
ALL data in the database "diyatm_db".
Are you sure you want to do this?
Type 'yes' to continue, or 'no' to cancel: yes
OperationalError: cannot drop the currently open database
Issue Analytics
- State:
- Created 10 years ago
- Comments:9 (5 by maintainers)
Top Results From Across the Web
pq: cannot drop the currently open database - Stack Overflow
Because, you are trying to execute dropDb command on database, to which you have open connection. According to postgres documentation: You cannot be ......
Read more >ERROR: cannot drop the currently open database – PostgreSQL
If you are using PostgreSQL 13 or above, you have an option to drop the database with force now. You may drop the...
Read more >Force drop db while others may be connected
Now using plain database client you can force drop database using three simple steps: Make sure no one can connect to this database....
Read more >Postgres: cannot drop the currently open database : DBE-6884
When selecting a database on my local postgres server in the database view on the right i cannot drop the selected database by...
Read more >airflow already exist in the db - You.com | The AI Search ...
Sqlite3, OperationalError: unable to open database file ... Although not through initdb or resetdb adding CampaignModel.__table__.create(settings.engine, ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
For the record, I could locate what was causing the lock at the time: it was a call to
django.core.urlresolvers.reverse
in middleware that is to say, nothing to do with the database.Now the lock is happening again, and I cannot find what is causing it in my project. Maybe django_extensions could “force-drop” active connections before resetting ?
ok, then is not an issue.