ABORT(7)

πŸ“¦ version 17.11, in opensuse-leap 16.0

πŸ’… ABORT(7) πŸ’…

okay so welcome to the ABORT(7) page from the PostgreSQL 17.11 Documentation, bestie πŸ’–. This is the one about aborting the current transaction, and yes, it's giving β€œnope, we're undoing that” energy.


🌸 NAME 🌸

ABORT β€” abort the current transaction. That's it. That's the name. Slay.

✨ SYNOPSIS ✨

ABORT [ WORK | TRANSACTION ] [ AND [ NO ] CHAIN ]

Yes bestie, copy it exactly like that. The [ NO ] is literally in the synopsis, iykyk πŸ‘‘

πŸ¦‹ DESCRIPTION πŸ¦‹

ABORT rolls back the current transaction and causes all the updates made by the transaction to be discarded. So all those changes? Gone. Discarded. Not invited to the afterparty 😭.

This command is identical in behavior to the standard SQL command ROLLBACK, and it's present only for historical reasons. So it's basically the historical bestie of ROLLBACK β€” same behavior, different name, iconic really.

πŸŽ€ PARAMETERS πŸŽ€

  • WORK β€” optional key word, and it has no effect. Like, none. Zero. It's just there.
  • TRANSACTION β€” another optional key word, also with no effect. Same vibe, bestie.
  • AND CHAIN β€” if AND CHAIN is specified, a new transaction is immediately started with the same transaction characteristics (see SET TRANSACTION) as the just finished one. Otherwise, no new transaction is started. Periodt.
also the synopsis has [ NO ] sitting inside [ AND [ NO ] CHAIN ]; the parameters section only explains AND CHAIN, so I'm not inventing extra lore for NO, bestie πŸ’…

πŸ”₯ NOTES πŸ”₯

  • Use COMMIT to successfully terminate a transaction. That's the β€œwe're keeping this” button.
  • Issuing ABORT outside of a transaction block emits a warning and otherwise has no effect. So if you're not in a transaction block, it's just gonna warn and vibe, with no actual rollback.

πŸ’– EXAMPLES πŸ’–

To abort all changes:

ABORT;

That's the whole example. Short, sweet, devastating for those updates πŸ’€

πŸ‘‘ COMPATIBILITY πŸ‘‘

This command is a PostgreSQL extension present for historical reasons. ROLLBACK is the equivalent standard SQL command. So if you're being all standard-SQL about it, ROLLBACK is your girl.

🌈 SEE ALSO 🌈


mwah πŸ’‹ β€” that's the PostgreSQL 17.11 page from 2026, for ABORT(7). Now go forth and roll back responsibly, bestie 🫢✨

πŸ“¦ where this page comes from