The PL/Tcl language allows a trusted version of the popular Tool Command Language (Tcl) to be used when creating custom functions or triggers in PostgreSQL. Although a full explanation of the Tcl language is outside the scope of this book, we will highlight some of the major features and provide some examples.
The major difference between the regular Tcl language and PL/Tcl is that the latter is running in a trusted mode. This means that no OS-level activity can be performed. Moreover, only a limited set of Tcl commands are enabled. In fact, Tcl functions cannot be used to create new data types in PostgreSQL.
If OS-level operations are desired, there is a more expressive version of PL/Tcl available named PL/TclU (Tcl Untrusted) that can ...