SPI_COMMIT(3)

πŸ’– SPI_COMMIT(3) β€” the PostgreSQL 18.6 glow-up edition ✨

okay bestie, sit down, hydrate, and let's talk about committing transactions πŸ’… this one lives in the PostgreSQL 18.6 docs and honestly? it's giving "short but life-changing."


🌸 NAME 🌸

SPI_commit, SPI_commit_and_chain β€” commit the current transaction, periodt πŸ’–


πŸŽ€ SYNOPSIS πŸŽ€

void SPI_commit(void)

void SPI_commit_and_chain(void)

like. that's it. two little functions. no arguments. iconic behavior fr fr ✨


πŸ¦‹ DESCRIPTION πŸ¦‹

so SPI_commit commits the current transaction. think of it as approximately the same vibe as running the SQL command COMMIT β€” not identical, but basically the same energy πŸ’«

the way that it works: after the transaction is committed, a new transaction is automatically started using default transaction characteristics, so you β€” the caller β€” can keep on using SPI facilities without missing a beat. she's self-sufficient, she's got main character energy πŸ‘‘

⚠️ but listen. if there is a failure during commit, the current transaction is instead rolled back, and a new transaction is started, and then the error is thrown in the usual way. so it's not all sparkles β€” sometimes she stumbles, but she always recovers and tells you what went wrong 😭

now SPI_commit_and_chain is the same thing, EXCEPT the new transaction is started with the same transaction characteristics as the just finished one β€” just like with the SQL command COMMIT AND CHAIN. same fit, new transaction. she's recycling the aesthetic πŸ”₯


πŸ‘‘ the one rule, the vibe check, the non-negotiable πŸ‘‘

these functions can only be executed if the SPI connection has been set as nonatomic in the call to SPI_connect_ext.

read that again, bestie. only. if your connection isn't nonatomic, this whole thing is a no. set it up right or don't come to the party πŸš«πŸ’€


πŸ’œ SEE ALSO πŸ’œ

no extra references on this one β€” she stands alone. lowkey iconic of her 🫢


and that's the whole page! written up for PostgreSQL 18.6 in 2026 β€” mwah, sending you good commit vibes and zero unexpected rollbacks πŸŒˆπŸ’–βœ¨