| От | Tom Lane |
|---|---|
| Тема | Re: Rules & sequences |
| Дата | |
| Msg-id | 9361.965054327@sss.pgh.pa.us обсуждение |
| Ответ на | Rules & sequences ("Tamsin" <tg_mail@bryncadfan.co.uk>) |
| Список | pgsql-general |
"Tamsin" <tg_mail@bryncadfan.co.uk> writes:
> I'm having a problem with my insert rule -
> create rule address_ins as on insert to address DO
> insert into address_hist values (new.*,current_timestamp,'insert');
> The problem is, my address table has default nextval('address_id_seq') as
> the default for the Primary key. When I insert into the address table, the
> rule seems to take the nextval of the sequence for the audit table, and then
> the actual insert into the address table takes another nextval,
I think this may be an inherent problem in the way rules are handled
(unless Jan has an idea how to fix it). You'd probably have better luck
using a trigger.
regards, tom lane
В списке pgsql-general по дате отправления:
Сайт использует файлы cookie для корректной работы и повышения удобства. Нажимая кнопку «Принять» или продолжая пользоваться сайтом, вы соглашаетесь на их использование в соответствии с Политикой в отношении обработки cookie ООО «ППГ», в том числе на передачу данных из файлов cookie сторонним статистическим и рекламным службам. Вы можете управлять настройками cookie через параметры вашего браузера