COMMIT(7)

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

πŸ’… 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 specify AND CHAIN, a brand-new transaction starts immediately, with the same transaction characteristics as the one that just finished (peep SET 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 COMMIT when 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 CHAIN when 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 πŸ“


⚠️ 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