↑↓ select↵ open⌫ change scopeOpen full search

PG.CENTER connects PostgreSQL documentation, reference, and ecosystem knowledge. Maintained by Pigsty.

Wiki / SQL Commands

COMMIT

commit the current transaction

English manual coverage begins with PostgreSQL 6.4. Source history and runtime observations have their own recorded version boundaries.

Reading PG 18·Select a recorded version

anchor
SQL-COMMIT
file
sql-commit.html
lang
en
name
COMMIT
purpose
commit the current transaction
purpose zh
提交当前事务
sections same as
Unknown
slug
18
synopsis html
COMMIT [ WORK | TRANSACTION ] [ AND [ NO ] CHAIN ]
synopsis text
COMMIT [ WORK | TRANSACTION ] [ AND [ NO ] CHAIN ]

Syntax

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

Read left to right. Branches are choices, bypasses are optional, loops repeat. Select an underlined parameter to open its rule.

COMMIT WORK TRANSACTION AND NO CHAIN

Definition PG 18

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

Description

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

Use ROLLBACK to abort a transaction.

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

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

See Also

BEGIN, ROLLBACK

Compare versions

Source references

Full definition and evidence JSON

Definition sources

center · PostgreSQL 18 · wiki-repair-20261023:c4ff61729453aac4f49f3256970b48ab70730c606161f4c80b6283e7f84e5a57

Text language: en · wiki-repair-20261023:c4ff61729453aac4f49f3256970b48ab70730c606161f4c80b6283e7f84e5a57