ABORT
abort 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-ABORT
- file
- sql-abort.html
- lang
- en
- name
- ABORT
- purpose
- abort the current transaction
- purpose zh
- 中止当前事务
- sections same as
- Unknown
- slug
- 18
- synopsis html
- ABORT [ WORK | TRANSACTION ] [ AND [ NO ] CHAIN ]
- synopsis text
- ABORT [ WORK | TRANSACTION ] [ AND [ NO ] CHAIN ]
Syntax
ABORT [ 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.
Definition PG 18
ABORT [ WORK | TRANSACTION ] [ AND [ NO ] CHAIN ]
Description
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.
Parameters
WORKTRANSACTIONOptional key words. They have no effect.
AND CHAINIf
AND CHAINis specified, a new transaction is immediately started with the same transaction characteristics (seeSET TRANSACTION) as the just finished one. Otherwise, no new transaction is started.
Notes
Use COMMIT to successfully terminate a transaction.
Issuing ABORT outside of a transaction block emits a warning and otherwise has no effect.
Examples
To abort all changes:
ABORT;
Compatibility
This command is a PostgreSQL extension present for historical reasons. ROLLBACK is the equivalent standard SQL command.
See Also
BEGIN, COMMIT, ROLLBACKCompare versions
Source references
Full definition and evidence JSON
Definition sources
center · PostgreSQL 18 · wiki-repair-20261023:65bde87269a7c42fac0c02ae4787003aa8850f937108ef30fc9a3b37b9c51413
Text language: en · wiki-repair-20261023:65bde87269a7c42fac0c02ae4787003aa8850f937108ef30fc9a3b37b9c51413