Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

DatabaseError: current transaction is aborted, commands ignored until end of transaction block?

I got a lot of errors with the message :

"DatabaseError: current transaction is aborted, commands ignored until end of transaction block" 

after changed from python-psycopg to python-psycopg2 as Django project's database engine.

The code remains the same, just don't know where those errors are from.

like image 448
jack Avatar asked Jun 05 '10 06:06

jack


People also ask

Which syntax is used to abort the current transaction in postgresql?

Use COMMIT to successfully terminate a transaction. Issuing ABORT outside of a transaction block emits a warning and otherwise has no effect.

What is rollback in postgresql?

The ROLLBACK command is the transactional command used to undo transactions that have not already been saved to the database. The ROLLBACK command can only be used to undo transactions since the last COMMIT or ROLLBACK command was issued.


1 Answers

This is what postgres does when a query produces an error and you try to run another query without first rolling back the transaction. (You might think of it as a safety feature, to keep you from corrupting your data.)

To fix this, you'll want to figure out where in the code that bad query is being executed. It might be helpful to use the log_statement and log_min_error_statement options in your postgresql server.

like image 79
ʇsәɹoɈ Avatar answered Sep 27 '22 18:09

ʇsәɹoɈ