Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Django+Postgres: "current transaction is aborted, commands ignored until end of transaction block"

I've started working on a Django/Postgres site. Sometimes I work in manage.py shell, and accidentally do some DB action that results in an error. Then I am unable to do any database action at all, because for any database action I try to do, I get the error:

current transaction is aborted, commands ignored until end of transaction block 

My current workaround is to restart the shell, but I should find a way to fix this without abandoning my shell session.

(I've read this and this, but they don't give actionable instructions on what to do from the shell.)

like image 785
Ram Rachum Avatar asked Oct 13 '11 10:10

Ram Rachum


1 Answers

You can try this:

from django.db import connection connection._rollback() 

The more detailed discussion of This issue can be found here

like image 162
Vsevolod Dyomkin Avatar answered Oct 06 '22 04:10

Vsevolod Dyomkin