Re: Determine in a trigger if UPDATE query really changed anything

2018-12-24 Thread Mitar
Hi! On Mon, Dec 24, 2018 at 12:31 AM George Neuner wrote: > You're still thinking in terms of deltas for the whole table. Think > individual rows instead. > > With a BY ROW trigger, the difference between the NEW and OLD > variables lets you see the changes to the particular row. I was thinking

Re: Determine in a trigger if UPDATE query really changed anything

2018-12-24 Thread George Neuner
On Sun, 23 Dec 2018 20:21:22 -0800, Mitar wrote: >Currently I am doing: > >CREATE TRIGGER some_trigger AFTER UPDATE ON my_table REFERENCING NEW >TABLE AS new_table OLD TABLE AS old_table FOR EACH STATEMENT EXECUTE >FUNCTION my_trigger(); > >In my trigger I do: > >PERFORM * FROM ((TABLE new_table

Determine in a trigger if UPDATE query really changed anything

2018-12-23 Thread Mitar
Hi! Currently I am doing: CREATE TRIGGER some_trigger AFTER UPDATE ON my_table REFERENCING NEW TABLE AS new_table OLD TABLE AS old_table FOR EACH STATEMENT EXECUTE FUNCTION my_trigger(); In my trigger I do: PERFORM * FROM ((TABLE new_table EXCEPT TABLE new_table) UNION ALL (TABLE new_table EXCE