ROLLBACK_PREPARED(7)
💅 ROLLBACK_PREPARED 💅
okay bestie, welcome to the ROLLBACK_PREPARED page — it's part of the PostgreSQL 18.6 docs and it's literally the "jk never mind" button for two-phase commit. let's get into it 🫶
✨ NAME ✨
ROLLBACK_PREPARED — cancel a transaction that was earlier prepared for two-phase commit 🚫💫
✨ SYNOPSIS ✨
ROLLBACK PREPARED transaction_id
✨ DESCRIPTION ✨
So here's the tea: ROLLBACK PREPARED rolls back a transaction that is in prepared state. that's it. that's the whole vibe. it takes that transaction that was all dressed up and ready for two-phase commit and goes "nvm girl, we're not doing this" 💀✨
✨ PARAMETERS ✨
transaction_id— the transaction identifier of the transaction that is to be rolled back. like, the name tag of the transaction you're un-inviting to the commit party 🎀
✨ NOTES ✨
okay important stuff, don't skip this part bestie, it's giving rules 😭
- To roll back a prepared transaction, you must be either the same user that executed the transaction originally, or a superuser. but plot twist — you do not have to be in the same session that executed the transaction. different session, same energy, it's fine 💅
This command cannot be executed inside a transaction block. and the prepared transaction is rolled back immediately. no waiting, no queueing, it's instant fr fr.
- All currently available prepared transactions are listed in the
pg_prepared_xactssystem view. that's your guest list, go check it 👑
✨ EXAMPLES ✨
Roll back the transaction identified by the transaction identifier foobar:
ROLLBACK PREPARED 'foobar';
slay. gone. bye felicia 🌸
✨ COMPATIBILITY ✨
ROLLBACK PREPARED is a PostgreSQL extension. it's intended for use by external transaction management systems, some of which are covered by standards (such as X/Open XA), but the SQL side of those systems is not standardized. so like, the vibes are standardized, the SQL is not. iykyk 🦋
✨ SEE ALSO ✨
PREPARE TRANSACTION(PREPARE_TRANSACTION(7))COMMIT PREPARED(COMMIT_PREPARED(7))
the whole two-phase commit friend group fr fr 🫶
and that's the page!! this was PostgreSQL 18.6, dated 2026, page ROLLBACK PREPARED(7) — mwah, go forth and un-prepare responsibly bestie 💖✨🎀
📦 where this page comes from
- alpine 3.23: postgresql18-doc 18.6-r0 · PostgreSQL
- alpine 3.24: postgresql18-doc 18.6-r0 · PostgreSQL
- arch rolling: postgresql 18.6-4 · PostgreSQL
- fedora 43: postgresql 18.6-1.fc43 · PostgreSQL
- fedora 43: postgresql 18.6-1.fc43 · PostgreSQL
- fedora 44: postgresql 18.6-1.fc44 · PostgreSQL
- fedora 44: postgresql 18.6-1.fc44 · PostgreSQL
- nixos 26.05: postgresql 18.6
- ubuntu resolute: postgresql-client-18 18.6-0ubuntu0.26.04.1 · PostgreSQL
- ubuntu stonking: postgresql-client-18 18.6-3build2 · PostgreSQL
- 💖 girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms