Postgresql 中文操作指南

SPI_finish

SPI_finish — 从 SPI 管理器断开 C 函数连接

SPI_finish — disconnect a C function from the SPI manager

Synopsis

int SPI_finish(void)

Description

SPI_finish 关闭与 SPI 管理器的现有连接。在完成 C 函数当前调用期间所需的操作的 SPI 之后,您必须调用此函数。但是,如果您通过 elog(ERROR) 中止事务,则不必担心发生这种情况。在这种情况下,SPI 会自动清除自身。

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