Thread: plpgsql language not recognized

plpgsql language not recognized

From
David Merrill
Date:
I am trying to create a function, and I am getting the following error
message:

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

This is the text of the function:


CREATE FUNCTION rational (int1, int2) RETURNS text AS '
DECLARE
    numerator ALIAS FOR $1;
    denominator ALIAS FOR $2;
    txtRational text;
BEGIN
    txtRational := to_char(numerator,''999999'');
    RETURN txtRational;
END;
' LANGUAGE 'plpgsql';


This is my first function, and obviously it isn't complete yet. It is
supposed to take two integer values, used to store the numerator and
denominator of a rational value, and return it as a string in the form
'numerator/denominator' when it is finished.

Any help much appreciated.

tia,
David


--
Dr. David C. Merrill                     http://www.lupercalia.net
Linux Documentation Project                dmerrill@lupercalia.net
Collection Editor & Coordinator            http://www.linuxdoc.org
                                       Finger me for my public key

--
I stopped believing in Santa Claus when I was six. Mother took me to see him in a department store and he asked for my
autograph.
        -- Shirley Temple


Re: plpgsql language not recognized

From
Tom Lane
Date:
David Merrill <dmerrill@lupercalia.net> writes:
> ERROR:  Unrecognized language specified in a CREATE FUNCTION:
> 'plpgsql'. Recognized languages are sql, C, internal and the created
> procedural languages.

plpgsql isn't installed (made available in a particular database) by
default.  Use the createlang script to make it available.

            regards, tom lane

Re: plpgsql language not recognized

From
Mike Castle
Date:
On Thu, Dec 21, 2000 at 11:11:40AM -0500, Tom Lane wrote:
> plpgsql isn't installed (made available in a particular database) by
> default.  Use the createlang script to make it available.

Which would be more recommended:

createlang or postgresql-7.0.3/src/pl/plpgsql/enable_plpgsql?

mrc
--
       Mike Castle       Life is like a clock:  You can work constantly
  dalgoda@ix.netcom.com  and be right all the time, or not work at all
www.netcom.com/~dalgoda/ and be right at least twice a day.  -- mrc
    We are all of us living in the shadow of Manhattan.  -- Watchmen

Re: plpgsql language not recognized

From
Tom Lane
Date:
Mike Castle <dalgoda@ix.netcom.com> writes:
> On Thu, Dec 21, 2000 at 11:11:40AM -0500, Tom Lane wrote:
>> plpgsql isn't installed (made available in a particular database) by
>> default.  Use the createlang script to make it available.

> Which would be more recommended:

> createlang or postgresql-7.0.3/src/pl/plpgsql/enable_plpgsql?

createlang is tested and maintained, the other isn't.  We probably
ought to remove that file entirely ...

            regards, tom lane