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.

