How to specify that a trigger should fire when column is NOT in SET-clause?

From: Andreas Joseph Krogh <andreas(at)visena(dot)com>
To: pgsql-general(at)lists(dot)postgresql(dot)org
Subject: How to specify that a trigger should fire when column is NOT in SET-clause?
Date: 2020-12-25 13:52:28
Message-ID: VisenaEmail.26.7cbf2947c8d23ceb.1769a2755ff@tc7-visena
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general


Hi.

I need to set a value in a trigger if a column is explicitly NOT specified in
UPDATE's SET-clause.

Like for example having a "BEFORE UPDATE OF NOT"
create TRIGGER my_trigger BEFORE UPDATE OF NOT modified ON my_table FOR EACH
ROW WHEN(OLD.val <> NEW.val) EXECUTE PROCEDURE do_stuff();

I want the trigger to be fired when the column "modified" is NOT specified, is
it possible?
Or - is it possible to check for this in the trigger-function?

--
Andreas Joseph Krogh
CTO / Partner - Visena AS
Mobile: +47 909 56 963
andreas(at)visena(dot)com <mailto:andreas(at)visena(dot)com>
www.visena.com <https://www.visena.com>
<https://www.visena.com>

Responses

Browse pgsql-general by date

  From Date Subject
Next Message David G. Johnston 2020-12-25 16:04:16 Re: How to specify that a trigger should fire when column is NOT in SET-clause?
Previous Message Tom Lane 2020-12-25 06:09:02 Re: Stats for indexes on expressions