Yippi !!
if new.object_id = old.object_id and
new.context_id = old.context_id and
new.security_inherit_p = old.security_inherit_p then
return new;
end if;
Both new.context_id and old.context_id are NULL therefor new != old.
I suppose adding:
if new.context_id is null and old.context_id is null then
return new;
end if;