question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

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:closed
  • Created 10 years ago
  • Comments:9 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
artscoopcommented, Oct 25, 2015

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 ?

0reactions
camilonovacommented, Apr 9, 2015

ok, then is not an issue.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found