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

.SH SYNOPSIS
.sp
.nf
int SPI_connect(void)
.sp
.fi
.SH "DESCRIPTION"
.PP
\fBSPI_connect\fR opens a connection from a
procedure invocation to the SPI manager. You must call this
function if you want to execute commands through SPI. Some utility
SPI functions may be called from unconnected procedures.
.PP
If your procedure is already connected,
\fBSPI_connect\fR will return the error code
SPI_ERROR_CONNECT. This could happen if
a procedure that has called \fBSPI_connect\fR
directly calls another procedure that calls
\fBSPI_connect\fR. While recursive calls to the
SPI manager are permitted when an SQL command
called through SPI invokes another function that uses
SPI, directly nested calls to
\fBSPI_connect\fR and
\fBSPI_finish\fR are forbidden.
.SH "RETURN VALUE"
.TP
\fBSPI_OK_CONNECT\fR
on success
.TP
\fBSPI_ERROR_CONNECT\fR
on error
