Normally you will be doing different things and have two different functions for insert and delete OR you have to do if statements on something like TG_OP to see if insert or delete operation in a single function. What is your code that runs for an update?