Postgresql 中文操作指南

COMMIT

COMMIT — 提交当前事务

COMMIT — commit the current transaction

Synopsis

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

Description

COMMIT 提交当前事务。事务所做的所有更改对于其他人来说都已可见,并且在发生崩溃时会保证其持久性。

COMMIT commits the current transaction. All changes made by the transaction become visible to others and are guaranteed to be durable if a crash occurs.

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

使用 ROLLBACK 中止事务。

Use ROLLBACK to abort a transaction.

不在事务中时执行 COMMIT 不会造成危害,但会引发警告消息。不在事务中时执行 COMMIT AND CHAIN 是个错误。

Issuing COMMIT when not inside a transaction does no harm, but it will provoke a warning message. COMMIT AND CHAIN when not inside a transaction is an error.

Examples

若要提交当前事务并使所有更改永久化:

To commit the current transaction and make all changes permanent:

COMMIT;

Compatibility

命令 COMMIT 符合 SQL 标准。格式 COMMIT TRANSACTION 是 PostgreSQL 扩展。

The command COMMIT conforms to the SQL standard. The form COMMIT TRANSACTION is a PostgreSQL extension.

See Also