.\\" auto-generated by docbook2man-spec $Revision: 1.1.1.1 $
.TH "SPI_finish" "" "2007-09-16" "" "PostgreSQL 7.4.18 Documentation"
.SH NAME
SPI_finish \- disconnect a procedure from the SPI manager

.SH SYNOPSIS
.sp
.nf
int SPI_finish(void)
.sp
.fi
.SH "DESCRIPTION"
.PP
\fBSPI_finish\fR closes an existing connection to
the SPI manager. You must call this function after completing the
SPI operations needed during your procedure'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.
.PP
If \fBSPI_finish\fR is called without having a valid
connection, it will return \fBSPI_ERROR_UNCONNECTED\fR.
There is no fundamental problem with this; it means that the SPI
manager has nothing to do.
.SH "RETURN VALUE"
.TP
\fBSPI_OK_FINISH\fR
if properly disconnected
.TP
\fBSPI_ERROR_UNCONNECTED\fR
if called from an unconnected procedure
