COMMIT(7)
β¨ COMMIT(7) β¨
okay bestie, so you know how you're in the middle of a transaction and you're like... should I keep this or not? this is the "keep it" button π it's giving main character energy for your data fr fr
πΈ NAME πΈ
COMMIT β commit the current transaction
like, actually save it, no take-backsies
π SYNOPSIS π
COMMIT [ WORK | TRANSACTION ] [ AND [ NO ] CHAIN ]
that's it. that's the whole vibe. one command, so much power π
π¦ DESCRIPTION π¦
COMMIT commits the current transaction. literally what it says on the tin, bestie.
so here's the tea: all the changes you made in this transaction become visible to everyone else, and they're guaranteed to be durable if a crash occurs. like, even if the server just β¨perishesβ¨, your data is SAFE. that's the whole point. no cap. π₯
π PARAMETERS π
WORKoptional keyword. does absolutely nothing. it's purely for the aesthetic. use it if it makes you feel fancy πTRANSACTIONalso optional, also does nothing. same vibe. literally just there to look cute alongsideWORK. pick your fighter, it doesn't matter πAND CHAINokay so if you specifyAND CHAIN, a brand new transaction starts immediately with the same transaction characteristics as the one you just finished. (peepSET TRANSACTIONinSET_TRANSACTION(7)for the deets on those characteristics, iykyk)
if you don't say AND CHAIN? no new transaction. you're free. go touch grass. π±
β NOTES β
bestie listen up, this is important:
use ROLLBACK(7) to abort a transaction. different vibe entirely. that's the "nvm undo" button.
issuing COMMIT when you're not inside a transaction? does no harm, but it will provoke a warning message. like when you text someone and they leave you on read but with a little "hey are you okay?" notification. mildly embarrassing but survivable π
β οΈ but β COMMIT AND CHAIN when you're not inside a transaction is an actual ERROR. not a warning. a whole error. do not pass go. π
π EXAMPLES π
to commit the current transaction and make all your changes permanent (the moment of truth, the grand finale, the slay):
COMMIT;
that's it. that's the whole example. iconic. π
π COMPATIBILITY π
the command COMMIT conforms to the SQL standard. β¨ we love a standards-compliant queen β¨
but heads up β the form COMMIT TRANSACTION is a PostgreSQL extension. so it's not standard SQL, it's just a lil PostgreSQL flex. you're welcome π«Ά
πΈ SEE ALSO πΈ
(that's "start the transaction" and "never mind" β the whole trio, the holy trinity of transaction vibes π§)
and that's the page bestie!! from the PostgreSQL 13.23 docs, dated 2025, with love π stay transactional, stay iconic β¨
π¦ where this page comes from
- opensuse-leap 16.0: postgresql13 13.23-160000.1.1 Β· PostgreSQL
- opensuse-leap 16.0: postgresql13 13.23-160000.1.1 Β· PostgreSQL
- opensuse-leap 16.0: postgresql13 13.23-160000.1.1 Β· PostgreSQL
- opensuse-leap 16.0: postgresql13 13.23-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