Bug #4089 Server crash on attempt to insert records into BDB table
Submitted: 10 Jun 2004 15:15 Modified: 24 Jun 2004 19:44
Reporter: Ramil Kalimullin Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server Severity:S1 (Critical)
Version:4.1 OS:Any (all)
Assigned to: Ramil Kalimullin CPU Architecture:Any

[10 Jun 2004 15:15] Ramil Kalimullin
Description:
The following query sequence crashes the server:

How to repeat:
drop table if exists t1, t2;                                                        
create table t1(a int primary key, b varchar(30)) ENGINE = BDB;

delete from t1 ;                                                                
insert into t1 values (1,'one');                                                
insert into t1 values (2,'two');                                                
insert into t1 values (3,'three');                                              
insert into t1 values (4,'four');                                               
commit ;                                                                        

    
set @duplicate='duplicate ' ;
set @1000=1000 ;
set @5=5 ;
set @float=1.00;
set @five='five' ;
create table t2 like t1 ;
insert into t2 (b,a) 
select @duplicate, sum(first.a) from t1 first, t1 second
  where first.a <> @5 and second.b = first.b
     and second.b <> @five
  group by second.b
  having sum(second.a) > @2
union
select b, a + @100 from t1
  where (a,b) in ( select sqrt(a+@1)+CAST(@float AS signed),b 
                 from t1);

Suggested fix:
n/a
[15 Jun 2004 9:47] Ramil Kalimullin
Another test case:

drop table if exists t1, t2;
create table t1(a int primary key, b varchar(30)) ENGINE = BDB;
insert into t1 values (1,'one');
insert into t1 values (2,'two');
insert into t1 values (3,'three');
insert into t1 values (4,'four');
create table t2 like t1;

insert into t2 (a, b) 
  select a, b from t1 where (a,b) in ( select a,b from t1);
[23 Jun 2004 20:56] Sergei Golubchik
Ramil, after the cleanup your patch doesn't help anymore :(
[24 Jun 2004 19:44] Sergei Golubchik
Thank you for your bug report. This issue has been committed to our
source repository of that product and will be incorporated into the
next release.

If necessary, you can access the source repository and build the latest
available version, including the bugfix, yourself. More information 
about accessing the source trees is available at
    http://www.mysql.com/doc/en/Installing_source_tree.html

Additional info:

fixed in 4.1.3