COMMIT_PREPARED(7pg13)

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

okay bestie, welcome to the COMMIT PREPARED page from the PostgreSQL 13.23 docs, manual COMMIT_PREPARED(7pg13). this is the final-boss move for a transaction that’s already been prepared, and yes, it’s giving very much β€œclosing the loop” energy πŸ’…βœ¨

πŸ’– NAME πŸ’–

COMMIT PREPARED β€” commit a transaction that was earlier prepared for two-phase commit. literally the β€œokay we’re actually doing this” button for a prepared transaction 🫢

✨ SYNOPSIS ✨

COMMIT PREPARED transaction_id

πŸ¦‹ DESCRIPTION πŸ¦‹

COMMIT PREPARED commits a transaction that is in prepared state. no cap, that’s the whole vibe: prepared transaction goes in, committed transaction comes out πŸ’–

🌸 PARAMETERS 🌸

  • transaction_id β€” the transaction identifier of the transaction that is to be committed. yes bestie, you gotta name the exact transaction you’re committing πŸŽ€

πŸ”₯ NOTES πŸ”₯

  • to commit 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 πŸ‘‘
  • this command cannot be executed inside a transaction block. nope, not allowed. the prepared transaction is committed immediately ⚑
  • all currently available prepared transactions are listed in the pg_prepared_xacts system view. that’s your little guest list if you need to check who’s still waiting 🌈
⚠️ bestie, do not try to run this inside a transaction block. it is not that girl. the commit happens immediately.

πŸŽ€ EXAMPLES πŸŽ€

commit the transaction identified by the transaction identifier foobar:

COMMIT PREPARED 'foobar';

🌈 COMPATIBILITY 🌈

COMMIT 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. iykyk πŸ’«

πŸ‘‘ SEE ALSO πŸ‘‘


and that’s the whole page, bestie πŸ’œ brought to you by PostgreSQL 13.23, dated 2025, and the iconic little footer that is COMMIT PREPARED(7) πŸŽ€βœ¨

πŸ“¦ where this page comes from