- linkend="sql-syntax-dollar-quoting">) for the string constant.
- If you choose to use regular single-quoted string constant syntax,
- you must escape single quote marks ('>) and backslashes
- (\>) used in the body of the function, typically by
- doubling them (see ).
+ The use of named nested subroutines is dangerous in Perl, especially if
+ they refer to lexical variables in the enclosing scope. Because a PL/Perl
+ function is wrapped in a subroutine, any named subroutine you create will
+ be nested. In general, it is far safer to create anonymous subroutines
+ which you call via a coderef. See the perldiag
+ man page for more details.
+
+
+ The syntax of the CREATE FUNCTION command requires
+ the function body to be written as a string constant. It is usually
+ most convenient to use dollar quoting (see
+ linkend="sql-syntax-dollar-quoting">) for the string constant.
+ If you choose to use regular single-quoted string constant syntax,
+ you must escape single quote marks ('>) and backslashes
+ (\>) used in the body of the function, typically by
+ doubling them (see ).
+
Arguments and results are handled as in any other Perl subroutine: