This page in other versions: 8.4 / 9.0 / 9.1 / 9.2 / 9.3  |  Development versions: devel / 9.4  |  Unsupported versions: 7.1 / 7.2 / 7.3 / 7.4 / 8.0 / 8.1 / 8.2 / 8.3

Chapter 26. PL/Perl - Perl Procedural Language

Table of Contents
26.1. Building and Installing
26.2. Using PL/Perl

PL/Perl allows you to write functions in the Perl programming language that may be used in SQL queries as if they were built into Postgres.

The PL/Perl intepreter is a full Perl interpreter. However, certain operations have been disabled in order to maintain the security of the system. In general, the operations that are restricted are those that interact with the environment. This includes filehandle operations, require, and use (for external modules). It should be noted that this security is not absolute. Indeed, several Denial-of-Service attacks are still possible - memory exhaustion and endless loops are two examples.

26.1. Building and Installing

In order to build and install PL/Perl if you are installing Postgres from source then the --with-perl must be supplied to the configure script. PL/Perl requires that, when Perl was installed, the libperl library was build as a shared object. At the time of this writing, this is almost never the case in the Perl packages that are distributed with the operating systems. A message like this will appear during the build to point out this fact:

*****
* Cannot build PL/Perl because libperl is not a shared library.
* Skipped.
*****
Therefore it is likely that you will have to re-build and install Perl manually to be able to build PL/Perl.

When you want to retry to build PL/Perl after having reinstalled Perl, then change to the directory src/pl/plperl in the Postgres source tree and issue the commands

gmake clean
gmake all
gmake install

The createlang command is used to install the language into a database.

$ createlang plperl template1
If it is installed into template1, all future databases will have the language installed automatically.
Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group