ROLLBACK(7)
π ROLLBACK π
okay so bestie, welcome to the ROLLBACK page β it's a PostgreSQL 14.24 classic and honestly it's giving "undo button of the soul" energy. No cap, this one's short but iconic.
β¨ 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. that's it. that's the whole vibe. everything you did in there? gone. poof. π
like literally, it undoes the entire transaction β every change gets tossed. main character energy for the undo.
πΈ PARAMETERS πΈ
WORKTRANSACTION
these two are optional key words and they have no effect whatsoever. π«Ά they're just there. decorative. aesthetic. they do nothing and honestly? relatable.
AND CHAIN
if you specify AND CHAIN, a new transaction is immediately started with the same transaction characteristics as the one that just finished (see SET TRANSACTION β that's SET_TRANSACTION(7) if you wanna look it up π). otherwise, no new transaction is started. so like, chain = you're immediately back in another transaction with the same settings. no chain = you're free, you're outside, you're unbothered. β¨
π NOTES π
use COMMIT to successfully terminate a transaction. that's the "yay we did it, keep the changes" sibling. π
ngl this next bit matters: issuingROLLBACKoutside of a transaction block emits a warning and otherwise has no effect. andROLLBACK AND CHAINoutside of a transaction block is an error β not a warning, an actual error. so like, know where you are before you start rolling back, bestie. π
π EXAMPLES π
to abort all changes:
ROLLBACK;
that's it. one line. bye. ππ
β COMPATIBILITY β
the command ROLLBACK conforms to the SQL standard, slay. π
but heads up β the form ROLLBACK TRANSACTION is a PostgreSQL extension. so that one's a Postgres-only little treat, iykyk. π§
π₯ SEE ALSO π₯
BEGIN(7), COMMIT(7), ROLLBACK TO SAVEPOINT β that's ROLLBACK_TO_SAVEPOINT(7) π¦
this has been PostgreSQL 14.24, dated 2026 β ROLLBACK documentation, rewritten with love π«Άπ mwah, go forth and undo responsibly β¨
π¦ where this page comes from
- opensuse-leap 16.0: postgresql14 14.24-160000.1.1 Β· PostgreSQL
- opensuse-leap 16.0: postgresql14 14.24-160000.1.1 Β· PostgreSQL
- opensuse-leap 16.0: postgresql14 14.24-160000.1.1 Β· PostgreSQL
- opensuse-leap 16.0: postgresql14 14.24-160000.1.1 Β· PostgreSQL
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms