ROLLBACK(7)
πΈ 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β ifAND CHAINis specified, a new (not aborted) transaction is immediately started with the same transaction characteristics (seeSET 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 π§
BEGIN(7)COMMIT(7)ROLLBACK TO SAVEPOINT(ROLLBACK_TO_SAVEPOINT(7))
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
- opensuse-leap 16.0: postgresql16 16.15-160000.1.1 Β· PostgreSQL
- opensuse-leap 16.0: postgresql16 16.15-160000.1.1 Β· PostgreSQL
- opensuse-leap 16.0: postgresql16 16.15-160000.1.1 Β· PostgreSQL
- opensuse-leap 16.0: postgresql16 16.15-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