Determining if a table really changed in a trigger
От | Mitar |
---|---|
Тема | Determining if a table really changed in a trigger |
Дата | |
Msg-id | CAKLmikNjiz=zwf9suiAHoBLrRpjLTNsQ=f4PGD3RMFBxzR-3OA@mail.gmail.com обсуждение исходный текст |
Ответы |
Re: Determining if a table really changed in a trigger
Re: Determining if a table really changed in a trigger Re: Determining if a table really changed in a trigger Re: Determining if a table really changed in a trigger Re: Determining if a table really changed in a trigger Re: Determining if a table really changed in a trigger |
Список | pgsql-general |
Hi! I have a trigger like: CREATE TRIGGER update_trigger AFTER UPDATE ON my_table REFERENCING NEW TABLE AS new_table OLD TABLE AS old_table FOR EACH STATEMENT EXECUTE FUNCTION trigger_function; I would like to test inside trigger_function if the table really changed. I have tried to do: 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; But this fails if the table contains a JSON field with the error: could not identify an equality operator for type json The table has an unique index column, if that helps. Mitar -- http://mitar.tnode.com/ https://twitter.com/mitar_m
В списке pgsql-general по дате отправления: