SPI_FINISH(3)

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

πŸ’– SPI_FINISH(3) πŸ’–

okay bestie, gather round β€” this is the PostgreSQL 18.6 manual page for SPI_finish, and it's literally the "okay bye, love u" of the SPI world 🫢


✨ NAME ✨

SPI_finish β€” disconnect a C function from the SPI manager πŸ’…


✨ SYNOPSIS ✨

int SPI_finish(void)

✨ DESCRIPTION ✨

SPI_finish closes an existing connection to the SPI manager. Think of it as hanging up the phone β€” you opened the line, you did your little chat, now you gotta end the call, bestie πŸ“žπŸ’€

You must call this function after you finish all the SPI operations you needed during your C function's current invocation. No leaving it on read. No ghosting the SPI manager. It's giving rude and it's giving broken. πŸ™ˆ

BUT β€” and this is the good part β€” you do not need to worry about making that happen if you abort the transaction via elog(ERROR). In that case SPI will clean itself up automatically. Self-care king behavior, honestly. ✨🧚

fr fr: normal exit β†’ you call SPI_finish. Error abort via elog(ERROR) β†’ SPI handles it itself, you don't gotta do a thing. 🌸

✨ RETURN VALUE ✨

  • SPI_OK_FINISH β€” if properly disconnected πŸŽ€ (the slay outcome, the one you want)
  • SPI_ERROR_UNCONNECTED β€” if called from an unconnected C function 😭 (you tried to hang up a phone that was never picked up)

and that's the whole page, no cap. every option, every return value, every vibe β€” accounted for. periodt. πŸ‘‘

signing off from the PostgreSQL 18.6 docs, dated 2026 β€” same manual, same facts, just with infinitely more main character energy πŸ’–βœ¨πŸŽ€πŸ¦‹

πŸ“¦ where this page comes from