← Back to team overview

maria-developers team mailing list archive

Rev 2897: Fix for LP bug#611379. in file:///home/bell/maria/bzr/work-maria-5.1-lb611379/

 

At file:///home/bell/maria/bzr/work-maria-5.1-lb611379/

------------------------------------------------------------
revno: 2897
revision-id: sanja@xxxxxxxxxxxx-20100812075534-wc2dngmpiqm9grra
parent: monty@xxxxxxxxx-20100809170542-ewa2awm6pcoi1ipy
committer: sanja@xxxxxxxxxxxx
branch nick: work-maria-5.1-lb611379
timestamp: Thu 2010-08-12 10:55:34 +0300
message:
  Fix for LP bug#611379.
  
  maybe_null/null_value flag set to TRUE for Item_sum_distinct.
=== modified file 'mysql-test/r/func_group.result'
--- a/mysql-test/r/func_group.result	2009-11-24 15:26:13 +0000
+++ b/mysql-test/r/func_group.result	2010-08-12 07:55:34 +0000
@@ -1713,4 +1713,26 @@
 NULL	NULL	NULL	NULL	NULL
 drop table t1;
 #
+#test for LP Bug#611379
+#
+create table t1 (a int not null);
+insert into t1 values (1);
+create table t2 (a int not null primary key);
+insert into t2 values (10);
+explain select sum(distinct t1.a) from t1,t2 where t1.a=t2.a;
+id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
+1	SIMPLE	NULL	NULL	NULL	NULL	NULL	NULL	NULL	Impossible WHERE noticed after reading const tables
+explain select * from (select sum(distinct t1.a) from t1,t2 where t1.a=t2.a)
+as t;
+id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
+1	PRIMARY	<derived2>	system	NULL	NULL	NULL	NULL	1	
+2	DERIVED	NULL	NULL	NULL	NULL	NULL	NULL	NULL	Impossible WHERE noticed after reading const tables
+select sum(distinct t1.a) from t1,t2 where t1.a=t2.a;
+sum(distinct t1.a)
+NULL
+select * from (select sum(distinct t1.a) from t1,t2 where t1.a=t2.a) as t;
+sum(distinct t1.a)
+NULL
+drop table t1,t2;
+#
 End of 5.1 tests

=== modified file 'mysql-test/t/func_group.test'
--- a/mysql-test/t/func_group.test	2009-11-24 15:26:13 +0000
+++ b/mysql-test/t/func_group.test	2010-08-12 07:55:34 +0000
@@ -1082,6 +1082,21 @@
 from t1 a, t1 b;
 select *, f1 = f2 from t1;
 drop table t1;
+
+--echo #
+--echo #test for LP Bug#611379
+--echo #
+create table t1 (a int not null);
+insert into t1 values (1);
+create table t2 (a int not null primary key);
+insert into t2 values (10);
+explain select sum(distinct t1.a) from t1,t2 where t1.a=t2.a;
+explain select * from (select sum(distinct t1.a) from t1,t2 where t1.a=t2.a)
+as t;
+select sum(distinct t1.a) from t1,t2 where t1.a=t2.a;
+select * from (select sum(distinct t1.a) from t1,t2 where t1.a=t2.a) as t;
+drop table t1,t2;
+
 --echo #
 --echo End of 5.1 tests
 

=== modified file 'sql/item_sum.cc'
--- a/sql/item_sum.cc	2010-08-02 09:01:24 +0000
+++ b/sql/item_sum.cc	2010-08-12 07:55:34 +0000
@@ -949,6 +949,7 @@
 {
   DBUG_ASSERT(args[0]->fixed);
 
+  null_value= maybe_null= TRUE;
   table_field_type= args[0]->field_type();
 
   /* Adjust tmp table type according to the chosen aggregation type */


Follow ups