determining current table & record within stored procedure ?

Поиск
Список
Период
Сортировка
От paul
Тема determining current table & record within stored procedure ?
Дата
Msg-id 39f96e1b$0$90701@news2.zeelandnet.nl
обсуждение исходный текст
Список 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 по дате отправления:

Предыдущее
От: "Neil Davis"
Дата:
Сообщение: Selects in server side functions
Следующее
От: "J.Luis Magaña M."
Дата:
Сообщение: PostgreSQL as NT Service