PL/pgSQL syntax help?

From: Jinsoo Hwang <jshwang(at)anova(dot)inha(dot)ac(dot)kr>
To: pgsql-general(at)postgresql(dot)org
Subject: PL/pgSQL syntax help?
Date: 2000-10-04 14:16:03
Message-ID: Pine.WNT.4.10.10010042259180.-376995@jshwang.inha.ac.kr
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hi,
I would like to know how to convert the following
Oracle syntax to postgreSQL using PL/pgSQL.
----------------------
create trigger mailing_list_reg_date
before insert on mailing_list
for each row
when (new.reg_date is null)
begin
:new.reg_date := sysdate;
end;
---------------------

Here is what I did(which obviously doesn't work. :-( ).

-----------
create function reg_yes () returns opaque as
'
begin
if new.reg_date isnull then
new.reg_date := ''now'';
endif;
end;
' language 'plpgsql';
------------

and

----------
create trigger mailing_list_reg_date
before insert on mailing_list
for each row
execute procedure reg_yes();
-----------

Both step went OK until I tried to test by inserting into
mailing_list without reg_date.

db=> insert into mailing_list ...

ERROR plpgsql: cache lookup for proc 163937 failed.

That is all my story. Sorry for the long post.
(ver: 7.0.2 on solaris 2.7)

Thank you

Jinsoo

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Andrew Gould 2000-10-04 14:39:22 drop column?
Previous Message Poul L. Christiansen 2000-10-04 13:54:11 Re: alternative DB locations