Hi,

This is a small peace of code from the postgres docs :

CREATE TABLE emp (
    empname text,
    salary int4,
    last_date datetime,
    last_user name);

CREATE FUNCTION emp_stamp () RETURNS OPAQUE AS
    BEGIN
        -- Check that empname and salary are given
        IF NEW.empname ISNULL THEN
            RAISE EXCEPTION ''empname cannot be NULL value'';
        END IF;
        IF NEW.salary ISNULL THEN
            RAISE EXCEPTION ''% cannot have NULL salary'', NEW.empname;
        END IF;

        -- Who works for us when she must pay for?
        IF NEW.salary < 0 THEN
            RAISE EXCEPTION ''% cannot have a negative salary'',
NEW.empname;
        END IF;

        -- Remember who changed the payroll when
        NEW.last_date := ''now'';
        NEW.last_user := getpgusername();
        RETURN NEW;
    END;
' LANGUAGE 'plpgsql';

CREATE TRIGGER emp_stamp BEFORE INSERT OR UPDATE ON emp
    FOR EACH ROW EXECUTE PROCEDURE emp_stamp();


When I run this code in psql I get the following :

----------------------------------------------------------------------
rajesh@debian:~/tmp/code$ psql
Welcome to psql, the PostgreSQL interactive terminal.

Type:  \copyright for distribution terms
       \h for help with SQL commands
       \? for help on internal slash commands
       \g or terminate with semicolon to execute query
       \q to quit

rajesh=# \i plpgsql.sql
psql:plpgsql.sql:5: ERROR:  Relation 'emp' already exists
psql:plpgsql.sql:27: ERROR:  Unrecognized language specified in a CREATE
FUNCTION: 'plpgsql'.  Recognized languages are sql, C, internal and the
created procedural languages.
----------------------------------------------------------------------

I have compiled postgres 7.0.3 on my debian box using the sources from
Network Computing CD. 

Why is psql gives error that there is no support for
PL/pgsql the Procedural Language of Postgres ?

There is no switch in ./configure to enable or disable pl/pgsql. Any ideas
about the cause of the above error ?


Thanks in advance.

-- 
------------------------------------------------------------------------
Rajesh Fowkar                    http://rajesh.computers.webjump.com
Kurtarkar Nagari,Bldg-C,T4,      Powered By :Debian GNU/Linux with GRUB
Santacruz,Ponda-Goa-403401-INDIA             Kernel 2.4.4 & Mutt 1.3.18i
                                             IceWM 1.0.8-6  & KDE 2.1
"The expert at anything was once a beginner."  -Hayes 
------------------------------------------------------------------------

_______________________________________________
linux-india-help mailing list
[EMAIL PROTECTED]
http://lists.sourceforge.net/lists/listinfo/linux-india-help

Reply via email to