Skip site navigation (1) Skip section navigation (2)

Re: Install new perl test function in PostgreSQL

From: Jure Kobal <j(dot)kobal(at)gmx(dot)com>
To: pgsql-novice(at)postgresql(dot)org
Cc: Jignesh Shah <jignesh(dot)shah1980(at)gmail(dot)com>
Subject: Re: Install new perl test function in PostgreSQL
Date: 2009-08-25 17:54:41
Message-ID: (view raw or whole thread)
Lists: pgsql-novice
First you need to install plperl into your database if you haven't already.

createlang -h <host> -p <port> -U <user> plperl <db_name>

-h, -p aren't really needed if you work on the box where postgres is installed.

After that you just insert/install the function into the database where you have 
installed plperl and it should work via select <function_name>.

Jure Kobal

On Tuesday 25 of August 2009 19:01:44 Jignesh Shah wrote:
> Hi,
> I have taken below perl example form PostgreSQL documentation Chapter: 40.1
> CREATE FUNCTION perl_max (integer, integer) RETURNS integer AS $$
>         if ($_[0] > $_[1]) { return $_[0]; }
>         return $_[1];
> $$ LANGUAGE plperl;
> I understood everything but I don't know how to integrate/install this new
> function with PostgreSQL so that when I run "select perl_max(1,2)" query,
> it returns 2. I have PostgreSQL install on one of my UNIX Server and has
> root privileges. Please help me to install this function.
> Thanks,
> Jignesh

In response to


pgsql-novice by date

Next:From: JanaDate: 2009-08-25 19:04:11
Subject: Number of rows
Previous:From: Jignesh ShahDate: 2009-08-25 17:01:44
Subject: Install new perl test function in PostgreSQL

Privacy Policy | About PostgreSQL
Copyright © 1996-2015 The PostgreSQL Global Development Group