我收到了很多错误消息:
"DatabaseError: current transaction is aborted, commands ignored until end of transaction block"
从 python-psycopg 更改为 python-psycopg2 作为 Django 项目的数据库引擎之后。
代码保持不变,只是不知道那些错误来自哪里。
最佳答案
当查询产生错误并且您尝试运行另一个查询而不首先回滚事务时,这就是 postgres 所做的。 (您可能会将其视为一项安全功能,以防止您破坏数据。)
要解决此问题,您需要找出代码中执行错误查询的位置。使用 log_statement 可能会有所帮助和 log_min_error_statement您的 postgresql 服务器中的选项。
关于python - DatabaseError : current transaction is aborted, 命令在事务 block 结束之前被忽略?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2979369/