summaryrefslogtreecommitdiff
path: root/src/pl/tcl/INSTALL
blob: 27d0df33259fa3a1280474bcded813f8e07607f7 (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
Installation instructions for PL/Tcl

1.  Build the pltcl shared library

    The Makefile for the pltcl shared library assumes the sources
    for PostgreSQL are in /usr/local/src/postgresql-6.2.1/src. Edit
    if not.

    The Makefile depends on the tclConfig.sh file that get's installed
    with Tcl. This should either be in /usr/lib or in /usr/local/lib.
    If it is in a different place, edit mkMakefile.tcldefs or make a
    symbolic link to it here.

    Type make and the shared library should get built.

2.  Now create the PL/Tcl language in PostgreSQL

    Since the pg_language system catalog is private to each database,
    the new language can be created only for individual databases,
    or in the template1 database. In the latter case, it is
    automatically available in all newly created databases.

    The commands to create the new language are:

        create function pltcl_call_handler () returns opaque
    		as 'path-to-pltcl-shared-lib'
    		language 'C';

	create trusted procedural language 'pltcl'
		handler pltcl_call_handler
		lancompiler 'PL/Tcl';

    The trusted keyword on create procedural language tells PostgreSQL,
    that all users (not only those with superuser privilege) are
    permitted to create functions with LANGUAGE 'pltcl'. This is
    absolutely safe, because there is nothing a normal user can do
    with PL/Tcl, to get around access restrictions he/she has.

3.  Use PL/Tcl

    Read pltcl_guide.txt to learn how to write functions and
    trigger procedures in PL/Tcl.