COMMIT(7)
π COMMIT(7) β the "yes bestie, make it official" page
okay so real talk: you're holding the COMMIT(7) page from the PostgreSQL 15.19 Documentation and it is literally the most satisfying command in the whole SQL-verse. this is the moment your transaction stops being a draft and becomes canon. let's get into it π
β¨ NAME β¨
COMMIT β commit the current transaction π
like, finalize it. seal it. say yes. π
πΈ SYNOPSIS πΈ
COMMIT [ WORK | TRANSACTION ] [ AND [ NO ] CHAIN ]
look at her. so short. so powerful. main character energy fr fr. β¨
π¦ DESCRIPTION π¦
COMMIT commits the current transaction. that's it, that's the whole vibe. π
here's the tea though β everything you did inside that transaction becomes visible to others, and it's guaranteed to be durable if a crash occurs. no cap. once you hit COMMIT, the database is not letting go of that data, even if the whole machine decides to have a meltdown two seconds later. π₯
it's giving "signed, sealed, delivered" energy. π«Ά
π PARAMETERS π
WORKβ optional keyword. it has no effect. it's just here to look cute. πTRANSACTIONβ same deal, optional keyword, no effect. pick whichever one makes you feel something. πAND CHAINβ ok so this one actually does something. if you specifyAND CHAIN, a brand-new transaction starts immediately, with the same transaction characteristics as the one that just finished (peepSET TRANSACTION (SET_TRANSACTION(7))if you wanna know what those characteristics are). otherwise? no new transaction. you're free. π¦
π§ NOTES π§
- wanna bail instead? use
ROLLBACK(7)to abort a transaction. it's the "nvm" button. π - issuing
COMMITwhen you're not inside a transaction does no harm β but it will provoke a warning message. so like, harmless, but the database is gonna side-eye you. π COMMIT AND CHAINwhen you're not inside a transaction is an error. not a warning. an actual error. so don't. π
π EXAMPLES π
to commit the current transaction and make all changes permanent:
COMMIT;
that's it. one word. slay. β
π COMPATIBILITY π
the command COMMIT conforms to the SQL standard. β
the form COMMIT TRANSACTION? that's a PostgreSQL extension. so it's a little β¨bonusβ¨, not standard. iykyk. π
π SEE ALSO π
BEGIN(7)β how you got here in the first placeROLLBACK(7)β the undo button
β οΈ friendly reminder bestie: COMMIT is forever. once it's durable, it's durable. if you're not sure, don't commit. π«Ά
and that's the page! brought to you by PostgreSQL 15.19, dated 2026 (the docs say so, not me π). now go forth and commit responsibly, icon. π§ββοΈβ¨π
π¦ where this page comes from
- opensuse-leap 16.0: postgresql15 15.19-160000.1.1 Β· PostgreSQL
- opensuse-leap 16.0: postgresql15 15.19-160000.1.1 Β· PostgreSQL
- opensuse-leap 16.0: postgresql15 15.19-160000.1.1 Β· PostgreSQL
- opensuse-leap 16.0: postgresql15 15.19-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