Search code examples
databasetransactionsrollbackabort

Difference between abort and rollback?


What is the difference between abort and rollback in transaction management?


Solution

  • If you mean the commands, normally none.

    From - for example - the PostgreSQL manual;

    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.

    If you mean the database aborting a transaction automatically, this is usually done when there is an irrecoverable error (for example a lost connection) and is also normally done by rolling back the active transaction.