COMMIT_PREPARED(7pg14)

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

πŸŽ€ NAME πŸŽ€

COMMIT_PREPARED β€” commit a transaction that was earlier prepared for two-phase commit. This is the COMMIT_PREPARED(7pg14) page β€” aka the COMMIT PREPARED(7) manual page β€” from the PostgreSQL 14.24 docs, and it's lowkey iconic for wrapping up a prepared transaction. πŸ’…

✨ SYNOPSIS ✨

COMMIT PREPARED transaction_id

πŸ’– DESCRIPTION πŸ’–

COMMIT PREPARED commits a transaction that is in prepared state. That's the whole vibe: you prepared it earlier for two-phase commit, and now you're saying β€œokay bestie, make it official.” 🫢

🌸 PARAMETERS 🌸

  • transaction_id β€” the transaction identifier of the transaction that is to be committed. It's basically the name tag for the prepared transaction you're committing. πŸŽ€

πŸ”₯ NOTES πŸ”₯

okay so real talk, here's the tea:

  • 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. Session independence ate, honestly. ✨
  • Transaction-block boundary: This command cannot be executed inside a transaction block. The prepared transaction is committed immediately. 🚨
  • All currently available prepared transactions are listed in the pg_prepared_xacts system view. That's your guest list, bestie. πŸ‘‘

πŸ¦‹ 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. So yeah: PostgreSQL-specific behavior, no cap. πŸ’―

πŸ‘‘ SEE ALSO πŸ‘‘


okay bye bestie, that's the whole page πŸ’– this one is from PostgreSQL 14.24, dated 2026, and yes the COMMIT PREPARED(7) manual page is slaying in the most two-phase-commit way possible. ✨

πŸ“¦ where this page comes from