.\\" auto-generated by docbook2man-spec $Revision: 1.1.1.1 $
.TH "PG_EXEC" "" "2007-09-16" "" "PostgreSQL 7.4.18 Documentation"
.SH NAME
pg_exec \- send a command to the server

.SH SYNOPSIS
.sp
.nf
pg_exec \fIconn\fR \fIcommandString\fR
.sp
.fi
.SH "DESCRIPTION"
.PP
\fBpg_exec\fR submits a command to the
PostgreSQL server and returns a result.
Command result handles start with the connection handle and add a
period and a result number.
.PP
Note that lack of a Tcl error is not proof that the command
succeeded! An error message returned by the server will be
processed as a command result with failure status, not by
generating a Tcl error in \fBpg_exec\fR.
.SH "ARGUMENTS"
.TP
\fB\fIconn\fB\fR
The handle of the connection on which to execute the command.
.TP
\fB\fIcommandString\fB\fR
The SQL command to execute.
.SH "RETURN VALUE"
.PP
A result handle. A Tcl error will be returned if
\fBpgtcl\fR was unable to obtain a server
response. Otherwise, a command result object is created and a
handle for it is returned. This handle can be passed to
\fBpg_result\fR to obtain the results of the
command.
