| От | Andreas Pflug |
|---|---|
| Тема | How to notice column changes in trigger |
| Дата | |
| Msg-id | 3E6874CD.4090501@web.de обсуждение исходный текст |
| Ответы |
Re: How to notice column changes in trigger
|
| Список | pgsql-sql |
How can I detect whether a column was changed by an update command inside a trigger? create table test(a int, b int, c int, primary key(a)) b and c should be updated inside an update trigger if not modified by the statement itself 1) update test set a=0 -> trigger does its work 2) update test set a=0, b=1, c=2 -> trigger does nothing 3) update test set a=0, b=b, c=c -> trigger does nothing, but content of a and b dont change either although touched What I'm looking for is something like IF NOT COLUMN_TOUCHED(b) THEN ... For MSSQL, this would be coded as IF NOT UPDATE(b) .. IF OLD.b=NEW.b will not work, case 3) will falsely execute the trigger code. Any hints? Andreas
В списке pgsql-sql по дате отправления:
Сайт использует файлы cookie для корректной работы и повышения удобства. Нажимая кнопку «Принять» или продолжая пользоваться сайтом, вы соглашаетесь на их использование в соответствии с Политикой в отношении обработки cookie ООО «ППГ», в том числе на передачу данных из файлов cookie сторонним статистическим и рекламным службам. Вы можете управлять настройками cookie через параметры вашего браузера