Re: Can update triggers detect the column in the update statement?
В списке pgsql-general по дате отправления:
| От | Ben Chobot |
|---|---|
| Тема | Re: Can update triggers detect the column in the update statement? |
| Дата | |
| Msg-id | 2C609EAB-5669-494B-ACCF-898DFF0642AC@silentmedia.com обсуждение |
| Ответ на | Re: Can update triggers detect the column in the update statement? (Tom Lane <tgl@sss.pgh.pa.us>) |
| Список | pgsql-general |
On Oct 6, 2008, at 5:53 PM, Tom Lane wrote: > Ben Chobot <bench@silentmedia.com> writes: >> Say I have: >> create t (c1 int not null, c2 int); > >> Is it possible to create an update trigger on t such updates will >> only >> be allowed if the update statement explicitly sets c1, even if the >> new >> value is the same? > > No. A trigger can only tell whether the old and new values are the > same > or not, not why they are that way. OK, well, that makes sense. Is there a way I could do this with rules instead? I was thinking to maybe have a rule to set c1 to be null on update to t, and then let the normal update happen, and then let the not null constraint kick in if it needs to. But when I tried to implement this idea with my limited understanding of rules, it led to infinite recursion. :(
В списке pgsql-general по дате отправления:
Сайт использует файлы cookie для корректной работы и повышения удобства. Нажимая кнопку «Принять» или продолжая пользоваться сайтом, вы соглашаетесь на их использование в соответствии с Политикой в отношении обработки cookie ООО «ППГ», в том числе на передачу данных из файлов cookie сторонним статистическим и рекламным службам. Вы можете управлять настройками cookie через параметры вашего браузера