如何检查PostgreSQL事务中的挂起操作 [英] How to check for pending operations in a PostgreSQL transaction
问题描述
我在PostgreSQL上有一个会话(SQLAlchemy),有一个活跃的未提交事务。我刚刚将会话传递给可能已发出SQL INSERT
/ UPDATE
/ <$的某些调用树c $ c> Delete 语句,通过 sqlalchemy.orm
或直接通过基础连接。
I have a session (SQLAlchemy) on PostgreSQL, with an active uncommitted transaction. I have just passed the session to some call tree that may or may not have issued SQL INSERT
/UPDATE
/DELETE
statements, through sqlalchemy.orm
or directly through the underlying connection.
是否可以检查此事务中是否有任何待处理的数据修改语句?即
Is there a way to check whether there are any pending data-modifying statements in this transaction? I.e. whether commit would be a no-op or not, and whether rollback would discard something or not?
我已经看到人们指出了 v $ Oracle中的事务
(请参见这个SO问题)。我正在寻找与PostgreSQL相似的东西。
I've seen people point out v$transaction
in Oracle for the same thing (see this SO question). I'm looking for something similar to use on PostgreSQL.
推荐答案
首先进入系统视图pg_locks。
Start by checking into system view pg_locks.
http:// www .postgresql.org / docs / 8.4 / interactive / view-pg-locks.html
这篇关于如何检查PostgreSQL事务中的挂起操作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!