Re: Another INSTEAD OF TRIGGER question - Mailing list pgsql-general

From Sándor Daku
Subject Re: Another INSTEAD OF TRIGGER question
Date
Msg-id CAKyoTgYPP5+qk16BVaitZNdbqXTQ87_uku47iw1uRC0sFJVcBw@mail.gmail.com
Whole thread Raw
In response to Re: Another INSTEAD OF TRIGGER question  (stan <stanb@panix.com>)
List pgsql-general
On Sun, 8 Mar 2020 at 15:31, stan <stanb@panix.com> wrote:
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();
Regards,
Sándor

pgsql-general by date:

Previous
From: Rob Sargent
Date:
Subject: Re: Another INSTEAD OF TRIGGER question
Next
From: "Peter J. Holzer"
Date:
Subject: Re: Restrict user to create only one db with a specific name