Re: Determining if a table really changed in a trigger

Поиск
Список
Период
Сортировка
От Marcos Pegoraro
Тема Re: Determining if a table really changed in a trigger
Дата
Msg-id CAB-JLwaLz3d31QSTAg_+zVEK3XLJ=Jw8VZjm43E=xbY6v31TzQ@mail.gmail.com
обсуждение исходный текст
Ответ на Determining if a table really changed in a trigger  (Mitar <mmitar@gmail.com>)
Ответы Re: Determining if a table really changed in a trigger  (Miles Elam <miles.elam@productops.com>)
Список 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 по дате отправления:

Предыдущее
От: "David G. Johnston"
Дата:
Сообщение: Re: How to copy rows into same table efficiently
Следующее
От: Miles Elam
Дата:
Сообщение: Re: Determining if a table really changed in a trigger