Hi,
I have:
CREATE TABLE a ( id SERIAL, val INT4 ) ;
I would like to create some rules to keep "a" free from rows where
val == 0. Something like:
CREATE RULE a_insert AS ON INSERT TO a WHERE NEW.val = 0 DO INSTEAD NOTHING ;
CREATE RULE a_update AS ON UPDATE TO a WHERE NEW.val = 0 DO INSTEAD DELETE FROM a WHERE id = NEW.id ;
Does this look right? I think there should be a better way to express
the second rule...
Thanks,
-itai