Hi,
simple violate a contraint.
my test:
drop table if exists x;
create temp table x (
id int not null primary key,
name text
);
-- check against not null
create rule test_rule as on delete to x where old.id=1 do instead update
x set id=null;
insert into x values( 1,'a'),(2,'b');
select * from x;
-- fails
delete from x;
delete from x where id!=1;
select * from x;
regards
Thomas
Am 19.12.2011 08:16, schrieb Капралов Александр:
> I found a simple solution, but i don't know how to add raises an exception here.
>
> create rule protect_profile_id0_update as on update to web.profile
> where old.id = 0 do instead nothing;
> create rule protect_profile_id0_delete as on delete to web.profile
> where old.id = 0 do instead nothing;
>