]> begriffs open source - ai-pg/blob - full-docs/html/pltcl-overview.html
Include links to all subsection html pages, with shorter paths too
[ai-pg] / full-docs / html / pltcl-overview.html
1 <?xml version="1.0" encoding="UTF-8" standalone="no"?>
2 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>42.1. Overview</title><link rel="stylesheet" type="text/css" href="stylesheet.css" /><link rev="made" href="pgsql-docs@lists.postgresql.org" /><meta name="generator" content="DocBook XSL Stylesheets Vsnapshot" /><link rel="prev" href="pltcl.html" title="Chapter 42. PL/Tcl — Tcl Procedural Language" /><link rel="next" href="pltcl-functions.html" title="42.2. PL/Tcl Functions and Arguments" /></head><body id="docContent" class="container-fluid col-10"><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="5" align="center">42.1. Overview</th></tr><tr><td width="10%" align="left"><a accesskey="p" href="pltcl.html" title="Chapter 42. PL/Tcl — Tcl Procedural Language">Prev</a> </td><td width="10%" align="left"><a accesskey="u" href="pltcl.html" title="Chapter 42. PL/Tcl — Tcl Procedural Language">Up</a></td><th width="60%" align="center">Chapter 42. PL/Tcl — Tcl Procedural Language</th><td width="10%" align="right"><a accesskey="h" href="index.html" title="PostgreSQL 18.0 Documentation">Home</a></td><td width="10%" align="right"> <a accesskey="n" href="pltcl-functions.html" title="42.2. PL/Tcl Functions and Arguments">Next</a></td></tr></table><hr /></div><div class="sect1" id="PLTCL-OVERVIEW"><div class="titlepage"><div><div><h2 class="title" style="clear: both">42.1. Overview <a href="#PLTCL-OVERVIEW" class="id_link">#</a></h2></div></div></div><p>
3     PL/Tcl offers most of the capabilities a function writer has in
4     the C language, with a few restrictions, and with the addition of
5     the powerful string processing libraries that are available for
6     Tcl.
7    </p><p>
8     One compelling <span class="emphasis"><em>good</em></span> restriction is that
9     everything is executed from within the safety of the context of a
10     Tcl interpreter.  In addition to the limited command set of safe
11     Tcl, only a few commands are available to access the database via
12     SPI and to raise messages via <code class="function">elog()</code>.  PL/Tcl
13     provides no way to access internals of the database server or to
14     gain OS-level access under the permissions of the
15     <span class="productname">PostgreSQL</span> server process, as a C
16     function can do.  Thus, unprivileged database users can be trusted
17     to use this language; it does not give them unlimited authority.
18    </p><p>
19     The other notable implementation restriction is that Tcl functions
20     cannot be used to create input/output functions for new data
21     types.
22    </p><p>
23     Sometimes it is desirable to write Tcl functions that are not restricted
24     to safe Tcl.  For example, one might want a Tcl function that sends
25     email.  To handle these cases, there is a variant of <span class="application">PL/Tcl</span> called <code class="literal">PL/TclU</code>
26     (for untrusted Tcl).  This is exactly the same language except that a full
27     Tcl interpreter is used.  <span class="emphasis"><em>If <span class="application">PL/TclU</span> is used, it must be
28     installed as an untrusted procedural language</em></span> so that only
29     database superusers can create functions in it.  The writer of a <span class="application">PL/TclU</span>
30     function must take care that the function cannot be used to do anything
31     unwanted, since it will be able to do anything that could be done by
32     a user logged in as the database administrator.
33    </p><p>
34     The shared object code for the <span class="application">PL/Tcl</span> and
35     <span class="application">PL/TclU</span> call handlers is automatically built and
36     installed in the <span class="productname">PostgreSQL</span> library
37     directory if Tcl support is specified in the configuration step of
38     the installation procedure.  To install <span class="application">PL/Tcl</span>
39     and/or <span class="application">PL/TclU</span> in a particular database, use the
40     <code class="command">CREATE EXTENSION</code> command, for example
41     <code class="literal">CREATE EXTENSION pltcl</code> or
42     <code class="literal">CREATE EXTENSION pltclu</code>.
43    </p></div><div class="navfooter"><hr /><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="pltcl.html" title="Chapter 42. PL/Tcl — Tcl Procedural Language">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="pltcl.html" title="Chapter 42. PL/Tcl — Tcl Procedural Language">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="pltcl-functions.html" title="42.2. PL/Tcl Functions and Arguments">Next</a></td></tr><tr><td width="40%" align="left" valign="top">Chapter 42. PL/Tcl — Tcl Procedural Language </td><td width="20%" align="center"><a accesskey="h" href="index.html" title="PostgreSQL 18.0 Documentation">Home</a></td><td width="40%" align="right" valign="top"> 42.2. PL/Tcl Functions and Arguments</td></tr></table></div></body></html>