| От | laser |
|---|---|
| Тема | is it a bug in rule system? |
| Дата | |
| Msg-id | 483D1026.2010403@pgsqldb.com обсуждение исходный текст |
| Ответы |
Re: is it a bug in rule system?
|
| Список | pgsql-general |
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); create unique index ruletest_name_uniq_idx on ruletest using btree (name); laser=# insert into ruletest(id,name) values(1, 'laser0'); INSERT 0 1 laser=# select * from ruletest; id | name ----+-------- 2 | laser0 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? thanks and best regards -laser
В списке pgsql-general по дате отправления:
Сайт использует файлы cookie для корректной работы и повышения удобства. Нажимая кнопку «Принять» или продолжая пользоваться сайтом, вы соглашаетесь на их использование в соответствии с Политикой в отношении обработки cookie ООО «ППГ», в том числе на передачу данных из файлов cookie сторонним статистическим и рекламным службам. Вы можете управлять настройками cookie через параметры вашего браузера