Re: BUG #2857: Sequence and table partitioning

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: BUG #2857: Sequence and table partitioning
Дата
Msg-id 25794.1167079826@sss.pgh.pa.us
обсуждение исходный текст
Ответ на BUG #2857: Sequence and table partitioning  ("Tomislav Karastojkovic" <karastojko@gmail.com>)
Список pgsql-bugs
"Tomislav Karastojkovic" <karastojko@gmail.com> writes:
> CREATE OR REPLACE RULE r AS ON INSERT TO parent WHERE id>=1 AND id <= 100 DO
> INSTEAD INSERT INTO child VALUES(NEW.id, NEW.message);

> then the sequence is increasing by 5 when inserting into 'parent' table.

"id" is basically a macro that gets replaced with the expression being
inserted, ie, the nextval() call.  So you're getting bit with multiple
evaluation.

There isn't any very safe way to do this sort of thing with a rule.
Consider using a trigger instead.

            regards, tom lane

В списке pgsql-bugs по дате отправления:

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: BUG #2861: when backup UTF-8 database,pgdump add comments not encoded in UTF-8
Следующее
От: Tom Lane
Дата:
Сообщение: Re: bug: Mac OS X 10.4.8 Intel