On Aug 17, 2007, at 16:03, Jeff Davis wrote:
> The reason that rr2 was not updated was that the rule executes
> these two
> statements:
>
> UPDATE rr1 SET i=NEW.i, d1=NEW.d1 WHERE i=OLD.i;
> UPDATE rr2 SET i=NEW.i, d2=NEW.d2 WHERE i=OLD.i;
>
> However, the second statement won't do anything, because the tuples
> you're updating no longer match the predicate in the outer query
> "update
> rr set i=41 where i=11". So that means that it actually matters which
> column you specify in the where clause of the outer update.
To me, if I properly understand the example, the moral of the story
is not to change primary key column values (unless, perhaps, your FK
constraints have ON UPDATE CASCADE).
Best,
David