Postgresql 中文操作指南

COMMIT PREPARED

COMMIT PREPARED — 提交一个先前准备好的两阶段提交事务

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

Synopsis

COMMIT PREPARED transaction_id

Description

COMMIT PREPARED 提交处于准备状态的事务。

COMMIT PREPARED commits a transaction that is in prepared state.

Parameters

  • transaction_id

    • The transaction identifier of the transaction that is to be committed.

Notes

要提交准备好的事务,您必须是最初执行该事务的同一位用户或超级用户。但是,您不必在执行该事务的同一个会话中。

To commit 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 committed immediately.

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

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

Examples

使用事务标识符 foobar 来提交事务:

Commit the transaction identified by the transaction identifier foobar:

COMMIT PREPARED 'foobar';

Compatibility

COMMIT PREPARED 是一个 PostgreSQL 扩展。它用于外部事务管理系统,其中一些系统受标准(例如 X/Open XA)的约束,但这些系统的 SQL 部分没有标准化。

COMMIT 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.