determining current table & record within stored procedure ?

From: "paul" <paulinfo(at)zeelandnet(dot)nl>
To: pgsql-general(at)postgresql(dot)org
Subject: determining current table & record within stored procedure ?
Date: 2000-10-27 12:00:22
Message-ID: 39f96e1b$0$90701@news2.zeelandnet.nl
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hi there, we're trying to accomplish the following;

in case of update/deletion in some tables we want to copy the record (for
history purposes) to a history table using a trigger.
example:

in a program the statement "delete from names where name="Smith" is going to
be executed on the server. I want to create a trigger ;

"create trigger <somename> before delete or update on <names> execute
<somefunc>

In this function <somefunc> I want to clone the current record wich is being
deleted/updated to another table with the same name prefixed by "history_"
so in this example to <history_names>.

Any ideas ?
I'd like to be able to test for the tablename & current record, in the
function wich is being called

thanks in advance
Paul

paulinfo(at)zeelandnet(dot)nl

Browse pgsql-general by date

  From Date Subject
Next Message Peter Pilsl 2000-10-27 12:13:07 Re: Time Difference
Previous Message cp 2000-10-27 11:50:05 problem with views