SPI_ROLLBACK(3)
β¨ 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
- alpine 3.23: postgresql18-doc 18.6-r0 Β· PostgreSQL
- alpine 3.24: postgresql18-doc 18.6-r0 Β· PostgreSQL
- arch rolling: postgresql 18.6-4 Β· PostgreSQL
- fedora 43: postgresql-server-devel 18.6-1.fc43 Β· PostgreSQL
- fedora 43: postgresql-server-devel 18.6-1.fc43 Β· PostgreSQL
- fedora 44: postgresql-server-devel 18.6-1.fc44 Β· PostgreSQL
- fedora 44: postgresql-server-devel 18.6-1.fc44 Β· PostgreSQL
- nixos 26.05: postgresql 18.6
- ubuntu resolute: postgresql-doc-18 18.6-0ubuntu0.26.04.1 Β· PostgreSQL
- ubuntu stonking: postgresql-doc-18 18.6-3build2 Β· PostgreSQL
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms