Suporte PK <fknoedt@gmail.com> writes:
> IF TG_OP = 'UPDATE' AND OLD.field != NEW.field THEN
> ...
> The question is: if the trigger was not fired by an UPDATE event,
> shouldn't it make the first test and then ignore the rest of the condition?
No. This is a very very common error. The behavior is not as
short-circuity as you'd think. Break it into two IFs.
regards, tom lane