COMMIT_PREPARED(7pg18)
๐ COMMIT PREPARED(7) ๐
okay bestie, welcome to the PostgreSQL 18.6 Documentation for COMMIT PREPARED โ it's the manual page, she's a whole queen, and she's about to explain how to actually finish a two-phase commit situation. no cap. let's go ๐ซถ
โจ NAME โจ
COMMIT_PREPARED โ commit a transaction that was earlier prepared for two-phase commit
๐ SYNOPSIS ๐
COMMIT PREPARED transaction_id
๐ธ DESCRIPTION ๐ธ
so like, COMMIT PREPARED commits a transaction that is in prepared state. that's it. that's the whole vibe. you prepared it earlier, and now you're saying "okay bestie, we're actually doing this" ๐
๐ฆ PARAMETERS ๐ฆ
transaction_idโ the transaction identifier of the transaction that is to be committed. that's the little name-tag your transaction is wearing. you need it. you can't just be like "commit the thing" and hope for the best ๐
๐ NOTES ๐
listen up, because this part matters fr fr:
- To commit a prepared transaction, you must be either the same user that executed the transaction originally, or a superuser. but โ plot twist โ you do not have to be in the same session that executed the transaction. so you can slide in from a whole different session and still handle it. main character energy โจ
- This command cannot be executed inside a transaction block. nope. not allowed. the prepared transaction is committed immediately โ no waiting, no queueing, it just happens โก
- All currently available prepared transactions are listed in the
pg_prepared_xactssystem view. that's your guest list, bestie โ go check who's still waiting to be committed ๐
๐ EXAMPLES ๐
Commit the transaction identified by the transaction identifier foobar:
COMMIT PREPARED 'foobar';
look at her go. 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 other databases to understand this. she's built different and she's proud of it ๐
๐ SEE ALSO ๐
PREPARE TRANSACTION(PREPARE_TRANSACTION(7))ROLLBACK PREPARED(ROLLBACK_PREPARED(7))
๐ quick reminder bestie: the "must be the same user or a superuser" rule is not a suggestion. it's the law. respect it.
and that's the page!! this whole thing came from PostgreSQL 18.6, dated 2026 โ thanks for reading, ily, go commit responsibly ๐ซถโจ
๐ฆ where this page comes from
- opensuse-leap 16.0: postgresql18 18.6-160000.1.1 ยท PostgreSQL
- opensuse-leap 16.0: postgresql18 18.6-160000.1.1 ยท PostgreSQL
- opensuse-leap 16.0: postgresql18 18.6-160000.1.1 ยท PostgreSQL
- opensuse-leap 16.0: postgresql18 18.6-160000.1.1 ยท PostgreSQL
- ๐ girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms