DatabaseError:当前事务中止,命令被忽略,直到事务块结束? [英] DatabaseError: current transaction is aborted, commands ignored until end of transaction block?
问题描述
该消息有很多错误:
"DatabaseError: current transaction is aborted, commands ignored until end of transaction block"
从Django项目的数据库引擎从python-psycopg更改为python-psycopg2.
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.
推荐答案
当查询产生错误并且您尝试运行另一个查询而不先回滚事务时,这就是postgres的工作. (您可能会认为这是一项安全功能,可防止您破坏数据.)
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.)
要解决此问题,您将希望找出代码中错误查询的执行位置.使用 log_statement 和 log_min_error_statement 您的Postgresql服务器中的选项.
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.
这篇关于DatabaseError:当前事务中止,命令被忽略,直到事务块结束?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!