Installing procedural language(s) - Mailing list pgsql-novice

From John Burski
Subject Installing procedural language(s)
Date
Msg-id 3BEAC82B.7040300@911ep.com
Whole thread Raw
Responses Re: Installing procedural language(s)
List pgsql-novice
I've running version 7.0.3 on a Red Hat 6.2 box (twin 500 MHz Celerons,
2.2.12-20smp kernel, 7.0.3 installed from rpms) and I've encountered a
bit of difficulty with functions and procedural languages while working
through Bruce's book.  Specifically, I've attempted to create the
"spread" function that is shown on page 211.  My input looks like this:

<snip>
johnb=# create function spread(text)
johnb-# returns text
johnb-# as 'DECLARE
johnb'#         str text;
johnb'#         ret text;
johnb'#         i   integer;
johnb'#         len integer;
johnb'#
johnb'#     BEGIN
johnb'#         str := upper($1);
johnb'#         ret := "";
johnb'#         i   := 1;
johnb'#         len := length(str);
johnb'#         WHILE i <= len LOOP
johnb'#            ret := ret || substr(str,i,1) || " ";
johnb'#            i := i + 1;
johnb'#         END LOOP;
johnb'#         RETURN ret;
johnb'#     END;'
johnb-# LANGUAGE 'plpgsql';
</snip>

When I "submit" the input, I receive the following error message:

<snip>
ERROR:  Unrecognized language specified in a CREATE FUNCTION:
'plpgsql'.  Recognized languages are sql, C, internal and the created
procedural languages.
</snip>

This led me to believe that the "plpgsql" language was not installed.  I
went to the command line and entered "createlang -l -d johnb" and
received the following information:

<snip>
   Procedural languages
Name | Trusted? | Compiler
------+----------+----------
(0 rows)
</snip>

Seeing that there didn't seem to be any procedural languages installed,
I attempted to install "plpgsql" by entering "createlang plpgsql
johnb".  The system responded with the "Password:" prompt, at which
point I entered my password.  The system prompted for the password
again, so I entered it again.  Then the following was displayed (I've
included the prompts):

<snip>
[johnb@ophelia johnb]$ createlang plpgsql johnb
Password: Password: createlang: A function named 'plpgsql_call_handler'
already exists. Installation aborted.
</snip>

I should mention that the PGLIB environment variable is set to
"/usr/lib/pgsql" (which is where the "plpgsql.so" shared object is
located).  Could this be in error?

So I'm at an impass - I don't know what to try next.  Should I try the
"droplang" command and then attempt to "re-install"?

Thanks for your help.

--
John Burski
I.T. Manager and Systems Administration
911 Emergency Products, Inc.
25 Sixth Avenue North
Saint Cloud, MN  56303
John.Burski@911ep.com

800-863-6911, extension 221
FAX: 800-863-2991
www.911ep.com


pgsql-novice by date:

Previous
From: Isaac Sparrow
Date:
Subject: Re: X manager?
Next
From: "KUCHARSKI, DAVID R."
Date:
Subject: It's dead and won't get up!!