ROLLBACK(7)

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

πŸ’… NAME πŸ’…

okay bestie, welcome to ROLLBACK(7) from the PostgreSQL 15.19 Documentation ✨ this one is literally about aborting the current transaction 🫢

🌸 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. it's giving β€œundo era” and honestly? iconic πŸ’–

πŸ¦‹ PARAMETERS πŸ¦‹

  • WORK, TRANSACTION β€” optional key words, bestie. they have no effect. literally just vibes ✨
  • AND CHAIN β€” if AND CHAIN is specified, a new 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. periodt πŸ’…

πŸ”₯ NOTES πŸ”₯

use COMMIT to successfully terminate a transaction πŸ‘‘

issuing ROLLBACK outside of a transaction block emits a warning and otherwise has no effect. no cap.

🚨 ROLLBACK AND CHAIN outside of a transaction block is an error. not a vibe, fr fr 😭

🌈 EXAMPLES 🌈

to abort all changes:

ROLLBACK;

⭐ COMPATIBILITY ⭐

the command ROLLBACK conforms to the SQL standard. the form ROLLBACK TRANSACTION is a PostgreSQL extension πŸ‘‘

πŸ’œ SEE ALSO πŸ’œ


signing off with PostgreSQL 15.19 Documentation energy, dated 2026 β€” mwah, slay, bye bestie πŸŽ€πŸ’‹πŸ«Ά

πŸ“¦ where this page comes from