SPI_finish(3)

SPI_finish3

Disconnect a c function from the spi manager

Usage

int SPI_finish(void)

Overview

SPI_finish closes an existing connection to the SPI manager. You must call this function after completing the SPI operations needed during your C function's current invocation. You do not need to worry about making this happen, however, if you abort the transaction via elog(ERROR). In that case SPI will clean itself up automatically.

Return value

SPI_OK_FINISH

if properly disconnected

SPI_ERROR_UNCONNECTED

if called from an unconnected C function

From postgresql 18.6-4 in Arch Linux 2026-11-01. Parsed by carta from the page's man source.