ABORT is a PostgreSQL-specific transaction control statement that cancels the current transaction and reverts the database to the state it was in before the corresponding BEGIN or START TRANSACTION. It performs the same action as ROLLBACK, but the keyword ABORT is retained for historical and internal consistency with PostgreSQL’s source code. When executed, all data modifications, locks, and sequence changes made within the transaction are undone, and all locks are released. ABORT has no effect when executed outside an open transaction block; PostgreSQL simply replies with a NOTICE and does nothing. Because ABORT discards every change made in the ongoing transaction, it should be issued whenever an unrecoverable error or business rule violation is detected before COMMIT.
BEGIN, COMMIT, ROLLBACK, SAVEPOINT, SET TRANSACTION
PostgreSQL 6.5
Nothing. Once a transaction is committed the changes are permanent, and ABORT has no active transaction to cancel.
No. The SQL standard defines ROLLBACK. ABORT is a PostgreSQL extension kept for backward compatibility.
Yes. All row and table locks acquired in the aborted transaction are released immediately after the command executes.
Yes. Sequence values advanced inside the same transaction are rolled back, so the next transaction will reuse those values if the sequence is declared as transactional.