Commit 761bc1ce authored by joreland@mysql.com's avatar joreland@mysql.com

Merge mysql.com:/home/jonas/src/mysql-4.1

into mysql.com:/home/jonas/src/mysql-4.1-ndb
parents 9d6cb54b 2a621e27
......@@ -693,3 +693,29 @@ SELECT MIN(a) FROM t1 WHERE a < 0;
MIN(a)
NULL
DROP TABLE t1;
CREATE TABLE t1 (
id int(10) unsigned NOT NULL auto_increment,
val enum('one','two','three') NOT NULL default 'one',
PRIMARY KEY (id)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
INSERT INTO t1 VALUES
(1,'one'),(2,'two'),(3,'three'),(4,'one'),(5,'two');
select val, count(*) from t1 group by val;
val count(*)
one 2
two 2
three 1
drop table t1;
CREATE TABLE t1 (
id int(10) unsigned NOT NULL auto_increment,
val set('one','two','three') NOT NULL default 'one',
PRIMARY KEY (id)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
INSERT INTO t1 VALUES
(1,'one'),(2,'two'),(3,'three'),(4,'one'),(5,'two');
select val, count(*) from t1 group by val;
val count(*)
one 2
two 2
three 1
drop table t1;
......@@ -431,6 +431,30 @@ SELECT MIN(a) FROM t1 WHERE a < 0;
DROP TABLE t1;
#
# Bug #5555 GROUP BY enum_field" returns incorrect results
#
CREATE TABLE t1 (
id int(10) unsigned NOT NULL auto_increment,
val enum('one','two','three') NOT NULL default 'one',
PRIMARY KEY (id)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
INSERT INTO t1 VALUES
(1,'one'),(2,'two'),(3,'three'),(4,'one'),(5,'two');
select val, count(*) from t1 group by val;
drop table t1;
CREATE TABLE t1 (
id int(10) unsigned NOT NULL auto_increment,
val set('one','two','three') NOT NULL default 'one',
PRIMARY KEY (id)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
INSERT INTO t1 VALUES
(1,'one'),(2,'two'),(3,'three'),(4,'one'),(5,'two');
select val, count(*) from t1 group by val;
drop table t1;
......@@ -428,12 +428,8 @@ int ha_heap::create(const char *name, TABLE *table_arg,
seg->type= field->key_type();
else
{
if (!f_is_packed(flag) &&
f_packtype(flag) == (int) FIELD_TYPE_DECIMAL &&
!(field->charset() == &my_charset_bin))
seg->type= (int) HA_KEYTYPE_TEXT;
else
seg->type= (int) HA_KEYTYPE_BINARY;
if ((seg->type = field->key_type()) != (int) HA_KEYTYPE_TEXT)
seg->type= HA_KEYTYPE_BINARY;
}
seg->start= (uint) key_part->offset;
seg->length= (uint) key_part->length;
......
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