Commit b5fc0db7 authored by holyfoot@mysql.com's avatar holyfoot@mysql.com

Merge mysql.com:/home/hf/work/mysql-5.0.mrg

into mysql.com:/home/hf/work/mysql-5.1.mrg
parents 3c1f4e3c 8707e335
...@@ -512,3 +512,24 @@ id IFNULL(dsc, '-') ...@@ -512,3 +512,24 @@ id IFNULL(dsc, '-')
2 line number two 2 line number two
3 line number three 3 line number three
drop table t1; 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;
...@@ -358,3 +358,27 @@ select distinct id, IFNULL(dsc, '-') from t1; ...@@ -358,3 +358,27 @@ select distinct id, IFNULL(dsc, '-') from t1;
drop table t1; drop table t1;
# End of 4.1 tests # 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;
...@@ -2564,9 +2564,9 @@ bool Item_sum_count_distinct::setup(THD *thd) ...@@ -2564,9 +2564,9 @@ bool Item_sum_count_distinct::setup(THD *thd)
Field *f= *field; Field *f= *field;
enum enum_field_types type= f->type(); enum enum_field_types type= f->type();
tree_key_length+= f->pack_length(); tree_key_length+= f->pack_length();
if (!f->binary() && (type == MYSQL_TYPE_STRING || if ((type == MYSQL_TYPE_VARCHAR) ||
type == MYSQL_TYPE_VAR_STRING || !f->binary() && (type == MYSQL_TYPE_STRING ||
type == MYSQL_TYPE_VARCHAR)) type == MYSQL_TYPE_VAR_STRING))
{ {
all_binary= FALSE; all_binary= FALSE;
break; break;
......
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