determining current table & record within stored procedure ? - Mailing list pgsql-general

From paul
Subject determining current table & record within stored procedure ?
Date
Msg-id 39f96e1b$0$90701@news2.zeelandnet.nl
Whole thread Raw
List 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@zeelandnet.nl




pgsql-general by date:

Previous
From: "Neil Davis"
Date:
Subject: Selects in server side functions
Next
From: "J.Luis Magaña M."
Date:
Subject: PostgreSQL as NT Service