diff options
author | Evgeny Potemkin <epotemkin@mysql.com> | 2008-08-13 22:24:55 +0400 |
---|---|---|
committer | Evgeny Potemkin <epotemkin@mysql.com> | 2008-08-13 22:24:55 +0400 |
commit | b789b4f33cdf245d1f582aa755410754b197a693 (patch) | |
tree | 6a2142b5a1c13190cc1dd86dae1bcb64ad1cf741 /mysql-test/t/group_min_max.test | |
parent | 8ed209b21ddd1f46dfeaaae34a60cbd18e47d4e7 (diff) | |
download | mariadb-git-b789b4f33cdf245d1f582aa755410754b197a693.tar.gz |
Bug#38195: Incorrect handling of aggregate functions when loose index scan is
used causes server crash.
When the loose index scan access method is used values of aggregated functions
are precomputed by it. Aggregation of such functions shouldn't be performed
in this case and functions should be treated as normal ones.
The create_tmp_table function wasn't taking this into account and this led to
a crash if a query has MIN/MAX aggregate functions and employs temporary table
and loose index scan.
Now the JOIN::exec and the create_tmp_table functions treat MIN/MAX aggregate
functions as normal ones when the loose index scan is used.
mysql-test/r/group_min_max.result:
Added a test case for the bug#38195.
mysql-test/t/group_min_max.test:
Added a test case for the bug#38195.
sql/sql_select.cc:
Bug#38195: Incorrect handling of aggregate functions when loose index scan is
used causes server crash.
Now the JOIN::exec and the create_tmp_table functions treat MIN/MAX aggregate
functions as normal ones when the loose index scan is used.
Diffstat (limited to 'mysql-test/t/group_min_max.test')
-rw-r--r-- | mysql-test/t/group_min_max.test | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/mysql-test/t/group_min_max.test b/mysql-test/t/group_min_max.test index 7f2607b513d..196dd3379f9 100644 --- a/mysql-test/t/group_min_max.test +++ b/mysql-test/t/group_min_max.test @@ -916,3 +916,15 @@ 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; + +# +# 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),(0,12),(0,13); +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; |