SPI_ROLLBACK(3)

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

✨ SPI_ROLLBACK ✨

okay bestie, so we're talking about the PostgreSQL 18.6 docs, section 3, and today's main character is SPI_rollback and its lil sibling SPI_rollback_and_chain πŸŽ€ both of them live to abort the current transaction. that's the whole gig. iconic behaviour honestly.


πŸ’… SYNOPSIS

void SPI_rollback(void)

void SPI_rollback_and_chain(void)

like. look at them. two little void functions. no args. no return value. they simply do the thing and dip. no cap. πŸ¦‹


🌸 DESCRIPTION

SPI_rollback 🫢

so SPI_rollback rolls back the current transaction. that's it, that's the vibe. it's approximately equivalent to running the SQL command ROLLBACK β€” like, same energy, same outcome.

but here's the part that actually slays: after the transaction is rolled back, a new transaction is automatically started using default transaction characteristics, so the caller can keep using SPI facilities like nothing happened. it's giving "we don't do downtime" energy. the transaction is gone but you're still seated at the table, bestie. πŸ’–

SPI_rollback_and_chain πŸ”₯

SPI_rollback_and_chain is the same thing, but β€” and this is the plot twist β€” the new transaction gets started with the same transaction characteristics as the just finished one, exactly like with the SQL command ROLLBACK AND CHAIN. so the vibe carries over. the settings stay. it's the sequel that respects the original. ✨


⚠️ IMPORTANT, FR FR

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. nonatomic. in SPI_connect_ext. if you didn't set that, these functions are not gonna work for you, and that's not me being mean, that's just the rules. πŸ’€


🌈 SEE ALSO

nothing else listed here, bestie β€” this page is self-contained. go forth and rollback responsibly. πŸ‘‘


and that's the whole page!! brought to you by PostgreSQL 18.6, dated 2026, page SPI_ROLLBACK(3). mwah πŸ’…πŸ’–πŸ¦‹βœ¨

πŸ“¦ where this page comes from