SPI_COMMIT(3)

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

okay bestie, welcome to the SPI_COMMIT(3) page β€” yes, the one about committing the current transaction in PostgreSQL. It's giving β€œsmall but mighty,” and we're gonna walk through it together, no cap.

πŸ’– NAME πŸ’–

SPI_commit, SPI_commit_and_chain β€” commit the current transaction. That's literally the whole name-line vibe.

🌸 SYNOPSIS 🌸

void SPI_commit(void)

void SPI_commit_and_chain(void)

πŸ¦‹ DESCRIPTION πŸ¦‹

Okay so SPI_commit commits the current transaction. It's approximately equivalent to running the SQL command COMMIT. Slay.

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 continuity, honestly.

If there's 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. Not the glow-up we wanted, but that's the deal.

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. Chain reaction, but make it transactional. πŸ’…

🚨 real talk: these functions can only be executed if the SPI connection has been set as nonatomic in the call to SPI_connect_ext. No nonatomic setting, no execution β€” periodt.

xoxo, your Unix bestie signing off 🫢 β€” this page is from PostgreSQL 16.15, dated 2026, and it's the SPI_COMMIT(3) manual page. πŸ’–

πŸ“¦ where this page comes from