Below is the list of changes that have just been committed into a local
5.0 repository of hf. When hf does a push these changes will
be propagated to the main repository and, within 24 hours after the
push, to the public repository.
For information on how to access the public repository
see http://dev.mysql.com/doc/mysql/en/installing-source-tree.html
ChangeSet
1.2018 06/01/14 17:51:17 holyfoot@deer.(none) +3 -0
bug #15745 ( COUNT(DISTINCT x,y) and COUNT(DISTINCT CONCAT(x,y)) return
different values
sql/item_sum.cc
1.171 06/01/14 17:49:57 holyfoot@stripped +1 -1
We can't use simple comparison for string types even if they're binary
mysql-test/t/distinct.test
1.22 06/01/14 17:49:57 holyfoot@stripped +23 -0
test case
mysql-test/r/distinct.result
1.43 06/01/14 17:49:57 holyfoot@stripped +21 -0
test result fixed
# This is a BitKeeper patch. What follows are the unified diffs for the
# set of deltas contained in the patch. The rest of the patch, the part
# that BitKeeper cares about, is below these diffs.
# User: holyfoot
# Host: deer.(none)
# Root: /home/hf/work/mysql-5.0.15745
--- 1.170/sql/item_sum.cc Sat Dec 3 08:42:27 2005
+++ 1.171/sql/item_sum.cc Sat Jan 14 17:49:57 2006
@@ -2541,7 +2541,7 @@
Field *f= *field;
enum enum_field_types type= f->type();
tree_key_length+= f->pack_length();
- if (!f->binary() && (type == MYSQL_TYPE_STRING ||
+ if (!f->binary() || (type == MYSQL_TYPE_STRING ||
type == MYSQL_TYPE_VAR_STRING ||
type == MYSQL_TYPE_VARCHAR))
{
--- 1.42/mysql-test/r/distinct.result Fri Sep 16 00:05:29 2005
+++ 1.43/mysql-test/r/distinct.result Sat Jan 14 17:49:57 2006
@@ -512,3 +512,24 @@
2 line number two
3 line number three
drop table t1;
+CREATE TABLE t1 (
+ID int(11) NOT NULL auto_increment,
+x varchar(20) default NULL,
+y decimal(10,0) default NULL,
+PRIMARY KEY (ID),
+KEY (y)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1;
+INSERT INTO t1 VALUES
+(1,'ba','-1'),
+(2,'ba','1150'),
+(306,'ba','-1'),
+(307,'ba','1150'),
+(611,'ba','-1'),
+(612,'ba','1150');
+select count(distinct x,y) from t1;
+count(distinct x,y)
+2
+select count(distinct concat(x,y)) from t1;
+count(distinct concat(x,y))
+2
+drop table t1;
--- 1.21/mysql-test/t/distinct.test Fri Sep 16 00:05:30 2005
+++ 1.22/mysql-test/t/distinct.test Sat Jan 14 17:49:57 2006
@@ -358,3 +358,26 @@
drop table t1;
# End of 4.1 tests
+
+#
+# Bug #15745 ( COUNT(DISTINCT CONCAT(x,y)) returns wrong result)
+#
+CREATE TABLE t1 (
+ ID int(11) NOT NULL auto_increment,
+ x varchar(20) default NULL,
+ y decimal(10,0) default NULL,
+ PRIMARY KEY (ID),
+ KEY (y)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1;
+
+INSERT INTO t1 VALUES
+(1,'ba','-1'),
+(2,'ba','1150'),
+(306,'ba','-1'),
+(307,'ba','1150'),
+(611,'ba','-1'),
+(612,'ba','1150');
+
+select count(distinct x,y) from t1;
+select count(distinct concat(x,y)) from t1;
+drop table t1;
| Thread |
|---|
| • bk commit into 5.0 tree (holyfoot:1.2018) BUG#15745 | holyfoot | 14 Jan |