| От | Tom Lane |
|---|---|
| Тема | Re: Rule trouble (looks to me exactly like the example) |
| Дата | |
| Msg-id | 24361.1018021338@sss.pgh.pa.us обсуждение |
| Ответ на | Re: Rule trouble (looks to me exactly like the example) (Frank Joerdens <frank@joerdens.de>) |
| Ответы |
Re: Rule trouble (looks to me exactly like the example)
|
| Список | pgsql-sql |
Frank Joerdens <frank@joerdens.de> writes:
>> What's happening is that "new.id" is effectively still NULL at the point
>> where the rule is processed, so the rule WHERE condition fails. I'm not
>> sure why you're bothering with that WHERE condition anyway ...
> Without the WHERE condition, all rows are affected by the update, and
> not just the newly inserted one.
I was speaking of the WHERE new.id > 0 part. However, given that you
want to affect only the newly-inserted row, ISTM you'd be a lot better
off with a trigger instead of a rule.
regards, tom lane
В списке pgsql-sql по дате отправления:
Сайт использует файлы cookie для корректной работы и повышения удобства. Нажимая кнопку «Принять» или продолжая пользоваться сайтом, вы соглашаетесь на их использование в соответствии с Политикой в отношении обработки cookie ООО «ППГ», в том числе на передачу данных из файлов cookie сторонним статистическим и рекламным службам. Вы можете управлять настройками cookie через параметры вашего браузера