From 85d67ccd75ca61b27f8c58f2ea8d4e68af545d55 Mon Sep 17 00:00:00 2001 From: Andrew Dunstan Date: Sat, 30 Jan 2010 01:46:57 +0000 Subject: Add plperl.on_perl_init setting to provide for initializing the perl library on load. Also, handle END blocks in plperl. Database access is disallowed during both these operations, although it might be allowed in END blocks in future. Patch from Tim Bunce. --- doc/src/sgml/plperl.sgml | 82 ++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 79 insertions(+), 3 deletions(-) (limited to 'doc/src') diff --git a/doc/src/sgml/plperl.sgml b/doc/src/sgml/plperl.sgml index cb231bd791a..2128972c131 100644 --- a/doc/src/sgml/plperl.sgml +++ b/doc/src/sgml/plperl.sgml @@ -1,4 +1,4 @@ - + PL/Perl - Perl Procedural Language @@ -1028,7 +1028,72 @@ CREATE TRIGGER test_valid_id_trig - + + PL/Perl Under the Hood + + + Configuration + + + This section lists configuration parameters that affect PL/Perl. + To set any of these parameters before PL/Perl has been loaded, + it is necessary to have added plperl to the + list in + postgresql.conf. + + + + + + plperl.on_perl_init (string) + + plperl.on_perl_init configuration parameter + + + + Specifies perl code to be executed when a perl interpreter is first initialized. + The SPI functions are not available when this code is executed. + If the code fails with an error it will abort the initialization of the interpreter + and propagate out to the calling query, causing the current transaction + or subtransaction to be aborted. + + + The perl code is limited to a single string. Longer code can be placed + into a module and loaded by the on_perl_init string. + Examples: + +plplerl.on_perl_init = '$ENV{NYTPROF}="start=no"; require Devel::NYTProf::PgPLPerl' +plplerl.on_perl_init = 'use lib "/my/app"; use MyApp::PgInit;' + + + + Initialization will happen in the postmaster if the plperl library is included + in shared_preload_libraries (see ), + in which case extra consideration should be given to the risk of destabilizing the postmaster. + + + This parameter can only be set in the postgresql.conf file or on the server command line. + + + + + + plperl.use_strict (boolean) + + plperl.use_strict configuration parameter + + + + When set true subsequent compilations of PL/Perl functions have the strict pragma enabled. + This parameter does not affect functions already compiled in the current session. + + + + + + + + Limitations and Missing Features @@ -1063,10 +1128,21 @@ CREATE TRIGGER test_valid_id_trig return_next for each row returned, as shown previously. - + + + + When a session ends normally, not due to a fatal error, any + END blocks that have been defined are executed. + Currently no other actions are performed. Specifically, + file handles are not automatically flushed and objects are + not automatically destroyed. + + + + -- cgit v1.2.3