for the first Perl
interpreter used by a database session — either PL/PerlU, or
PL/Perl for the first SQL role that calls a PL/Perl function. Any
additional Perl interpreters created in a database session will have
to execute <literal>plperl.on_init</literal> afresh. Also, on Windows there
will be no savings whatsoever from preloading, since the Perl
interpreter created in the postmaster process does not propagate to
child processes.
</para>
<para>
This parameter can only be set in the <filename>postgresql.conf</filename> file or on the server command line.
</para>
</listitem>
</varlistentry>
<varlistentry id="guc-plperl-on-plperl-init" xreflabel="plperl.on_plperl_init">
<term>
<varname>plperl.on_plperl_init</varname> (<type>string</type>)
<indexterm>
<primary><varname>plperl.on_plperl_init</varname> configuration parameter</primary>
</indexterm>
</term>
<term>
<varname>plperl.on_plperlu_init</varname> (<type>string</type>)
<indexterm>
<primary><varname>plperl.on_plperlu_init</varname> configuration parameter</primary>
</indexterm>
</term>
<listitem>
<para>
These parameters specify Perl code to be executed when a Perl
interpreter is specialized for <literal>plperl</literal> or
<literal>plperlu</literal> respectively. This will happen when a PL/Perl or
PL/PerlU function is first executed in a database session, or when
an additional interpreter has to be created because the other language
is called or a PL/Perl function is called by a new SQL role. This
follows any initialization done by <literal>plperl.on_init</literal>.
The SPI functions are not available when this code is executed.
The Perl code in <literal>plperl.on_plperl_init</literal> is executed after
<quote>locking down</quote> the interpreter, and thus it can only perform
trusted operations.
</para>
<para>
If the code fails with an error it will abort the initialization and
propagate out to the calling query, causing the current transaction or
subtransaction to be aborted. Any actions already done within Perl
won't be undone; however, that interpreter won't be used again.
If the language is used again the initialization will be attempted
again