copy old row trigger

From: joepie Platteau <joepie(dot)Platteau(at)kulak(dot)ac(dot)be>
To: pgsql-novice(at)postgresql(dot)org, pgsql-general(at)postgresql(dot)org
Subject: copy old row trigger
Date: 2002-12-14 13:28:15
Message-ID: 3DFB31EF.5040004@kulak.ac.be
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general pgsql-novice

Hi,
I have the following problem :

I have 2 tables : T-Alumni and T-AlumniB (exact copy of Alumni, except
3 extra columns : user, date, time)
On events 'update' and 'delete' in table Alumni, I want to copy the old
row to AlumniB and add the username, date and time.

So I created a function :

CREATE FUNCTION trigfunc_add_alumni() RETURNS opaque AS '
begin
insert into T-Alumni-B values (old.Id_Person, old.Member,
old.Payed, old.Nr, old.Alumninr, old.Acyear, old.Styear);
return NULL;
end;
' LANGUAGE 'plpgsql';

Then I wanted to create a trigger using this function with the properties :

Table T-Alumni
Executes AFTER
Event UPDATE, DELETE
For each ROW
Function trigfunc_add_alumni()

Then I get the error :

An error has occurred in pgAfdmin II:frmTrigger.cmdOK_Click : Number 5
Description : Invalid procedure call or argument

Can someone tell me what i'm doing wrong? Or is there another better
solution for this problem?!
Thanks!!

Joepie Platteau.

Browse pgsql-general by date

  From Date Subject
Next Message Igor Georgiev 2002-12-14 15:31:58 Re: [GENERAL] PostgreSQL Global Development Group
Previous Message mlw 2002-12-14 13:26:51 Re: [GENERAL] PostgreSQL Global Development Group Announces

Browse pgsql-novice by date

  From Date Subject
Next Message Mat Rice 2002-12-15 15:19:47 Anyone using postgreSQL on Mac OS X installed by Fink?
Previous Message paul butler 2002-12-14 10:13:59 Re: recommended reading