Re: [BUGS] INSTEAD rule bug?
От | Dmitry Tkach |
---|---|
Тема | Re: [BUGS] INSTEAD rule bug? |
Дата | |
Msg-id | 3F143F73.1060105@openratings.com обсуждение исходный текст |
Ответ на | Re: [BUGS] INSTEAD rule bug? (Tom Lane <tgl@sss.pgh.pa.us>) |
Список | pgsql-general |
Tom Lane wrote: >Dmitry Tkach <dmitry@openratings.com> writes: > > >>The problem is that in the 'real life' situation the condition is a lot >>more complicated than this simple is null test... I hate having to >>duplicate it, and I hate even more having to evaluate it twice on every >>insert :-( >> >> > >Why evaluate it twice? The DO INSTEAD NOTHING rule should be >unconditional. > > > Right. But the problem is I don't want to discard the invalid entries completely... So, it would have to be *three* rules, not just two - like: create rule skip_null as on insert to test_view where x is null do instead insert into invalid_entries ('NULL DATA', new.*); create rule insert_test as on insert to test_view where is is not null do instead insert into test values (new.*); create rule dummy_insert as on insert to test_view do instead nothing; ... so x is null ends up being evaluated twice... Dima
В списке pgsql-general по дате отправления: