Postgresql 中文操作指南

ROLLBACK PREPARED

ROLLBACK PREPARED — 取消先前为两阶段提交准备好的事务

ROLLBACK PREPARED — cancel a transaction that was earlier prepared for two-phase commit

Synopsis

ROLLBACK PREPARED transaction_id

Description

ROLLBACK PREPARED 回滚处于准备状态的事务。

ROLLBACK PREPARED rolls back a transaction that is in prepared state.

Parameters

  • transaction_id

    • The transaction identifier of the transaction that is to be rolled back.

Notes

要回滚已准备好的事务,你必须是执行了事务的同一用户,或者是超级用户。但你无需在执行事务的同一会话中进行操作。

To roll back a prepared transaction, you must be either the same user that executed the transaction originally, or a superuser. But you do not have to be in the same session that executed the transaction.

该命令无法在事务块中执行。已准备好的事务将立即回滚。

This command cannot be executed inside a transaction block. The prepared transaction is rolled back immediately.

所有当前可用的准备好的事务都会被列在 pg_prepared_xacts 系统视图中。

All currently available prepared transactions are listed in the pg_prepared_xacts system view.

Examples

回滚由事务标识符 foobar 标识的事务:

Roll back the transaction identified by the transaction identifier foobar:

ROLLBACK PREPARED 'foobar';

Compatibility

ROLLBACK PREPARED 是 PostgreSQL 扩展。它旨在供外部事务管理系统使用,其中一些系统涵盖在标准中(如 X/Open XA),但这些系统的 SQL 端尚未标准化。

ROLLBACK PREPARED is a PostgreSQL extension. It is intended for use by external transaction management systems, some of which are covered by standards (such as X/Open XA), but the SQL side of those systems is not standardized.