ROLLBACK_PREPARED(7pg17)

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

πŸ¦‹ NAME πŸ¦‹

Okay bestie, welcome to ROLLBACK PREPARED(7) β€” aka the ROLLBACK_PREPARED(7pg17) page β€” the manual for ROLLBACK PREPARED. It cancels a transaction that was earlier prepared for two-phase commit. Periodt. πŸ’…


✨ SYNOPSIS ✨

ROLLBACK PREPARED transaction_id

🌸 DESCRIPTION 🌸

ROLLBACK PREPARED rolls back a transaction that is in prepared state. That’s the tea, no cap. 🫢


πŸŽ€ PARAMETERS πŸŽ€

  • transaction_id β€” the transaction identifier of the transaction that is to be rolled back. Literally the name-tag for the prepared transaction you’re sending home. 🏠

πŸ”₯ NOTES πŸ”₯

  • 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. Different session? Fine. Different user? Only if you’re a superuser. πŸ‘‘
  • This command cannot be executed inside a transaction block. Not me trying to nest this β€” it’s a no. πŸ™ˆ The prepared transaction is rolled back immediately.
  • All currently available prepared transactions are listed in the pg_prepared_xacts system view. That’s your little guest list, iykyk. πŸ“‹
⚠️ Friendly lil warning: no transaction block for this one β€” it has main character energy and has to run on its own.

πŸ“ EXAMPLES πŸ“

Roll back the transaction identified by the transaction identifier foobar:

ROLLBACK PREPARED 'foobar';

Slay. That’s the whole example. πŸ’–


🌈 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 it’s giving β€œvery useful, but not standardized SQL-side,” fr fr. ✨


πŸ‘€ SEE ALSO πŸ‘€


That’s the whole page, bestie β€” brought to you by PostgreSQL 17.11, dated 2026. Iconic source/version energy, mwah πŸ’œπŸŽ€

πŸ“¦ where this page comes from