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

2020-12-25 Thread Adrian Klaver
On 12/25/20 10:19 AM, Andreas Joseph Krogh wrote: På fredag 25. desember 2020 kl. 17:48:39, skrev Adrian Klaver mailto:adrian.kla...@aklaver.com>>: On 12/25/20 5:52 AM, Andreas Joseph Krogh wrote: > Hi. > I need to set a value in a trigger if a column is explicitly NOT >

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

2020-12-25 Thread Andreas Joseph Krogh
På fredag 25. desember 2020 kl. 17:48:39, skrev Adrian Klaver < adrian.kla...@aklaver.com >: On 12/25/20 5:52 AM, Andreas Joseph Krogh wrote: > Hi. > I need to set a value in a trigger if a column is explicitly NOT > specified in UPDATE's SET-clause. > Like

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

2020-12-25 Thread Tom Lane
Adrian Klaver writes: > On 12/25/20 5:52 AM, Andreas Joseph Krogh wrote: >> Or - is it possible to check for this in the trigger-function? > As David Johnson mentioned you can check whether the value for the > column is changed: > NEW.animal <> OLD.animal Better to use IS DISTINCT FROM, to

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

2020-12-25 Thread Adrian Klaver
On 12/25/20 5:52 AM, Andreas Joseph Krogh wrote: 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

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

2020-12-25 Thread David G. Johnston
On Friday, December 25, 2020, Andreas Joseph Krogh wrote: > Hi. > > I need to set a value in a trigger if a column is explicitly NOT specified > in UPDATE's SET-clause. > > Beat you can probably do is rely on the fact that if its not specified it doesn’t change and do nothing within the trigger

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

2020-12-25 Thread Andreas Joseph Krogh
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();