Commit 8be4234f authored by unknown's avatar unknown

Fix for bug #1980


BitKeeper/etc/logging_ok:
  Logging to logging@openlogging.org accepted
parent 13f525c0
...@@ -103,6 +103,7 @@ serg@serg.mylan ...@@ -103,6 +103,7 @@ serg@serg.mylan
serg@serg.mysql.com serg@serg.mysql.com
serg@sergbook.mylan serg@sergbook.mylan
serg@sergbook.mysql.com serg@sergbook.mysql.com
sergefp@mysql.com
sinisa@rhols221.adsl.netsonic.fi sinisa@rhols221.adsl.netsonic.fi
tfr@beta.frontier86.ee tfr@beta.frontier86.ee
tfr@indrek.tfr.cafe.ee tfr@indrek.tfr.cafe.ee
......
...@@ -327,3 +327,29 @@ select t1.a, t1.b,t2.a, t2.b from t1 left join t2 on t1.a=t2.a where t1.b=1 and ...@@ -327,3 +327,29 @@ select t1.a, t1.b,t2.a, t2.b from t1 left join t2 on t1.a=t2.a where t1.b=1 and
a b a b a b a b
2 2 NULL NULL 2 2 NULL NULL
drop table t1,t2; drop table t1,t2;
set @ttype_save=@@table_type;
set @@table_type=innodb;
create table t1 ( c char(8) not null );
insert into t1 values ('0'),('1'),('2'),('3'),('4'),('5'),('6'),('7'),('8'),('9');
insert into t1 values ('A'),('B'),('C'),('D'),('E'),('F');
alter table t1 add b char(8) not null;
alter table t1 add a char(8) not null;
alter table t1 add primary key (a,b,c);
update t1 set a=c, b=c;
create table t2 like t1;
insert into t2 select * from t1;
delete t1,t2 from t2,t1 where t1.a<'B' and t2.b=t1.b;
drop table t1,t2;
set @@table_type=bdb;
create table t1 ( c char(8) not null );
insert into t1 values ('0'),('1'),('2'),('3'),('4'),('5'),('6'),('7'),('8'),('9');
insert into t1 values ('A'),('B'),('C'),('D'),('E'),('F');
alter table t1 add b char(8) not null;
alter table t1 add a char(8) not null;
alter table t1 add primary key (a,b,c);
update t1 set a=c, b=c;
create table t2 like t1;
insert into t2 select * from t1;
delete t1,t2 from t2,t1 where t1.a<'B' and t2.b=t1.b;
set @@table_type=@ttype_save;
drop table t1,t2;
...@@ -267,3 +267,49 @@ insert into t2 values (1,1), (3,1); ...@@ -267,3 +267,49 @@ insert into t2 values (1,1), (3,1);
update t1 left join t2 on t1.a=t2.a set t1.b=2, t2.b=2 where t1.b=1 and t2.b=1 or t2.a is NULL; update t1 left join t2 on t1.a=t2.a set t1.b=2, t2.b=2 where t1.b=1 and t2.b=1 or t2.a is NULL;
select t1.a, t1.b,t2.a, t2.b from t1 left join t2 on t1.a=t2.a where t1.b=1 and t2.b=1 or t2.a is NULL; select t1.a, t1.b,t2.a, t2.b from t1 left join t2 on t1.a=t2.a where t1.b=1 and t2.b=1 or t2.a is NULL;
drop table t1,t2; drop table t1,t2;
#
# Test for bug #1980.
#
set @ttype_save=@@table_type;
--disable_warnings
set @@table_type=innodb;
create table t1 ( c char(8) not null );
--enable_warnings
insert into t1 values ('0'),('1'),('2'),('3'),('4'),('5'),('6'),('7'),('8'),('9');
insert into t1 values ('A'),('B'),('C'),('D'),('E'),('F');
alter table t1 add b char(8) not null;
alter table t1 add a char(8) not null;
alter table t1 add primary key (a,b,c);
update t1 set a=c, b=c;
create table t2 like t1;
insert into t2 select * from t1;
delete t1,t2 from t2,t1 where t1.a<'B' and t2.b=t1.b;
drop table t1,t2;
--disable_warnings
set @@table_type=bdb;
create table t1 ( c char(8) not null );
--enable_warnings
insert into t1 values ('0'),('1'),('2'),('3'),('4'),('5'),('6'),('7'),('8'),('9');
insert into t1 values ('A'),('B'),('C'),('D'),('E'),('F');
alter table t1 add b char(8) not null;
alter table t1 add a char(8) not null;
alter table t1 add primary key (a,b,c);
update t1 set a=c, b=c;
create table t2 like t1;
insert into t2 select * from t1;
delete t1,t2 from t2,t1 where t1.a<'B' and t2.b=t1.b;
set @@table_type=@ttype_save;
drop table t1,t2;
...@@ -37,14 +37,20 @@ ...@@ -37,14 +37,20 @@
int unique_write_to_file(gptr key, element_count count, Unique *unique) int unique_write_to_file(gptr key, element_count count, Unique *unique)
{ {
/*
Use unique->size (size of element stored in the tree) and not
unique->tree.size_of_element. The latter is different from unique->size
when tree implementation chooses to store pointer to key in TREE_ELEMENT
(instead of storing the element itself there)
*/
return my_b_write(&unique->file, (byte*) key, return my_b_write(&unique->file, (byte*) key,
unique->tree.size_of_element) ? 1 : 0; unique->size) ? 1 : 0;
} }
int unique_write_to_ptrs(gptr key, element_count count, Unique *unique) int unique_write_to_ptrs(gptr key, element_count count, Unique *unique)
{ {
memcpy(unique->record_pointers, key, unique->tree.size_of_element); memcpy(unique->record_pointers, key, unique->size);
unique->record_pointers+=unique->tree.size_of_element; unique->record_pointers+=unique->size;
return 0; return 0;
} }
...@@ -132,7 +138,7 @@ bool Unique::get(TABLE *table) ...@@ -132,7 +138,7 @@ bool Unique::get(TABLE *table)
bzero((char*) &sort_param,sizeof(sort_param)); bzero((char*) &sort_param,sizeof(sort_param));
sort_param.max_rows= elements; sort_param.max_rows= elements;
sort_param.sort_form=table; sort_param.sort_form=table;
sort_param.sort_length=sort_param.ref_length=tree.size_of_element; sort_param.sort_length=sort_param.ref_length=size;
sort_param.keys= max_in_memory_size / sort_param.sort_length; sort_param.keys= max_in_memory_size / sort_param.sort_length;
sort_param.not_killable=1; sort_param.not_killable=1;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment