Re: Determining if a table really changed in a trigger - Mailing list pgsql-general

From Marcos Pegoraro
Subject Re: Determining if a table really changed in a trigger
Date
Msg-id CAB-JLwaLz3d31QSTAg_+zVEK3XLJ=Jw8VZjm43E=xbY6v31TzQ@mail.gmail.com
Whole thread Raw
In response to Determining if a table really changed in a trigger  (Mitar <mmitar@gmail.com>)
Responses Re: Determining if a table really changed in a trigger
List pgsql-general

PERFORM * FROM ((TABLE old_table EXCEPT TABLE new_table) UNION ALL
(TABLE new_table EXCEPT TABLE old_table)) AS differences LIMIT 1;
IF FOUND THEN
  ... changed ...
END IF;

Maybe converting new and old records to json and text 
PERFORM * FROM (select ID, row_to_json(O.*)::text Old_Values, row_to_json(N.*)::text New_Values from old_table o full outer join new_table N using(ID) where Old_Values is distinct from New_Values) as differences LIMIT 1;

pgsql-general by date:

Previous
From: "David G. Johnston"
Date:
Subject: Re: How to copy rows into same table efficiently
Next
From: Miles Elam
Date:
Subject: Re: Determining if a table really changed in a trigger