11<!--
2- $Header: /cvsroot/pgsql/doc/src/sgml/pltcl.sgml,v 2.8 2001/03/25 10:16:12 petere Exp $
2+ $Header: /cvsroot/pgsql/doc/src/sgml/pltcl.sgml,v 2.9 2001/04/30 22:22:34 tgl Exp $
33-->
44
55 <chapter id="pltcl">
@@ -96,8 +96,10 @@ CREATE FUNCTION <replaceable>funcname</replaceable> (<replaceable>argument-types
9696 </programlisting>
9797
9898 When the function is called, the arguments are given as
99- variables $1 ... $n to the Tcl procedure body. For example,
100- a function
99+ variables <literal>$1</literal> ... <literal>$n</literal> to the
100+ Tcl procedure body. The result is returned
101+ from the Tcl code in the usual way, with a <literal>return</literal>
102+ statement. For example, a function
101103 returning the higher of two int4 values could be defined as:
102104
103105 <programlisting>
@@ -107,6 +109,11 @@ CREATE FUNCTION tcl_max (int4, int4) RETURNS int4 AS '
107109' LANGUAGE 'pltcl';
108110 </programlisting>
109111
112+ To return a NULL value from a PL/Tcl function, execute
113+ <literal>return_null</literal>.
114+ </para>
115+
116+ <para>
110117 Composite type arguments are given to the procedure as Tcl arrays.
111118 The element names
112119 in the array are the attribute names of the composite