COMMIT

A command for committing the current transaction

COMMIT is a transaction command for committing the current transaction.

COMMIT has always been present in PostgreSQL.

Change history

Examples

Basic execution of COMMIT:

postgres=# BEGIN;
BEGIN

postgres=*# SELECT 1;
 ?column? 
----------
        1
(1 row)

postgres=*# COMMIT;
COMMIT

Used with AND CHAIN syntax (PostgreSQL 12 and later):

postgres=# BEGIN;
BEGIN

postgres=*# SELECT 1;
 ?column?
----------
        1
(1 row)

postgres=*# COMMIT AND CHAIN;
COMMIT

postgres=*# SELECT 2;
 ?column?
----------
        2
(1 row)
postgres=*# COMMIT; COMMIT
  • PostgreSQL documentation: COMMIT

Categories

SQL command, Transaction command, Transactions

See also

BEGIN, ROLLBACK, END