> query: > update mytable set field_a=XXX where yyyyy; > > mytrigger: before update > if(new.field_b>0) then > dosomething; > else > dosomethingelse; > > the trigger must operate only when i update field_b not when i'm updating > field_A. > > Calling the first query new.field_b is always '0' and 'dosomethingelse' is > executed; checking for "field_b is not null" is > useless, it's '0'. > There is a way to recognize that the query is not altering field_b?
if (new.field_b = old.field_b) then ... or, if there can be nulls if (new.field_b is not distinct from old.field_b) then ... Ivan
