此条目涉及一个 PostgreSQL 功能,该功能已弃用,并可能在未来的版本中不再支持。
txid_current() 是一个已弃用的系统函数,用于返回当前的事务 ID。
txid_current() 在 PostgreSQL 8.3 中添加。
用法
txid_current () → bigint
txid_current() 以 bigint 类型返回当前的事务 ID。请注意,如果当前事务当前没有事务 ID,则会为其分配一个新的事务 ID。
此函数在 PostgreSQL 13 中引入 xid8 数据类型后被弃用,并被 pg_current_xact_id() 取代。
变更历史
- PostgreSQL 13
- 标记为已弃用 (commit 4c04be9b)
- PostgreSQL 8.3
- 添加于 (commit 18e3fcc3)
示例
txid_current() 的基本用法示例
postgres=# SELECT txid_current();
txid_current
--------------
737
(1 row)
参考资料
- PostgreSQL 文档: 已弃用的事务 ID 和快照信息函数
