maria-developers team mailing list archive
-
maria-developers team
-
Mailing list archive
-
Message #03517
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-20100809193502-gdriohzan0t6s727
parent: monty@xxxxxxxxx-20100809170542-ewa2awm6pcoi1ipy
committer: sanja@xxxxxxxxxxxx
branch nick: work-maria-5.1-lb611379
timestamp: Mon 2010-08-09 22:35:02 +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-09 19:35:02 +0000
@@ -1713,4 +1713,60 @@
NULL NULL NULL NULL NULL
drop table t1;
#
+#test for LP Bug#611379
+#
+CREATE TABLE `t1` (
+`pk` int(11) NOT NULL AUTO_INCREMENT,
+`col_int_key` int(11) DEFAULT NULL,
+`col_varchar_key` varchar(1) DEFAULT NULL,
+PRIMARY KEY (`pk`),
+KEY `col_int_key` (`col_int_key`),
+KEY `col_varchar_key` (`col_varchar_key`,`col_int_key`)
+) ENGINE=MyISAM AUTO_INCREMENT=30 DEFAULT CHARSET=latin1;
+INSERT INTO `t1` VALUES (10,8,'v');
+INSERT INTO `t1` VALUES (11,9,'r');
+INSERT INTO `t1` VALUES (12,9,'a');
+INSERT INTO `t1` VALUES (13,186,'m');
+INSERT INTO `t1` VALUES (14,NULL,'y');
+INSERT INTO `t1` VALUES (15,2,'j');
+INSERT INTO `t1` VALUES (16,3,'d');
+INSERT INTO `t1` VALUES (17,0,'z');
+INSERT INTO `t1` VALUES (18,133,'e');
+INSERT INTO `t1` VALUES (19,1,'h');
+INSERT INTO `t1` VALUES (20,8,'b');
+INSERT INTO `t1` VALUES (21,5,'s');
+INSERT INTO `t1` VALUES (22,5,'e');
+INSERT INTO `t1` VALUES (23,8,'j');
+INSERT INTO `t1` VALUES (24,6,'e');
+INSERT INTO `t1` VALUES (25,51,'f');
+INSERT INTO `t1` VALUES (26,4,'v');
+INSERT INTO `t1` VALUES (27,7,'x');
+INSERT INTO `t1` VALUES (28,6,'m');
+INSERT INTO `t1` VALUES (29,4,'c');
+CREATE TABLE `BB` (
+`pk` int(11) NOT NULL AUTO_INCREMENT,
+`col_int_key` int(11) DEFAULT NULL,
+`col_varchar_key` varchar(1) DEFAULT NULL,
+PRIMARY KEY (`pk`),
+KEY `col_int_key` (`col_int_key`),
+KEY `col_varchar_key` (`col_varchar_key`,`col_int_key`)
+) ENGINE=MyISAM AUTO_INCREMENT=11 DEFAULT CHARSET=latin1;
+INSERT INTO `BB` VALUES (10,8,NULL);
+CREATE TABLE `B` (
+`pk` int(11) NOT NULL AUTO_INCREMENT,
+`col_int_key` int(11) DEFAULT NULL,
+`col_varchar_key` varchar(1) DEFAULT NULL,
+PRIMARY KEY (`pk`),
+KEY `col_int_key` (`col_int_key`),
+KEY `col_varchar_key` (`col_varchar_key`,`col_int_key`)
+) ENGINE=MyISAM AUTO_INCREMENT=2 DEFAULT CHARSET=latin1;
+INSERT INTO `B` VALUES (1,7,'f');
+SELECT SUM( DISTINCT table1 .`pk` ) FROM B table1 STRAIGHT_JOIN ( BB table2 JOIN t1 ON table2 .`col_varchar_key` ) ON table2 .`pk` ;
+SUM( DISTINCT table1 .`pk` )
+NULL
+SELECT * FROM ( SELECT SUM( DISTINCT table1 .`pk` ) FROM B table1 STRAIGHT_JOIN ( BB table2 JOIN t1 ON table2 .`col_varchar_key` ) ON table2 .`pk` ) AS t1;
+SUM( DISTINCT table1 .`pk` )
+NULL
+drop table t1;
+#
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-09 19:35:02 +0000
@@ -1082,6 +1082,61 @@
from t1 a, t1 b;
select *, f1 = f2 from t1;
drop table t1;
+
+--echo #
+--echo #test for LP Bug#611379
+--echo #
+CREATE TABLE `t1` (
+ `pk` int(11) NOT NULL AUTO_INCREMENT,
+ `col_int_key` int(11) DEFAULT NULL,
+ `col_varchar_key` varchar(1) DEFAULT NULL,
+ PRIMARY KEY (`pk`),
+ KEY `col_int_key` (`col_int_key`),
+ KEY `col_varchar_key` (`col_varchar_key`,`col_int_key`)
+) ENGINE=MyISAM AUTO_INCREMENT=30 DEFAULT CHARSET=latin1;
+INSERT INTO `t1` VALUES (10,8,'v');
+INSERT INTO `t1` VALUES (11,9,'r');
+INSERT INTO `t1` VALUES (12,9,'a');
+INSERT INTO `t1` VALUES (13,186,'m');
+INSERT INTO `t1` VALUES (14,NULL,'y');
+INSERT INTO `t1` VALUES (15,2,'j');
+INSERT INTO `t1` VALUES (16,3,'d');
+INSERT INTO `t1` VALUES (17,0,'z');
+INSERT INTO `t1` VALUES (18,133,'e');
+INSERT INTO `t1` VALUES (19,1,'h');
+INSERT INTO `t1` VALUES (20,8,'b');
+INSERT INTO `t1` VALUES (21,5,'s');
+INSERT INTO `t1` VALUES (22,5,'e');
+INSERT INTO `t1` VALUES (23,8,'j');
+INSERT INTO `t1` VALUES (24,6,'e');
+INSERT INTO `t1` VALUES (25,51,'f');
+INSERT INTO `t1` VALUES (26,4,'v');
+INSERT INTO `t1` VALUES (27,7,'x');
+INSERT INTO `t1` VALUES (28,6,'m');
+INSERT INTO `t1` VALUES (29,4,'c');
+CREATE TABLE `BB` (
+ `pk` int(11) NOT NULL AUTO_INCREMENT,
+ `col_int_key` int(11) DEFAULT NULL,
+ `col_varchar_key` varchar(1) DEFAULT NULL,
+ PRIMARY KEY (`pk`),
+ KEY `col_int_key` (`col_int_key`),
+ KEY `col_varchar_key` (`col_varchar_key`,`col_int_key`)
+) ENGINE=MyISAM AUTO_INCREMENT=11 DEFAULT CHARSET=latin1;
+INSERT INTO `BB` VALUES (10,8,NULL);
+CREATE TABLE `B` (
+ `pk` int(11) NOT NULL AUTO_INCREMENT,
+ `col_int_key` int(11) DEFAULT NULL,
+ `col_varchar_key` varchar(1) DEFAULT NULL,
+ PRIMARY KEY (`pk`),
+ KEY `col_int_key` (`col_int_key`),
+ KEY `col_varchar_key` (`col_varchar_key`,`col_int_key`)
+) ENGINE=MyISAM AUTO_INCREMENT=2 DEFAULT CHARSET=latin1;
+INSERT INTO `B` VALUES (1,7,'f');
+
+SELECT SUM( DISTINCT table1 .`pk` ) FROM B table1 STRAIGHT_JOIN ( BB table2 JOIN t1 ON table2 .`col_varchar_key` ) ON table2 .`pk` ;
+SELECT * FROM ( SELECT SUM( DISTINCT table1 .`pk` ) FROM B table1 STRAIGHT_JOIN ( BB table2 JOIN t1 ON table2 .`col_varchar_key` ) ON table2 .`pk` ) AS t1;
+drop table t1;
+
--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-09 19:35:02 +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 */