ROLLBACK(7)

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

πŸ’… ROLLBACK(7) β€” the "nvm, undo it" command

okay bestie, so this is the ROLLBACK page from the PostgreSQL 17.11 Documentation β€” it's manual page ROLLBACK(7) and it's about the moment you realize your transaction was a mistake 🫢


✨ NAME ✨

ROLLBACK β€” abort the current transaction, aka the group-chat "unsend" of the SQL world 😭


πŸŽ€ SYNOPSIS πŸŽ€

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

🌸 DESCRIPTION 🌸

ROLLBACK rolls back the current transaction and causes all the updates made by the transaction to be discarded. like, all of them. gone. poof. it's giving "we're pretending that never happened" πŸ’€βœ¨


πŸ¦‹ PARAMETERS πŸ¦‹

  • WORK, TRANSACTION β€” optional key words. they have no effect whatsoever. pure decoration, no cap. πŸ’…
  • AND CHAIN β€” if AND CHAIN is specified, a new (not aborted) transaction is immediately started with the same transaction characteristics (see SET TRANSACTION (SET_TRANSACTION(7))) as the just finished one. otherwise, no new transaction is started. so it's like "undo that, but immediately open a fresh one with the same settings" β€” main character energy πŸ‘‘

πŸ’œ NOTES πŸ’œ

  • Use COMMIT to successfully terminate a transaction. that's the "yes queen, keep it" button 🌈
  • Issuing ROLLBACK outside of a transaction block emits a warning and otherwise has no effect. so it's just... shouting into the void πŸ™ˆ
  • ROLLBACK AND CHAIN outside of a transaction block is an error. not a warning, an actual error. respect the boundaries fr fr

πŸ”₯ EXAMPLES πŸ”₯

to abort all changes:

ROLLBACK;

that's it. that's the whole example. iconic.


⭐ COMPATIBILITY ⭐

The command ROLLBACK conforms to the SQL standard. the form ROLLBACK TRANSACTION is a PostgreSQL extension. so ROLLBACK TRANSACTION is the homegrown upgrade, iykyk 🧚


πŸ‘‘ SEE ALSO πŸ‘‘

BEGIN(7), COMMIT(7), ROLLBACK TO SAVEPOINT (ROLLBACK_TO_SAVEPOINT(7))


and that's the whole page, bestie πŸ“ this one's from PostgreSQL 17.11, dated 2026, and it lives as manual page ROLLBACK(7) β€” go forth and undo your mistakes responsibly πŸ’–βœ¨

πŸ“¦ where this page comes from