View Single Post

   
  #2 (permalink)  
Old 04-10-2008, 12:11 PM
Tom Lane
 
Posts: n/a
Default Re: BUG #3696: FK integrity check bypassed using rules.

"Pierre-yves Strub" <pierre.yves.strub@gmail.com> writes:
> CREATE TABLE data (
> id INTEGER PRIMARY KEY DEFAULT nextval('sequence'),
> ref_id INTEGER NULL REFERENCES data(id) ON DELETE CASCADE
> );


> CREATE RULE data_delete_rule
> AS ON DELETE TO data WHERE OLD.ref_id IS NOT NULL
> DO INSTEAD NOTHING;


Yes, a poorly designed rule can invalidate all kinds of expectations
about behavior. This isn't a bug in my humble opinion.

regards, tom lane

---------------------------(end of broadcast)---------------------------
TIP 2: Don't 'kill -9' the postmaster

Reply With Quote