ROLLBACK_PREPARED(7pg13)

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

πŸ’… ROLLBACK PREPARED(7) β€” the prepared-transaction undo button πŸ’…

okay so this is the ROLLBACK_PREPARED(7pg13) page, straight from the PostgreSQL 13.23 Documentation. she's giving official docs but make it group chat. πŸ’–

✨ NAME ✨

ROLLBACK_PREPARED β€” cancel a transaction that was earlier prepared for two-phase commit. no cap, that's the whole name vibe. 🫢

πŸŽ€ SYNOPSIS πŸŽ€

ROLLBACK PREPARED transaction_id

🌸 DESCRIPTION 🌸

okay so ROLLBACK PREPARED rolls back a transaction that is in prepared state. that's it. that's the assignment. πŸ’…

πŸ¦‹ PARAMETERS πŸ¦‹

  • transaction_id β€” the transaction identifier of the transaction that is to be rolled back. literally which prepared transaction you're rolling back. πŸ•³οΈ

πŸ”₯ NOTES πŸ”₯

  • 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. bestie can be elsewhere. 🫢
  • this command cannot be executed inside a transaction block. nope. not allowed. the prepared transaction is rolled back immediately. no waiting around. ⚑
  • all currently available prepared transactions are listed in the pg_prepared_xacts system view. that's your little directory of prepared-transaction girlies. πŸ‘‘
warning bestie: don't try to run this inside a transaction block β€” it's literally not allowed. πŸ™ˆ

πŸ“ EXAMPLES πŸ“

roll back the transaction identified by the transaction identifier foobar:

ROLLBACK PREPARED 'foobar';

🌈 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, standards girlies exist but the SQL part is not giving standardized. iykyk. πŸ’€

πŸ‘‘ SEE ALSO πŸ‘‘

these are your besties for the two-phase commit saga. go read them. πŸ“š

mwah πŸ’‹ β€” this page is from PostgreSQL 13.23, dated 2025. periodt. πŸŽ€

πŸ“¦ where this page comes from