@ -1,4 +1,4 @@
<!-- $PostgreSQL: pgsql/doc/src/sgml/pltcl.sgml,v 2.40 2006/05/27 20:24:16 adunst an Exp $ -->
<!-- $PostgreSQL: pgsql/doc/src/sgml/pltcl.sgml,v 2.41 2006/05/30 11:40:21 momji an Exp $ -->
<chapter id="pltcl">
<chapter id="pltcl">
<title>PL/Tcl - Tcl Procedural Language</title>
<title>PL/Tcl - Tcl Procedural Language</title>
@ -25,22 +25,27 @@
<title>Overview</title>
<title>Overview</title>
<para>
<para>
PL/Tcl offers most of the capabilities a function
PL/Tcl offers most of the capabilities a function writer has in
writer has in the C language, except for some restrictions.
the C language, with a few restrictions, and with the addition of
the powerful string processing libraries that are available for
Tcl.
</para>
</para>
<para>
<para>
The good restriction is that everything is executed in a safe
One compelling <emphasis>good</emphasis> restriction is that
Tcl interpreter. In addition to the limited command set of safe Tcl, only
everything is executed from within the safety of the context of a
a few commands are available to access the database via SPI and to raise
Tcl interpreter. In addition to the limited command set of safe
messages via <function>elog()</>. There is no way to access internals of the
Tcl, only a few commands are available to access the database via
database server or to gain OS-level access under the permissions of the
SPI and to raise messages via <function>elog()</>. PL/Tcl
<productname>PostgreSQL</productname> server process, as a C function can do.
provides no way to access internals of the database server or to
Thus, any unprivileged database user may be
gain OS-level access under the permissions of the
permitted to use this language.
<productname>PostgreSQL</productname> server process, as a C
function can do. Thus, unprivileged database users may be trusted
to use this language; it does not give them unlimited authority.
</para>
</para>
<para>
<para>
The other, implementation restriction is that Tcl functions cannot
The other notable implementation restriction is that Tcl functions
be used to create input/output functions for new data types.
may not be used to create input/output functions for new data
types.
</para>
</para>
<para>
<para>
Sometimes it is desirable to write Tcl functions that are not restricted
Sometimes it is desirable to write Tcl functions that are not restricted
@ -55,12 +60,12 @@
a user logged in as the database administrator.
a user logged in as the database administrator.
</para>
</para>
<para>
<para>
The shared object for the <application>PL/Tcl</> and <application>PL/TclU</> call handlers is
The shared object code for the <application>PL/Tcl</> and
automatically built and installed in the
<application>PL/TclU</> call handlers is automatically built and
<productname>PostgreSQL</productname>
installed in the <productname>PostgreSQL</productname> library
library directory if Tcl support is specified
directory if Tcl support is specified in the configuration step of
in the configuration step of the installation procedure. To install
the installation procedure. To install <application>PL/Tcl</>
<application>PL/Tcl</> and/or <application>PL/TclU</> in a particular database, use the
and/or <application>PL/TclU</> in a particular database, use the
<command>createlang</command> program, for example
<command>createlang</command> program, for example
<literal>createlang pltcl <replaceable>dbname</></literal> or
<literal>createlang pltcl <replaceable>dbname</></literal> or
<literal>createlang pltclu <replaceable>dbname</></literal>.
<literal>createlang pltclu <replaceable>dbname</></literal>.