Re:

From: Ron St-Pierre <ron(dot)pgsql(at)shaw(dot)ca>
To: carter ck <carterck32(at)hotmail(dot)com>
Cc: "pgsql-general(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)org>
Subject: Re:
Date: 2007-10-31 04:50:13
Message-ID: 47280985.3020103@shaw.ca
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

carter ck wrote:
> Hi all,
>
> I was trying to create function in postgres, but it returns error mentioning the language is NOT defined.
>
> The function is as following:
>
> CREATE OR REPLACE FUNCTION test_word_count(TEXT, TEXT) RETURNS INTEGER AS $$
> DECLARE
> d_word ALIAS FOR $1;
> d_phrase ALIAS FOR $2;
> BEGIN
> IF d_word IS NULL OR d_phrase IS NULL THEN RETURN 0;
>
> RETURN 1;
>
> END;
>
> $$ LANGUAGE plpgsql;
>
> ERROR: language "plpgsql" does not exist
> HINT: Use CREATE LANGUAGE to load the language into the database.
>
> I was wonderring why it is not included by default? Or have I missed out something in the configuration!
>
>
According to the documentation, you have to explicitly create the
language in order to register the language with the database:

CREATE LANGUAGE plpgsql;

Assuming everything else is set up properly, this will allow you to use
the plpgsql language.

Ron

In response to

  • at 2007-10-31 03:07:36 from carter ck

Browse pgsql-general by date

  From Date Subject
Next Message Martijn van Oosterhout 2007-10-31 07:21:08 Re:
Previous Message carter ck 2007-10-31 03:07:36