Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Install PL/Perl in PostgreSQL [closed]

I using PostgreSQL and I want to create a function in pl/perl, but the PostgreSQL doesn't contain pl/perl.

When I type createlang plperlu databasename it shows:

createlang: language installation failed: ERROR : could not open extension control file "/usr/local/pgsql/share/extension/plperlu.control": No such file or directory

How can I install plperlu?

The PostgreSQL version is 9.1 in CentOS 5.8

like image 582
AntiGMO Avatar asked Aug 27 '12 03:08

AntiGMO


1 Answers

Before you do anything else, back up your database. At minimum use pg_dump to take a SQL dump and put it on another computer. Then proceed, but understand that you're likely to cause downtime or even data loss if you muck this up.

(For anyone else reading this, it only applies to PostgreSQL installed from source code. You are probably using a packaged version instead, in which case you should install the package for postgresql-contrib or postgresql-plperl for your distro. Names will vary, so do a search in your package management system.)


It seems highly likely that your co-worker installed PostgreSQL from source code and didn't enable PL/Perl. If you want PL/Perl you will need to re-compile.

Install the Perl development package, which should be called perl-devel, eg:

yum install perl-devel

When you re-compile PostgreSQL use the --with-perl argument to ./configure. You should be able to find the PostgreSQL source code tree that your co-worker used somewhere on the system - try searching for config.log and see if there's a PostgreSQL source code tree in the same place.

If you can't find it you'll have to either:

  • Download fresh PostgreSQL sources and compile them as per the PostgreSQL documentation; or
  • Shut down your current server and install the yum.postgresql.org RPMs to replace it.

Honestly, if you don't know Linux this isn't a good way to start. Find somebody to help you who's worked with Linux systems before and is familiar with basic tasks like installing packages. Get them to help you to replace the source-installed PostgreSQL with a PostgreSQL install from the yum.postgresql.org packages, and preferably update your rather outdated operating system install to a current one.

like image 101
Craig Ringer Avatar answered Sep 17 '22 20:09

Craig Ringer