GSP
Quick Navigator

Search Site

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

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages
PostgreSQL::PLPerl::Trace(3) User Contributed Perl Documentation PostgreSQL::PLPerl::Trace(3)

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

version 1.001

Load via a line in your plperlinit.pl 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 plperlinit.pl file in the same directory as your postgres.conf file, if it doesn't exist already.

In the plperlinit.pl 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 "#".

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

    PERL5OPT='-e "require q{plperlinit.pl}"'

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

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{plperlinit.pl};'

It you're not already using the "PERL5OPT" environment variable to load a plperlinit.pl 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 <http://www.tim.bunce.name>

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 <http://www.TigerLead.com> for sponsoring development.

2010-03-11 perl v5.32.1

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

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