Re: Another INSTEAD OF TRIGGER question

From: Sándor Daku <daku(dot)sandor(at)gmail(dot)com>
To: stan <stanb(at)panix(dot)com>
Cc: pgsql-general(at)lists(dot)postgresql(dot)org
Subject: Re: Another INSTEAD OF TRIGGER question
Date: 2020-03-08 14:56:56
Message-ID: CAKyoTgYPP5+qk16BVaitZNdbqXTQ87_uku47iw1uRC0sFJVcBw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Sun, 8 Mar 2020 at 15:31, stan <stanb(at)panix(dot)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

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Peter J. Holzer 2020-03-08 16:30:59 Re: Restrict user to create only one db with a specific name
Previous Message Rob Sargent 2020-03-08 14:33:58 Re: Another INSTEAD OF TRIGGER question