Why do I get a circular query when I insert tuples with this rule ?

Поиск
Список
Период
Сортировка
От xavier.goddeeris@dds.delphiauto.com (Xavier Goddeeris)
Тема Why do I get a circular query when I insert tuples with this rule ?
Дата
Msg-id 6bf22014.0110150530.389addfd@posting.google.com
обсуждение исходный текст
Ответы Re: Why do I get a circular query when I insert tuples with this rule ?  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-general
Hi. Here is my problem:

I am using PostgreSQL 7.1.3. I want to create a RULE to modify the
values in an insert query. Here is my rule:

CREATE RULE old_error_codes AS ON insert to Passage
WHERE erreur<>0 and ligne<>1 and erreur<500 DO INSTEAD
insert into Passage(idinjecteur, ligne, datedesortie, estbon,
nomcible, erreur, derniertest, nodupassage)
values (new.idinjecteur, new.ligne, new.datedesortie, new.estbon,
new.nomcible, new.erreur+500, new.derniertest, new.nodupassage);

What I don't understand, is that, with this rule when I insert a tuple
I get the error message "ERROR: Query rewritten 10 times, may contain
cycles".

Once he has done for the first time, the action specified in the rule,
Postgres doesn't have to re-execute the action in the rule, because
the second time he checks the rule he finds that "erreur" is not < 500
(the condition of the rule is false).

Don't understand. Please help me.

Thank you,
xav.

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

Предыдущее
От: Debian GNU/Linux User :-D
Дата:
Сообщение: Re: WWW interface for postgres
Следующее
От: roypgsqlgen@xemaps.com
Дата:
Сообщение: