Hi, having a small problem in a trigger i want to automatically update a date field but when i use for example update table set field = current_date where table.pk = new.pk or update table set field = now() where table.pk = new.pk this crashes think link between server and db, i have tried using these commands on a command line and they work ok thanks for any help again JD
Jamie Deppeler wrote: > Hi, > > having a small problem in a trigger i want to automatically update a > date field but when i use for example > > update table > set field = current_date > where table.pk = new.pk If "table" is the table with the trigger on it, you'll end up with an endless loop, since the trigger will keep firing itself. In a BEFORE trigger, just update NEW and make sure you return NEW. Look at the example in the manual for details. -- Richard Huxton Archonet Ltd
Сайт использует файлы cookie для корректной работы и повышения удобства. Нажимая кнопку «Принять» или продолжая пользоваться сайтом, вы соглашаетесь на их использование в соответствии с Политикой в отношении обработки cookie ООО «ППГ», в том числе на передачу данных из файлов cookie сторонним статистическим и рекламным службам. Вы можете управлять настройками cookie через параметры вашего браузера