ABORT

From PostgreSQL wiki

Revision as of 16:25, 9 June 2013 by Gvim (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Contents

ABORT

名字

ABORT -- 中止当前事务

语法概要
   ABORT [ WORK | TRANSACTION ]
描述

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.

参数
WORK
TRANSACTION
Optional key words. They have no effect.
可选的关键字,它们不产生作用。
注意

使用 COMMIT 命令提交一个成功的事务。Use COMMIT to successfully terminate a transaction.

如果不在事务内部发出 ABORT 不会有问题,但是会产生一个警告信息。Issuing ABORT when not inside a transaction does no harm, but it will provoke a warning message.

示例

中止所有变更:To abort all changes:

   ABORT;
兼容性

此命令是 PostgreSQL 基于历史原因做的扩展。 ROLLBACK 是 SQL 中等价的命令。This command is a PostgreSQL extension present for historical reasons. ROLLBACK is the equivalent standard SQL command.

参见

BEGIN, COMMIT, ROLLBACK

Personal tools