MySQL Lists are EOL. Please join:

List:Commits« Previous MessageNext Message »
From:holyfoot Date:March 5 2006 4:48pm
Subject:bk commit into 5.0 tree (holyfoot:1.2100) BUG#15745
View as plain text  
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.2100 06/03/05 20:48:31 holyfoot@deer.(none) +3 -0
  bug #15745 (COUNT(DISTINCT CONCAT(x,y)) returns wrong result

  sql/item_sum.cc
    1.171 06/03/05 20:47:10 holyfoot@stripped +3 -3
    MYSQL_TYPE_VARCHAR can't be 'binary' compared even when it is
    binary

  mysql-test/t/distinct.test
    1.22 06/03/05 20:47:10 holyfoot@stripped +24 -0
    testcase

  mysql-test/r/distinct.result
    1.43 06/03/05 20:47:10 holyfoot@stripped +21 -0
    result added

# 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	Sun Mar  5 20:47:10 2006
@@ -2541,9 +2541,9 @@
       Field *f= *field;
       enum enum_field_types type= f->type();
       tree_key_length+= f->pack_length();
-      if (!f->binary() && (type == MYSQL_TYPE_STRING ||
-                           type == MYSQL_TYPE_VAR_STRING ||
-                           type == MYSQL_TYPE_VARCHAR))
+      if ((type == MYSQL_TYPE_VARCHAR) ||
+          !f->binary() && (type == MYSQL_TYPE_STRING ||
+                           type == MYSQL_TYPE_VAR_STRING))
       {
         all_binary= FALSE;
         break;

--- 1.42/mysql-test/r/distinct.result	Fri Sep 16 00:05:29 2005
+++ 1.43/mysql-test/r/distinct.result	Sun Mar  5 20:47:10 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	Sun Mar  5 20:47:10 2006
@@ -358,3 +358,27 @@
 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.2100) BUG#15745holyfoot5 Mar