Below is the list of changes that have just been committed into a local
4.1 repository of psergey. When psergey 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.2338 05/07/11 23:57:16 sergefp@stripped +3 -0
Fix for BUG#11821: Make Item_type_holder able to work with MIN(field), MAX(field).
[comment to be discussed]
sql/item.cc
1.211 05/07/11 23:53:15 sergefp@stripped +6 -2
Fix for BUG#11821: Make Item_type_holder able to work with MIN(field), MAX(field).
mysql-test/t/subselect.test
1.145 05/07/11 23:53:15 sergefp@stripped +8 -0
Testcase for BUG#11821
mysql-test/r/subselect.result
1.166 05/07/11 23:53:15 sergefp@stripped +6 -0
Testcase for BUG#11821
# 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: sergefp
# Host: newbox.mylan
# Root: /home/psergey/mysql-4.1-bug11821
--- 1.210/sql/item.cc 2005-06-27 13:46:35 +00:00
+++ 1.211/sql/item.cc 2005-07-11 23:53:15 +00:00
@@ -3121,9 +3121,13 @@
if (fld_type == MYSQL_TYPE_ENUM ||
fld_type == MYSQL_TYPE_SET)
{
+ if (item->type() == Item::SUM_FUNC_ITEM &&
+ (((Item_sum*)item)->sum_func() == Item_sum::MAX_FUNC ||
+ ((Item_sum*)item)->sum_func() == Item_sum::MIN_FUNC))
+ item = ((Item_sum*)item)->args[0];
/*
- We can have enum/set type after merging only if we have one enum/set
- field and number of NULL fields
+ We can have enum/set type after merging only if we have one enum|set
+ field (or MIN|MAX(enum|set field)) and number of NULL fields
*/
DBUG_ASSERT((enum_set_typelib &&
get_real_type(item) == MYSQL_TYPE_NULL) ||
--- 1.165/mysql-test/r/subselect.result 2005-05-16 09:18:52 +00:00
+++ 1.166/mysql-test/r/subselect.result 2005-07-11 23:53:15 +00:00
@@ -2721,3 +2721,9 @@
ip count( e.itemid )
10.10.10.1 1
drop tables t1,t2;
+create table t1 (fld enum('0','1'));
+insert into t1 values ('1');
+select * from (select max(fld) from t1) as foo;
+max(fld)
+1
+drop table t1;
--- 1.144/mysql-test/t/subselect.test 2005-05-16 09:18:53 +00:00
+++ 1.145/mysql-test/t/subselect.test 2005-07-11 23:53:15 +00:00
@@ -1746,3 +1746,11 @@
INSERT INTO `t2` VALUES (1, 1, 1, '10.10.10.1');
SELECT s.ip, count( e.itemid ) FROM `t1` e JOIN t2 s ON s.sessionid = e.sessionid WHERE
e.sessionid = ( SELECT sessionid FROM t2 ORDER BY sessionid DESC LIMIT 1 ) GROUP BY s.ip
HAVING count( e.itemid ) >0 LIMIT 0 , 30;
drop tables t1,t2;
+
+# BUG#11821 : Select from subselect using aggregate function on an enum
+# segfaults:
+create table t1 (fld enum('0','1'));
+insert into t1 values ('1');
+select * from (select max(fld) from t1) as foo;
+drop table t1;
+
| Thread |
|---|
| • bk commit into 4.1 tree (sergefp:1.2338) BUG#11821 | Sergey Petrunia | 11 Jul |