From: Igal @ Lucee.org <igal@lucee.org>
To: pgsql-general <pgsql-general@postgresql.org>
Subject: How to tell which event was fired in Trigger function
Date: Wed, 11 Jul 2018 10:36:49 -0700
Message-ID: <a389c8ed-ad53-8622-2b16-2f0c84141d25@lucee.org> (raw)
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?
Thanks,
Igal Sapir
Lucee Core Developer
Lucee.org <http://lucee.org/;
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-general@postgresql.org
Cc: igal@lucee.org
Subject: Re: How to tell which event was fired in Trigger function
In-Reply-To: <a389c8ed-ad53-8622-2b16-2f0c84141d25@lucee.org>
References: <a389c8ed-ad53-8622-2b16-2f0c84141d25@lucee.org>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox