mirror of
https://github.com/MariaDB/server.git
synced 2025-01-18 13:02:28 +01:00
Fix for BUG#11821 manually merged
This commit is contained in:
commit
32a4e52d97
3 changed files with 20 additions and 2 deletions
|
@ -2837,3 +2837,9 @@ WHERE select_id = 0 OR select_id = 1);
|
|||
values_id
|
||||
1
|
||||
DROP TABLE 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;
|
||||
|
|
|
@ -1859,3 +1859,11 @@ WHERE values_id IN (SELECT values_id FROM t2
|
|||
WHERE select_id = 0 OR select_id = 1);
|
||||
|
||||
DROP TABLE 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;
|
||||
|
||||
|
|
|
@ -5421,9 +5421,13 @@ void Item_type_holder::get_full_info(Item *item)
|
|||
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) ||
|
||||
|
|
Loading…
Reference in a new issue