Preventing Deletions with triggers

Поиск
Список
Период
Сортировка
От Jeff Post
Тема Preventing Deletions with triggers
Дата
Msg-id 6.1.0.6.0.20040519090934.025963a8@mail.milwaukee.k12.wi.us
обсуждение исходный текст
Ответы Re: Preventing Deletions with triggers  (Achilleus Mantzios <achill@matrix.gatewaynet.com>)
Re: Preventing Deletions with triggers  (Manuel Sugawara <masm@fciencias.unam.mx>)
Re: Preventing Deletions with triggers  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-sql
I would like to have a trigger that fires whenever a delete is attempted. 
The trigger should update the status field of the tupple (to remove the 
tupple form the active set of tupples).


Here is what I got:

CREATE or replace FUNCTION person_fake_delete() RETURNS TRIGGER AS '    BEGIN        OLD.status := 1; -- This does the
fakedeletion        RETURN NULL;  -- I thought this would prevent the delete from 
 
actually happening.    END;
' LANGUAGE 'plpgsql';

create trigger person_fake_delete
before delete on person
for each row EXECUTE PROCEDURE
person_fake_delete();

This however does not work.  the tupple is still deleted from the 
table.    Any Ideas?

Thanks,    Jeff Post



В списке pgsql-sql по дате отправления:

Предыдущее
От: Richard Huxton
Дата:
Сообщение: Re: v7.2 triggers and foreign keys
Следующее
От: Charlie Clark
Дата:
Сообщение: Problem with JOINS