firebirdsql wrote:
I have an after update/delete trigger and would like to know if the trigger was triggered by a cascade update/delete OR a user. Is this possible?
Tjioe Hian Pin answers:
I posted an almost similar case today, in my case I just want to distinguish cascade delete from user/regular delete.
Actually I have a trick to distinguish user update from cascade update. I always put an extra field in my table called Sig (or Tag, or whatever..), in my application I always increase Sig by 1 on every post update, then in the before update trigger I can detect:
if (new.Sig is distinct from old.Sig) then ...
and finally at the end of the trigger I restore the Sig:
new.Sig = old.Sig ;
So far it's working fine.