"Pierre-yves Strub" <pierre(dot)yves(dot)strub(at)gmail(dot)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