COMMIT_PREPARED(7pg17)

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

πŸ’… COMMIT PREPARED πŸ’…

okay so bestie, welcome to COMMIT PREPARED β€” a PostgreSQL 17.11 manpage and honestly? it's giving "closing the deal" energy. this is the command you run when a transaction was already prepared earlier for two-phase commit and now you're finally like. yeah. let's make it official. ✨


🌸 SYNOPSIS 🌸

COMMIT PREPARED transaction_id

πŸŽ€ DESCRIPTION πŸŽ€

COMMIT PREPARED commits a transaction that is in prepared state. that's it, that's the whole vibe β€” it takes a transaction that's been sitting there all prepared and says "go, you're done, slay." πŸ’–


πŸ¦‹ PARAMETERS πŸ¦‹

  • transaction_id β€” the transaction identifier of the transaction that is to be committed. yes, that one. the one you're committing. 🫢

✨ NOTES ✨

okay real talk, a few things you need to know:

  • to commit a prepared transaction, you must be either the same user that executed the transaction originally, or a superuser. but β€” and this is the cute part β€” you do not have to be in the same session that executed the transaction. different session, same energy. πŸ’…
  • this command cannot be executed inside a transaction block. nope. not allowed. the prepared transaction is committed immediately. no nesting, no take-backs.
  • all currently available prepared transactions are listed in the pg_prepared_xacts system view β€” that's your little directory of everything currently in prepared-limbo, iykyk. πŸ”₯

🌈 EXAMPLES 🌈

commit the transaction identified by the transaction identifier foobar β€” literally just:

COMMIT PREPARED 'foobar';

and boom. done. iconic. ⭐


πŸ‘‘ COMPATIBILITY πŸ‘‘

COMMIT 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... don't go expecting this exact thing everywhere, bestie. πŸ™ˆ


πŸ’œ SEE ALSO πŸ’œ


and that's the page! πŸŽ€ written for PostgreSQL 17.11, dated 2026 β€” mwah, go commit something responsibly πŸ’‹πŸŒΈ

πŸ“¦ where this page comes from