Pantek Library
Hosting Provided By
CybrHost
High Speed Hosting

Re: [GENERAL]

From: Ron St-Pierre <ron.pgsql(at)shaw.ca>
Date: Wed Oct 31 2007 - 00:50:13 EDT


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

---------------------------(end of broadcast)---------------------------
TIP 4: Have you searched our list archives?

               http://archives.postgresql.org/ Received on Tue Oct 30 23:57:06 2007

This archive was generated by hypermail 2.1.8 : Mon Jun 16 2008 - 19:07:50 EDT


Contact Us  Legal Notices  Order Services Online 
Pantek Home  Privacy Policy  IT news  Site Map  Pantek Library