SPI_COMMIT(3)

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

πŸ’… NAME πŸ’…

Okay bestie, welcome to SPI_COMMIT(3) β€” the page all about SPI_commit and SPI_commit_and_chain, aka the functions that commit the current transaction. Slay. ✨


πŸŽ€ SYNOPSIS πŸŽ€

void SPI_commit(void)

void SPI_commit_and_chain(void)

🌸 DESCRIPTION 🌸

So SPI_commit commits the current transaction. It’s approximately equivalent to running the SQL command COMMIT. No cap. πŸ’…

After the transaction is committed, a new transaction is automatically started using default transaction characteristics, so that the caller can keep using SPI facilities. Iconic, honestly. πŸ¦‹

But listen β€” if there is a failure during commit, the current transaction is instead rolled back and a new transaction is started, after which the error is thrown in the usual way. So it’s giving β€œcommit, but make it resilient.” 😭✨

SPI_commit_and_chain is the same, but the new transaction is started with the same transaction characteristics as the just finished one, like with the SQL command COMMIT AND CHAIN. Periodt. πŸ”₯

Heads up, bestie: these functions can only be executed if the SPI connection has been set as nonatomic in the call to SPI_connect_ext. That’s the vibe check you gotta pass first. 🫢

Written for PostgreSQL 13.23, dated 2025 β€” mwah, she’s iconic, she’s documented, she’s logging off. πŸ’–πŸŽ€βœ¨

πŸ“¦ where this page comes from