Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Contact Us
Online Help
Domain Status
Man Pages

Virtual Servers

Topology Map

Server Agreement
Year 2038

USA Flag



Man Pages

Manual Reference Pages  -  POSTGRESQL::PLPERL::TRACE (3)

.ds Aq ’


PostgreSQL::PLPerl::Trace - Simple way to trace execution of Perl statements in PL/Perl



version 1.001


Load via a line in your file:

    use PostgreSQL::PLPerl::Trace;

Load via the PERL5OPT environment variable:

    $ PERL5OPT=-MPostgreSQL::PLPerl::Trace pg_ctl ...


Writes a line to the PostgreSQL log file for every PL/Perl statement executed. This can generate truly massive amounts of log data and also slows excution of PL/Perl code by at least a couple of orders of magnitude.

Why would you want to do this? Well, there are times when it’s a simple and effective way to see what PL/Perl code is actually being executed.

This module is based on Devel::Trace but modified to work with PostgreSQL PL/Perl for both the plperlu language and, more significantly, for the plperl language as well. It also shows the subroutine name whenever execution moves from one subroutine to another.


In order to use this module you need to arrange for it to be loaded when PostgreSQL initializes a Perl interpreter.

Create a file in the same directory as your postgres.conf file, if it doesn’t exist already.

In the file write the code to load this module:

    use PostgreSQL::PLPerl::Trace;

When it’s no longer needed just comment it out by prefixing with a #.

    PostgreSQL 8.x

Set the PERL5OPT before starting postgres, to something like this:

    PERL5OPT=-e "require q{}"

The code in the should also include delete $ENV{PERL5OPT}; to avoid any problems with nested invocations of perl, e.g., via a plperlu function.

    PostgreSQL 9.0

For PostgreSQL 9.0 you can still use the PERL5OPT method described above. Alternatively, and preferably, you can use the plperl.on_init configuration variable in the postgres.conf file.

    plperl.on_init=require q{};

    Alternative Method

It you’re not already using the PERL5OPT environment variable to load a file, as described above, then you can use it as a quick way to load the module for ad-hoc use:

    $ PERL5OPT=-MPostgreSQL::PLPerl::Trace pg_ctl ...


Tim Bunce <>

Copyright (c) Tim Bunce, Ireland, 2010. All rights reserved. You may use and distribute on the same terms as Perl 5.10.1.

With thanks to <> for sponsoring development.

Search for    or go to Top of page |  Section 3 |  Main Index

perl v5.20.3 POSTGRESQL::PLPERL::TRACE (3) 2010-03-11

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with manServer 1.07.