Re: BUG #4620: Unexpected(doc'd) side effects of using serial and rules
В списке pgsql-bugs по дате отправления:
| От | Tom Lane |
|---|---|
| Тема | Re: BUG #4620: Unexpected(doc'd) side effects of using serial and rules |
| Дата | |
| Msg-id | 2744.1232296519@sss.pgh.pa.us обсуждение исходный текст |
| Ответ на | BUG #4620: Unexpected(doc'd) side effects of using serial and rules ("Simon Keen" <simon.keen@eglimited.co.uk>) |
| Ответы |
Re: BUG #4620: Unexpected(doc'd) side effects of using serial and rules
|
| Список | pgsql-bugs |
"Simon Keen" <simon.keen@eglimited.co.uk> writes:
> I have used serial columns as primary keys in some tables. I have a rule
> that on insert to a table inserts in another table. However, the rule
> appears to cause the seq nextval() to be invoked multiple times thus
> destroying any value in NEW.serial_col.
This is a well-known issue arising from the fact that a rule is really a
macro: multiple references to any expression in the original statement
result in multiple evaluations of that expression.
By and large, the best way to propagate inserted information to other
tables is with a trigger.
regards, tom lane
В списке pgsql-bugs по дате отправления:
Сайт использует файлы cookie для корректной работы и повышения удобства. Нажимая кнопку «Принять» или продолжая пользоваться сайтом, вы соглашаетесь на их использование в соответствии с Политикой в отношении обработки cookie ООО «ППГ», в том числе на передачу данных из файлов cookie сторонним статистическим и рекламным службам. Вы можете управлять настройками cookie через параметры вашего браузера