Thread: Constraint exclusion crashes 8.3devel

Constraint exclusion crashes 8.3devel

From
Jan Wieck
Date:
The attached script works in REL8_2_STABLE, but crashes current head
with a SEGV. It somehow manages to have the cheapest path being a NULL
pointer instead of a dummy Append.


Jan

--
#======================================================================#
# It's easier to get forgiveness for being wrong than for being right. #
# Let's break this rule - forgive me.                                  #
#================================================== JanWieck@Yahoo.com #
drop table t1 cascade;

create table t1 (a integer primary key);

create table t1_1 (check (a >= 0 and a < 10)) inherits (t1);
create table t1_2 (check (a >= 10 and a < 20)) inherits (t1);

create rule t1_ins_1 as on insert to t1
    where new.a >= 0 and new.a < 10
    do instead
    insert into t1_1 values (new.a);
create rule t1_ins_2 as on insert to t1
    where new.a >= 10 and new.a < 20
    do instead
    insert into t1_2 values (new.a);

create rule t1_upd_1 as on update to t1
    where old.a >= 0 and old.a < 10
    do instead
    update t1_1 set a = new.a where a = old.a;
create rule t1_upd_2 as on update to t1
    where old.a >= 10 and old.a < 20
    do instead
    update t1_2 set a = new.a where a = old.a;

set constraint_exclusion = on;

insert into t1 select * from generate_series(5,19,1);

explain update t1 set a = 4 where a = 5;
update t1 set a = 4 where a = 5;


select * from only t1;
select * from only t1_1;
select * from only t1_2;




Re: Constraint exclusion crashes 8.3devel

From
Simon Riggs
Date:
On Sat, 2007-05-26 at 11:19 -0400, Jan Wieck wrote:
> The attached script works in REL8_2_STABLE, but crashes current head 
> with a SEGV. It somehow manages to have the cheapest path being a NULL 
> pointer instead of a dummy Append.

Just starting to look at this now.

--  Simon Riggs              EnterpriseDB   http://www.enterprisedb.com




Re: Constraint exclusion crashes 8.3devel

From
Tom Lane
Date:
Jan Wieck <JanWieck@Yahoo.com> writes:
> The attached script works in REL8_2_STABLE, but crashes current head 
> with a SEGV.

Looks like I broke it :-(.  Fixed, thanks for the test case.
        regards, tom lane