Commit 25441304 authored by Mattias Jonsson's avatar Mattias Jonsson

merge (from mysql-5.1-bugteam to my local tree)

parents 55bf4add cc8b0c75
...@@ -2372,28 +2372,3 @@ a MIN(b) MAX(b) AVG(b) ...@@ -2372,28 +2372,3 @@ a MIN(b) MAX(b) AVG(b)
2 1 3 2.0000 2 1 3 2.0000
1 1 3 2.0000 1 1 3 2.0000
DROP TABLE t1; DROP TABLE t1;
create table t1 (a int, b int, primary key (a,b), key `index` (a,b)) engine=MyISAM;
insert into t1 (a,b) values (0,0),(0,1),(0,2),(0,3),(0,4),(0,5),(0,6),(0,7),
(0,8),(0,9),(0,10),(0,11);
insert into t1 (a,b) select a, max(b)+1 from t1 where a = 0 group by a;
select * from t1;
a b
0 0
0 1
0 2
0 3
0 4
0 5
0 6
0 7
0 8
0 9
0 10
0 11
0 12
explain extended select sql_buffer_result a, max(b)+1 from t1 where a = 0 group by a;
id select_type table type possible_keys key key_len ref rows filtered Extra
1 SIMPLE t1 range PRIMARY,index PRIMARY 4 NULL 6 83.33 Using where; Using index for group-by; Using temporary
Warnings:
Note 1003 select sql_buffer_result `test`.`t1`.`a` AS `a`,(max(`test`.`t1`.`b`) + 1) AS `max(b)+1` from `test`.`t1` where (`test`.`t1`.`a` = 0) group by `test`.`t1`.`a`
drop table t1;
...@@ -1795,6 +1795,7 @@ lock tables t1 read; ...@@ -1795,6 +1795,7 @@ lock tables t1 read;
connect (con1,localhost,root,,); connect (con1,localhost,root,,);
--connection con1 --connection con1
--remove_file $MYSQLTEST_VARDIR/master-data/test/t1.CSV --remove_file $MYSQLTEST_VARDIR/master-data/test/t1.CSV
--replace_result $MYSQLTEST_VARDIR . master-data/ '' 13 2
# EE_FILENOTFOUND 29 # EE_FILENOTFOUND 29
--error 29 --error 29
select * from t1; select * from t1;
......
...@@ -942,15 +942,3 @@ SELECT a, MIN(b), MAX(b), AVG(b) FROM t1 GROUP BY a ORDER BY a DESC; ...@@ -942,15 +942,3 @@ SELECT a, MIN(b), MAX(b), AVG(b) FROM t1 GROUP BY a ORDER BY a DESC;
SELECT a, MIN(b), MAX(b), AVG(b) FROM t1 GROUP BY a ORDER BY a DESC; SELECT a, MIN(b), MAX(b), AVG(b) FROM t1 GROUP BY a ORDER BY a DESC;
DROP TABLE t1; DROP TABLE t1;
#
# Bug#38195: Incorrect handling of aggregate functions when loose index scan is
# used causes server crash.
#
create table t1 (a int, b int, primary key (a,b), key `index` (a,b)) engine=MyISAM;
insert into t1 (a,b) values (0,0),(0,1),(0,2),(0,3),(0,4),(0,5),(0,6),(0,7),
(0,8),(0,9),(0,10),(0,11);
insert into t1 (a,b) select a, max(b)+1 from t1 where a = 0 group by a;
select * from t1;
explain extended select sql_buffer_result a, max(b)+1 from t1 where a = 0 group by a;
drop table t1;
...@@ -1794,8 +1794,7 @@ JOIN::exec() ...@@ -1794,8 +1794,7 @@ JOIN::exec()
if (!items1) if (!items1)
{ {
items1= items0 + all_fields.elements; items1= items0 + all_fields.elements;
if (sort_and_group || curr_tmp_table->group || if (sort_and_group || curr_tmp_table->group)
tmp_table_param.precomputed_group_by)
{ {
if (change_to_use_tmp_fields(thd, items1, if (change_to_use_tmp_fields(thd, items1,
tmp_fields_list1, tmp_all_fields1, tmp_fields_list1, tmp_all_fields1,
...@@ -9629,8 +9628,6 @@ create_tmp_table(THD *thd,TMP_TABLE_PARAM *param,List<Item> &fields, ...@@ -9629,8 +9628,6 @@ create_tmp_table(THD *thd,TMP_TABLE_PARAM *param,List<Item> &fields,
MI_COLUMNDEF *recinfo; MI_COLUMNDEF *recinfo;
uint total_uneven_bit_length= 0; uint total_uneven_bit_length= 0;
bool force_copy_fields= param->force_copy_fields; bool force_copy_fields= param->force_copy_fields;
/* Treat sum functions as normal ones when loose index scan is used. */
save_sum_fields|= param->precomputed_group_by;
DBUG_ENTER("create_tmp_table"); DBUG_ENTER("create_tmp_table");
DBUG_PRINT("enter", DBUG_PRINT("enter",
("distinct: %d save_sum_fields: %d rows_limit: %lu group: %d", ("distinct: %d save_sum_fields: %d rows_limit: %lu group: %d",
......
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