COMMIT_PREPARED(7pg17)
π 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_xactssystem 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 π
PREPARE TRANSACTION(PREPARE_TRANSACTION(7))ROLLBACK PREPARED(ROLLBACK_PREPARED(7))
and that's the page! π written for PostgreSQL 17.11, dated 2026 β mwah, go commit something responsibly ππΈ
π¦ where this page comes from
- opensuse-leap 16.0: postgresql17 17.11-160000.1.1 Β· PostgreSQL
- opensuse-leap 16.0: postgresql17 17.11-160000.1.1 Β· PostgreSQL
- opensuse-leap 16.0: postgresql17 17.11-160000.1.1 Β· PostgreSQL
- opensuse-leap 16.0: postgresql17 17.11-160000.1.1 Β· PostgreSQL
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms