ROLLBACK(7)

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

🌸 NAME 🌸

ROLLBACK(7) β€” abort the current transaction. That's it, that's the whole job, and honestly? iconic. πŸ’… This page is from the PostgreSQL 16.15 docs, bestie. 🫢

✨ 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. translation: it's the undo button for the current transaction. all those updates? gone. discarded. not invited to the afterparty. 😭

πŸŽ€ PARAMETERS πŸŽ€

  • WORK β€” optional keyword. it has no effect. literally decorative. ✨
  • TRANSACTION β€” optional keyword. same deal: no effect. πŸ’…
  • 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. no cap, that's the whole rule. πŸ”₯

πŸ’– NOTES πŸ’–

Use COMMIT to successfully terminate a transaction. that's the "actually save it" bestie. βœ…

Issuing ROLLBACK outside of a transaction block emits a warning and otherwise has no effect. so: warning, then nothing. lowkey awkward. πŸ™ˆ

ROLLBACK AND CHAIN outside of a transaction block is an error. not a warning. an actual error. πŸ’€

🌈 EXAMPLES 🌈

To abort all changes:

ROLLBACK;

πŸ‘‘ COMPATIBILITY πŸ‘‘

The command ROLLBACK conforms to the SQL standard. The form ROLLBACK TRANSACTION is a PostgreSQL extension. so the first one is standard-coded, the second one is a PostgreSQL-only little extra. πŸŽ€

🧚 SEE ALSO 🧚


mwah πŸ’‹ this page is PostgreSQL 16.15, dated 2026, and it's the ROLLBACK(7) manual page. go forth and undo responsibly, bestie. periodt 🫢✨

πŸ“¦ where this page comes from