On Sun, Mar 08, 2020 at 10:29:09AM -0400, stan wrote: > Still working on updateable views. > > Wish list item, a way to see the entire query that caused the trigger to > fire. > > Now on to something i hope I can get. Can I see what the verb that caused > the trigger to fire is? IE UPDATE, INSERT, DELETE? > > -- > "They that would give up essential liberty for temporary safety deserve > neither liberty nor safety." > -- Benjamin Franklin > >
OH, what was I thinking, that is controled by the trigger.
-- "They that would give up essential liberty for temporary safety deserve neither liberty nor safety." -- Benjamin Franklin
Hi,
Still, you can access that information in the TG_OP variable available in trigger functions because you can define triggers firing on multiple operation types.
For instance this is an example from the Postgres documentation:
CREATE TRIGGER emp_audit
INSTEAD OF INSERT OR UPDATE OR DELETE ON emp_view FOR EACH ROW EXECUTE FUNCTION update_emp_view();