diff options
author | unknown <evgen@moonbone.local> | 2006-09-29 00:50:00 +0400 |
---|---|---|
committer | unknown <evgen@moonbone.local> | 2006-09-29 00:50:00 +0400 |
commit | 4fd71723915fa9859599d6e8b71c29d5f0a6c38d (patch) | |
tree | b19d395d294022465649be85f4eab11573ef74c2 /mysql-test/t/select.test | |
parent | 3436f0acc1206c2614ee280b79e295c8deace91f (diff) | |
download | mariadb-git-4fd71723915fa9859599d6e8b71c29d5f0a6c38d.tar.gz |
Fixed bug#20503: Server crash due to the ORDER clause not taken into account
while space allocation
Under some circumstances DISTINCT clause can be converted to grouping.
In such cases grouping is performed by all items in the select list.
If an ORDER clause is present then items from it is prepended to group list.
But the case with ORDER wasn't taken into account when allocating the
array for sum functions. This leads to memory corruption and crash.
The JOIN::alloc_func_list() function now allocates additional space if there
is an ORDER by clause is specified and DISTINCT -> GROUP BY optimization is
possible.
mysql-test/t/select.test:
Added the test case for bug#20503: Server crash due to the ORDER clause not taken into account while space allocation
mysql-test/r/select.result:
Added the test case for bug#20503: Server crash due to the ORDER clause not taken into account while space allocation
sql/sql_select.cc:
Fixed bug#20503: Server crash due to the ORDER clause not taken into account
while space allocation
The JOIN::alloc_func_list() function now allocates additional space if there
is an ORDER by clause is specified and DISTINCT -> GROUP BY optimization is
possible.
Diffstat (limited to 'mysql-test/t/select.test')
-rw-r--r-- | mysql-test/t/select.test | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/mysql-test/t/select.test b/mysql-test/t/select.test index 36b3749b4d7..0686f670edf 100644 --- a/mysql-test/t/select.test +++ b/mysql-test/t/select.test @@ -2996,5 +2996,14 @@ SELECT * FROM t1 LEFT JOIN t2 ON t2.b=t1.a INNER JOIN t3 ON t3.d=t1.id SELECT * FROM t1 LEFT JOIN t2 ON t2.b=t1.a INNER JOIN t3 ON t3.d=t1.id WHERE t1.id=2; - DROP TABLE t1,t2,t3; + +# +# Bug#20503: Server crash due to the ORDER clause isn't taken into account +# while space allocation +# +create table t1 (c1 varchar(1), c2 int, c3 int, c4 int, c5 int, c6 int, +c7 int, c8 int, c9 int, fulltext key (`c1`)); +select distinct match (`c1`) against ('z') , c2, c3, c4,c5, c6,c7, c8 + from t1 where c9=1 order by c2, c2; +drop table t1; |