Re: [GENERAL] INSTEAD rule bug?

From: Dmitry Tkach <dmitry(at)openratings(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: pgsql-bugs(at)postgresql(dot)org, pgsql-general(at)postgresql(dot)org
Subject: Re: [GENERAL] INSTEAD rule bug?
Date: 2003-07-15 17:52:51
Message-ID: 3F143F73.1060105@openratings.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs pgsql-general

Tom Lane wrote:

>Dmitry Tkach <dmitry(at)openratings(dot)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

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message Dmitry Tkach 2003-07-15 19:12:05 Re: [GENERAL] INSTEAD rule bug?
Previous Message Tom Lane 2003-07-15 17:30:54 Re: [GENERAL] INSTEAD rule bug?

Browse pgsql-general by date

  From Date Subject
Next Message Jay O'Connor 2003-07-15 18:04:53 Re: perfromance impact of vacuum
Previous Message Jay O'Connor 2003-07-15 17:37:28 Re: perfromance impact of vacuum