Search Postgresql Archives

Re: How to tell which event was fired in Trigger function

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 07/11/2018 10:36 AM, Igal @ Lucee.org wrote:
Hi,

I am writing a trigger function that is used after DELETE, INSERT, and UPDATE, like so:

     CREATE TRIGGER tr_name AFTER DELETE OR INSERT OR UPDATE ...

How can I tell inside the trigger function if the event was DELETE or INSERT/UPDATE?

The table has a `NOT NULL id` column, so I am thinking that maybe a DELETE will have a NULL value in NEW.id?  Will that work?  Is there a better way?

https://www.postgresql.org/docs/10/static/plpgsql-trigger.html


Thanks,

Igal Sapir
Lucee Core Developer
Lucee.org <http://lucee.org/>



--
Adrian Klaver
adrian.klaver@xxxxxxxxxxx




[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]

  Powered by Linux