Re: creating a function in psql - Mailing list pgsql-general

From Julie Hunt
Subject Re: creating a function in psql
Date
Msg-id 38EAC8EF.7402ED85@chac.qld.edu.au
Whole thread Raw
In response to creating a function in psql  (rachel cox <rachel@kiwiconsulting.com>)
List pgsql-general
Hi
I've just done the very same thing today and found how to add plpgsql
into the pg_languages.
Firstly I located where plpgsql was on our server.
In that directory there was a file called install which gives
instructions using make file and then adding the language to your
pg_language table.
It also gives instructions on how to add it to the template1 so all
created databases will include the language.
I found that I didn't need to use makefile and was able to just do the
psql dbname <mklang.sql

This was the instruction and location of our plpgsql:-

psql test
</usr/ports/databases/postgresql/work/postgresql-6.5.2/src/pl/plpgsql/src/mklang.sql

Once this is created successfully, then you can write the functions
using plpgsql.

Hope this helps

Regards,
Julie

rachel cox wrote:

> hi,
>
> i'm trying to create a very basic function in psql and i keep getting
> the error:
> QUERY: CREATE FUNCTION add_one () RETURNS int4 AS '
>     BEGIN
>         RETURN 1 + 1;
>     END;
> ' LANGUAGE 'plpgsql';
> ERROR:  Unrecognized language specified in a CREATE FUNCTION:
> 'plpgsql'.  Recognized languages are sql, C, internal and the created
> procedural languages.
>
> does anyone know how i can get this language to be recognized?
>
> also, this is probably related, i was trying to set the date string
> using
> SET DATESTYLE
>
> and it doesn't seem to know what i'm talking about.
>
> can anyone help??? thanks so much in advance,
>
> rachel


pgsql-general by date:

Previous
From: "Bruce Bantos"
Date:
Subject: startup / shutdown scripts for *BSD?
Next
From: Julie Hunt
Date:
Subject: Re: creating a function in psql