| От | Tommy Gildseth |
|---|---|
| Тема | Re: Is this a bug? Sequences and rules |
| Дата | |
| Msg-id | 461C7CC7.6040506@gildseth.com обсуждение исходный текст |
| Ответ на | Is this a bug? Sequences and rules (Chris Travers <chris@metatrontech.com>) |
| Список | pgsql-general |
Chris Travers wrote:
> Hi;
>
> I noticed that rules were not behaving properly. I created a test
> case, and it looks like the sequence is getting double-incrimented.
> Is this the way this is supposed to work?
>
> I know triggers would be better for something like this but I find
> these results... surprising....
>
> postgres=# insert into test1 (test) values (1);
This insert is implicitly specifying that you should use the default
value as the value for the ID column. The default is
nextval('test1_id_seq'), so this is what gets inserted into test2 as
well, thus incrementing the sequence twice.
--
Tommy Gildseth
--
Tommy Gildseth
DBA, Gruppe for databasedrift
Universitetet i Oslo, USIT
m: +47 45 86 38 50
В списке pgsql-general по дате отправления:
Сайт использует файлы cookie для корректной работы и повышения удобства. Нажимая кнопку «Принять» или продолжая пользоваться сайтом, вы соглашаетесь на их использование в соответствии с Политикой в отношении обработки cookie ООО «ППГ», в том числе на передачу данных из файлов cookie сторонним статистическим и рекламным службам. Вы можете управлять настройками cookie через параметры вашего браузера