Mage <mage(at)mage(dot)hu> writes:
> what's wrong with this?
> if new.parent <> old.parent then
> update test set name = ''old'' where parent = old.parent;
You should just do
if new.parent <> old.parent then
new.name = ''old'';
As you have it, the inner UPDATE pre-empts the outer because it is
applied first. When control comes back from the trigger, the row
the trigger was handed is now dead (already updated) and can't be
updated again.
regards, tom lane