ROLLBACK_PREPARED(7pg16)

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

πŸ’… NAME πŸ’…

Okay bestie, welcome to ROLLBACK PREPARED(7) from the PostgreSQL 16.15 Documentation β€” this is the page for ROLLBACK_PREPARED, and it's literally about how to cancel a transaction that was earlier prepared for two-phase commit. It's giving cleanup era, no cap. ✨

🫢 SYNOPSIS 🫢

ROLLBACK PREPARED transaction_id

🌸 DESCRIPTION 🌸

ROLLBACK PREPARED rolls back a transaction that is in prepared state. That's the whole job, and it ate. πŸ’…

πŸŽ€ PARAMETERS πŸŽ€

  • transaction_id β€” the transaction identifier of the transaction that is to be rolled back. Like, the exact name tag of the transaction you're sending home.

πŸ’€ NOTES πŸ’€

Real talk, bestie β€” here are the rules:

  • To roll back a prepared transaction, you must be either the same user that executed the transaction originally, or a superuser. But you do not have to be in the same session that executed the transaction. No cap.
  • This command cannot be executed inside a transaction block. The prepared transaction is rolled back immediately. 🚨
  • All currently available prepared transactions are listed in the pg_prepared_xacts system view. That's your lineup view. πŸ‘‘

πŸ”₯ EXAMPLES πŸ”₯

Roll back the transaction identified by the transaction identifier foobar:

ROLLBACK PREPARED 'foobar';

🌈 COMPATIBILITY 🌈

ROLLBACK PREPARED is a PostgreSQL extension. It is 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 yeah β€” extension behavior, not standardized SQL on that side. Periodt. πŸ¦‹

⭐ SEE ALSO ⭐

xoxo, your prepared-transaction bestie πŸ’– β€” this adorable page is from PostgreSQL 16.15 and dated 2026. periodt πŸŽ€

πŸ“¦ where this page comes from