txid_status()

报告事务提交状态的函数
此条目涉及一个 PostgreSQL 功能,该功能已弃用,并可能在未来的版本中不再支持。

txid_status() 是一个已弃用的系统函数,用于报告近期事务的提交状态。

txid_status()PostgreSQL 8.3 中添加。

用法

txid_status ( bigint ) → text

txid_status() 返回以下值之一:

  • committed(已提交)
  • in progress(进行中)
  • aborted(已中止)

PostgreSQL 13 中引入 xid8 数据类型后,此函数已被弃用,并被 pg_xact_status() 取代。

变更历史

示例

txid_status() 的基本用法示例

postgres=# BEGIN ;
BEGIN

postgres=*# SELECT txid_current();
 txid_current 
--------------
          757
(1 row)

postgres=*# SELECT txid_status(757);
 txid_status 
-------------
 in progress
(1 row)

postgres=*# COMMIT;
COMMIT

postgres=# SELECT txid_status(757);
 txid_status 
-------------
 committed
(1 row)

尝试检索尚未发生的事务的状态

postgres=# SELECT txid_status(9999);
ERROR:  transaction ID 9999 is in the future

分类

已弃用, 系统函数, 事务

另请参阅

pg_xact_status()

反馈

请在此处提交关于“txid_status()”的任何评论、建议或更正。此处