5

I am a beginner with PostgreSQL. I got a SQL patch of PostgreSQL and while executing the SQL to configure it at my end. I am getting following error. My background is MySQL.

Query

CREATE FUNCTION wine_entry_script() RETURNS trigger
    LANGUAGE plperlu AS
$$
   #!/usr/bin/perl -w
   use strict;
   require ('/var/lib/pgsql/data/Trigger_Processor1.0.pl');
$$;

Error

ERROR: language "plperlu" does not exist SQL state: 42704 Hint: Use CREATE LANGUAGE to load the language into the database.

Erwin Brandstetter
  • 605,456
  • 145
  • 1,078
  • 1,228
Aakash
  • 53
  • 1
  • 1
  • 4
  • `plperlu`? Is that a typo? Furthermore, the syntax is not correct, a good starting point would be the basic function body as in the [docs](http://www.postgresql.org/docs/current/static/plperl-funcs.html) – DrColossos Jan 16 '12 at 09:49
  • 2
    @DrColossos: `plperlu` is [not a typo](http://www.postgresql.org/docs/current/interactive/plperl-trusted.html). – Erwin Brandstetter Jan 16 '12 at 10:08
  • @ErwinBrandstetter Wasn't aware of that, good info though! – DrColossos Jan 16 '12 at 10:28

3 Answers3

10

plperlu is the untrusted version of plperl. It is one of the prepared choices in PostgreSQL. Have a look:

SELECT * FROM pg_language;

If you want to use it, you have to run once per database:

CREATE LANGUAGE plperlu;

Be aware of security implications, though.
More in the manual.


Most Linux systems come with Perl installed. Under Windows, make sure that some flavor of Perl is installed in your system (providing the required dll files) before you can create the language.

Related:

Community
  • 1
  • 1
Erwin Brandstetter
  • 605,456
  • 145
  • 1,078
  • 1,228
  • thanks Erwin. Whlile executing CREATE LANGUAGE plperlu; I am gettingERROR: could not load library "C:/Program Files (x86)/PostgreSQL/9.1/lib/plperl.dll": The specified module could not be found. does that means I need to install it ? SQL state: 58P01 – Aakash Jan 16 '12 at 10:49
  • @testingdeveloper: The required perl module is obviously not found where postgres would expect it. I don't know much about the windows build. You might have to install an appropriate version of perl first. – Erwin Brandstetter Jan 16 '12 at 11:11
  • Thanks, but I am getting this error: could not load library "C:/Program Files (x86)/PostgreSQL/9.5/lib/plperl.dll – Anvesh Sep 09 '16 at 08:22
  • Please help on this. – Anvesh Sep 09 '16 at 08:23
  • @Anvesh: I added some hints for Windows above. – Erwin Brandstetter Sep 09 '16 at 11:57
4

create the extension and then the language.

CREATE EXTENSION plperl;
CREATE LANGUAGE plperlu;
ruth542
  • 71
  • 2
  • 10
0

First you install plperl in your server by below command

sudo apt install postgresql-plperl-13

(Change 13 with your current version)

now login with postgres

sudo su - postgres

Now you login with database which require this extension

psql -d nameofdatabase

CREATE EXTENSION plperl;

CREATE LANGUAGE plperlu;

Now its ready for use