blob: 3bfd0cbdcb57dbf0c54a5cd212623cf6f1099703 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
|
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!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>44.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 44. PL/Tcl — Tcl Procedural Language" /><link rel="next" href="pltcl-functions.html" title="44.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">44.1. Overview</th></tr><tr><td width="10%" align="left"><a accesskey="p" href="pltcl.html" title="Chapter 44. PL/Tcl — Tcl Procedural Language">Prev</a> </td><td width="10%" align="left"><a accesskey="u" href="pltcl.html" title="Chapter 44. PL/Tcl — Tcl Procedural Language">Up</a></td><th width="60%" align="center">Chapter 44. PL/Tcl — Tcl Procedural Language</th><td width="10%" align="right"><a accesskey="h" href="index.html" title="PostgreSQL 15.7 Documentation">Home</a></td><td width="10%" align="right"> <a accesskey="n" href="pltcl-functions.html" title="44.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">44.1. Overview</h2></div></div></div><p>
PL/Tcl offers most of the capabilities a function writer has in
the C language, with a few restrictions, and with the addition of
the powerful string processing libraries that are available for
Tcl.
</p><p>
One compelling <span class="emphasis"><em>good</em></span> restriction is that
everything is executed from within the safety of the context of a
Tcl interpreter. In addition to the limited command set of safe
Tcl, only a few commands are available to access the database via
SPI and to raise messages via <code class="function">elog()</code>. PL/Tcl
provides no way to access internals of the database server or to
gain OS-level access under the permissions of the
<span class="productname">PostgreSQL</span> server process, as a C
function can do. Thus, unprivileged database users can be trusted
to use this language; it does not give them unlimited authority.
</p><p>
The other notable implementation restriction is that Tcl functions
cannot be used to create input/output functions for new data
types.
</p><p>
Sometimes it is desirable to write Tcl functions that are not restricted
to safe Tcl. For example, one might want a Tcl function that sends
email. To handle these cases, there is a variant of <span class="application">PL/Tcl</span> called <code class="literal">PL/TclU</code>
(for untrusted Tcl). This is exactly the same language except that a full
Tcl interpreter is used. <span class="emphasis"><em>If <span class="application">PL/TclU</span> is used, it must be
installed as an untrusted procedural language</em></span> so that only
database superusers can create functions in it. The writer of a <span class="application">PL/TclU</span>
function must take care that the function cannot be used to do anything
unwanted, since it will be able to do anything that could be done by
a user logged in as the database administrator.
</p><p>
The shared object code for the <span class="application">PL/Tcl</span> and
<span class="application">PL/TclU</span> call handlers is automatically built and
installed in the <span class="productname">PostgreSQL</span> library
directory if Tcl support is specified in the configuration step of
the installation procedure. To install <span class="application">PL/Tcl</span>
and/or <span class="application">PL/TclU</span> in a particular database, use the
<code class="command">CREATE EXTENSION</code> command, for example
<code class="literal">CREATE EXTENSION pltcl</code> or
<code class="literal">CREATE EXTENSION pltclu</code>.
</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 44. PL/Tcl — Tcl Procedural Language">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="pltcl.html" title="Chapter 44. PL/Tcl — Tcl Procedural Language">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="pltcl-functions.html" title="44.2. PL/Tcl Functions and Arguments">Next</a></td></tr><tr><td width="40%" align="left" valign="top">Chapter 44. PL/Tcl — Tcl Procedural Language </td><td width="20%" align="center"><a accesskey="h" href="index.html" title="PostgreSQL 15.7 Documentation">Home</a></td><td width="40%" align="right" valign="top"> 44.2. PL/Tcl Functions and Arguments</td></tr></table></div></body></html>
|