naeem.bari@agilissystems.com ("Naeem Bari") writes:
> I understand. Makes sense. Is there anyway for my trigger function to
> "know" that it is being called on a delete or on an update? Because I do
> need to "return new" on update... and I really don't want to write 2
> different functions, one for update and one for delete...
>
Yes, plpgsql sets a variable TG_OP to INSERT, UPDATE or DELETE.
so, for example
IF ( TG_OP = ''DELETE'' ) THEN
RETURN old;
ELSE
RETURN new;
END IF;
--
Remove -42 for email