Rolls back the current transaction.

Syntax

ROLLBACK [ WORK ]

Description

You can use the ROLLBACK command to roll back the current transaction and discard all the updates made by the transaction.

Parameters

ParameterDescription
Parameter Description
WORK An optional keyword, which has no effect.

Notes

You can use the COMMIT command to end a transaction.

If you run ROLLBACK at a time point which is not in a transaction, no changes are made.

Notice
If an Oracle-style SPL procedure exists on the runtime stack, an error occurs when you run a ROLLBACK command in a PL/pgSQL procedure.

Examples

Roll back all changes:

ROLLBACK;