sferriol <[EMAIL PROTECTED]> writes:
> and i create a rule for deleting using the view:
> CREATE RULE ALL_CENTERS_DEL AS ON DELETE TO all_centers
> DO INSTEAD (
>       DELETE FROM center_var WHERE
>       center_id = OLD.center_id;
>       DELETE FROM center WHERE
>       center_id = OLD.center_id;
> );

> but i this rule delete only line in center_var
> and do not remove the line in center table

Once you delete the center_var row, there is no row in the view that
matches the id, so the comparison against OLD.center_id fails.

You could possibly make the view use an outer join, and be careful to
delete the dependent row first in the rule.  Or maybe one of the tables
can be given a foreign-key dependency on the other, with ON DELETE CASCADE
behavior, and then the view rule need only delete explicitly from the
master table.

                        regards, tom lane

---------------------------(end of broadcast)---------------------------
TIP 3: if posting/reading through Usenet, please send an appropriate
      subscribe-nomail command to [EMAIL PROTECTED] so that your
      message can get through to the mailing list cleanly

Reply via email to