- linkend="guc-custom-variable-classes"> and setting
- plperl.use_strict to true in
- postgresql.conf
-
-
-
- One function at a time, by using PL/PerlU (you must be database
- superuser to do this) and including
-
-use strict;
-
-
- in the function body.
-
-
-
-
The syntax of the CREATE FUNCTION command requires
PL/Perl functions can also return sets of either scalar or
- composite types. In general, you'll want to return rows one at a
- time both to speed up startup time and to keep from queueing up
+ composite types. Usually you'll want to return rows one at a
+ time, both to speed up startup time and to keep from queueing up
the entire result set in memory. You can do this with
return_next as illustrated below. Note that
after the last return_next, you must put
- either return; or (better) return
- undef;
+ either return or (better) return
+ undef.
CREATE OR REPLACE FUNCTION perl_set_int(int)
contains either scalars, references to arrays, or references to
hashes for simple types, array types, and composite types,
respectively. Here are some simple examples of returning the entire
- result set as a reference:
+ result set as an array reference:
CREATE OR REPLACE FUNCTION perl_set_int(int) RETURNS SETOF INTEGER AS $$
it is a hazard if you declare a
PL/Perl> function
as returning a domain type.
+
+ If you wish to use the strict> pragma with your code,
+ the easiest way to do so is to SET>
+ plperl.use_strict to true. This parameter affects
+ subsequent compilations of
PL/Perl> functions, but not
+ functions already compiled in the current session. To set the
+ parameter before
PL/Perl> has been loaded, it is
+ necessary to have added
plperl>> to the
+ linkend="guc-custom-variable-classes"> list in
+ postgresql.conf.
+
+
+ Another way to use the strict> pragma is to just put
+use strict;
+
+ in the function body. But this only works for
PL/PerlU>
+ functions, since use> is not a trusted operation.
+
when using custom variables:
-custom_variable_classes = 'plr,pljava'
+custom_variable_classes = 'plr,plperl'
plr.path = '/usr/lib/R'
-pljava.foo = 1
-plruby.bar = true # generates error, unknown class name
+plperl.use_strict = true
+plruby.use_strict = true # generates error: unknown class name