language "plpgsql" does not exist - Mailing list pgsql-novice

From Keith Worthington
Subject language "plpgsql" does not exist
Date
Msg-id 20041216230204.M24736@narrowpathinc.com
Whole thread Raw
Responses Re: language "plpgsql" does not exist  (Terry Lee Tucker <terry@esc1.com>)
Re: language "plpgsql" does not exist  (Michael Fuhr <mike@fuhr.org>)
List pgsql-novice
Hi All,

I am trying to build a function to insert or update data in one table from
date stored in another table.  Eventually I hope to trigger this process based
on data being INSERTed into the original table.  I have written the code below
based on the documentation and some help from this list.  When I execute the
code I get this error.

ERROR:  language "plpgsql" does not exist

What does this mean?  How do I correct the error?

Kind Regards,
Keith

PS This is PostgreSQL v7.3.6 on Red Hat Enterprise Linux v3

CREATE FUNCTION xfer_gl_account_data() RETURNS INTEGER AS '
   DECLARE
      rcrd_gl_account RECORD;
   BEGIN
      FOR rcrd_gl_account IN SELECT
data_transfer.tbl_peachtree_gl_acount.account_id,

data_transfer.tbl_peachtree_gl_acount.description,

data_transfer.tbl_peachtree_gl_acount.account_type,
                                    data_transfer.tbl_peachtree_gl_acount.inactive
                               FROM data_transfer.tbl_peachtree_gl_acount
                              ORDER BY gl_number
      LOOP
         SELECT peachtree.tbl_gl_account.account_id
           FROM peachtree.tbl_gl_account
          WHERE peachtree.tbl_gl_account.account_id = rcrd_gl_account.account_id;
         IF NOT FOUND THEN
            INSERT INTO peachtree.tbl_gl_account
                        ( peachtree.tbl_gl_account.account_id,
                          peachtree.tbl_gl_account.description,
                          peachtree.tbl_gl_account.account_type,
                          peachtree.tbl_gl_account.inactive )
                 VALUES ( rcrd_gl_account.account_id,
                          rcrd_gl_account.description,
                          rcrd_gl_account.account_type,
                          rcrd_gl_account.inactive );
         ELSE
            UPDATE peachtree.tbl_gl_account
               SET peachtree.tbl_gl_account.description =
rcrd_gl_account.description,
                   peachtree.tbl_gl_account.account_type =
rcrd_gl_account.account_type,
                   peachtree.tbl_gl_account.inactive = rcrd_gl_account.inactive
             WHERE peachtree.tbl_gl_account.account_id =
rcrd_gl_account.account_id;
         END IF;
      END LOOP;
      RETURN 1;
   END;
' LANGUAGE 'plpgsql';


______________________________________________
99main Internet Services http://www.99main.com


pgsql-novice by date:

Previous
From: "Luiz K. Matsumura"
Date:
Subject: Re: basic download and setup questions
Next
From: Afton & Ray Still
Date:
Subject: Re: basic download and setup questions