Postgresql 中文操作指南

ABORT

ABORT — 中止当前事务

ABORT — abort the current transaction

Synopsis

ABORT [ WORK | TRANSACTION ] [ AND [ NO ] CHAIN ]

Description

ABORT 回滚当前事务,并导致事务做出的所有更新都被丢弃。此命令的行为与标准 SQL 命令 ROLLBACK 相同,仅出于历史原因而使用。

ABORT rolls back the current transaction and causes all the updates made by the transaction to be discarded. This command is identical in behavior to the standard SQL command ROLLBACK, and is present only for historical reasons.

Parameters

  • WORK__TRANSACTION

    • Optional key words. They have no effect.

  • AND CHAIN

    • If AND CHAIN is specified, a new transaction is immediately started with the same transaction characteristics (see SET TRANSACTION) as the just finished one. Otherwise, no new transaction is started.

Notes

使用 COMMIT 成功结束一个事务。

Use COMMIT to successfully terminate a transaction.

在事务块外部发出 ABORT 会发出警告,否则没有影响。

Issuing ABORT outside of a transaction block emits a warning and otherwise has no effect.

Examples

中止所有更改:

To abort all changes:

ABORT;

Compatibility

此命令是出于历史原因而存在的 PostgreSQL 扩展。 ROLLBACK 是等效的标准 SQL 命令。

This command is a PostgreSQL extension present for historical reasons. ROLLBACK is the equivalent standard SQL command.

See Also