Re: is it a bug in rule system?

Поиск
Список
Период
Сортировка
От laser
Тема Re: is it a bug in rule system?
Дата
Msg-id 483D1EF5.7040409@pgsqldb.com
обсуждение исходный текст
Ответ на Re: is it a bug in rule system?  ("A. Kretschmer" <andreas.kretschmer@schollglas.com>)
Ответы Re: is it a bug in rule system?
Список pgsql-general
A. Kretschmer wrote:
> am  Wed, dem 28.05.2008, um 15:56:22 +0800 mailte laser folgendes:
>
>> hi all,
>>
>> see query below:
>>
>> create table ruleTest(id integer, name text);
>>
>> create or replace rule ruleTest_insert_rule AS on insert to ruleTest
>> where exists(select 1 from ruleTest where ruleTest.name = NEW.name)
>> do instead (update ruleTest set id = id+1 where ruleTest.name = NEW.name);
>>
>> I think the id should be 1, cause the rule condition should only affect
>> exist row,
>> but ISTM the rule act like a DO ALSO rule: insert the row first, then
>> update it.
>>
>> any hints?
>>
>
> Yes, use a TRIGGER instead a RULE for such tasks.
>
>

thanks, good to know it's a bug and we'll try TRIGGER approach.

thanks and best regards

-laser

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

Предыдущее
От: "A. Kretschmer"
Дата:
Сообщение: Re: is it a bug in rule system?
Следующее
От: Kaloyan Iliev
Дата:
Сообщение: Re: Open Source CRM - Options?