• Register
0 votes
148 views

Problem :

I am having hell lot of troubles because of below error message
internalerror: current transaction is aborted, commands ignored until end of transaction block
6.9k points

Please log in or register to answer this question.

1 Answer

0 votes

Solution :

To get rid of the your error, you need to roll back the last erroneous transaction after you have fixed your code.

e.g.
from django.db import transaction
transaction.rollback()

Now you can use try-except to prevent the error from occurring:

e.g.
from django.db import transaction, DatabaseError
try:
    a.save(
except DatabaseError:
    transaction.rollback()

38.6k points

Related questions

0 votes
1 answer 441 views
441 views
Problem : I am facing a lot of errors with the below message : “DatabaseError: current transaction is aborted, commands ignored until end of transaction block” Whenever I tried to change from the python-psycopg to the python-psycopg2 as my Django project's database engine. My code remains the same, just unable to know where those errors are coming from ?
asked Jan 4, 2020 alecxe 7.5k points
0 votes
1 answer 25 views
25 views
Problem: Has anyone had this complication before : Error: current transaction is aborted, commands ignored until end of transaction block?
asked Jun 13 Chi Omega 168k points
0 votes
1 answer 13 views
13 views
Problem: I tried to get executed with my except: statement... while attempt to oppose the functionality of UNIQUE constraint..But ended with exceptional error.. The Postgresql database table already contains the row that I have used, but it works well on inserting unrepeated ... fetchall() print(row) db=database() db.insert("The News","AparnaKumar",1995,234569654) db.view() db.search(year=1995)
asked Apr 24 munim01 21k points
0 votes
1 answer 7 views
7 views
Problem: Error: pg_config executable not found?
asked Jul 25 Nahil 128k points
0 votes
1 answer 11 views
11 views
Problem: Duplicate key value violates unique constraint django
asked Jun 26 Shifa 18.2k points
0 votes
1 answer 29 views
29 views
Problem: Where can I get help: Django.db .utils.operationalerror: could not connect to server: connection refused
asked Jun 14 nila 121k points
0 votes
1 answer 498 views
498 views
Problem : I am not very sure how can I fix the below issue I have really no idea about why am I facing below error while trying to do the runserver: Performing system checks... System check identified no issues (0 silenced). Unhandled exception in thread ... server: No such file or directory Is the server running locally and accepting connections on Unix domain socket "/tmp/.s.PGSQL.5432"?
asked Dec 25, 2019 alecxe 7.5k points
0 votes
1 answer 67 views
67 views
Problem: I need someone’s help to fix it .. error pg_config executable not found
asked Mar 19 Ifra 43.4k points
0 votes
1 answer 94 views
94 views
Problem: The current path, account/login/, didn't match any of these?What is the problem here?. The redirect works, I have a feeling its in urlpatterns but cannot for the life figure it out. Driving me crazy today. Thanks for the help and sorry for the essay!
asked May 4 sumaiya simi 43.9k points
0 votes
1 answer 288 views
288 views
Problem: Facing this error message: Unchecked runtime.lasterror: could not establish connection. receiving end does not exist.
asked Mar 14 Wafa Abu Yousef 6.1k points