summaryrefslogtreecommitdiff
path: root/mysql-test/include
diff options
context:
space:
mode:
authorGleb Shchepa <gshchepa@mysql.com>2009-05-12 22:42:31 +0500
committerGleb Shchepa <gshchepa@mysql.com>2009-05-12 22:42:31 +0500
commitbd59628754d7f6ced2c19286c041b1ee5ce354e0 (patch)
tree1ecbe032ef7a19d000c1849e7374679dce97c01e /mysql-test/include
parent206bdd67c67fb28c014b873ac6732e99139d31c4 (diff)
downloadmariadb-git-bd59628754d7f6ced2c19286c041b1ee5ce354e0.tar.gz
Bug #44290: explain crashes for subquery with distinct in
SQL_SELECT::test_quick_select The crash was caused by an incomplete cleanup of JOIN_TAB::select during the filesort of rows for GROUP BY clause inside a subquery. Queries where a quick index access is replaced with filesort was was affected. For example: SELECT 1 FROM (SELECT COUNT(DISTINCT c1) FROM t1 WHERE c2 IN (1, 1) AND c3 = 2 GROUP BY c2) x Quick index access related data in the SQL_SELECT::test_quick_select function was inconsistent after an incomplete cleanup. This function has been completed to prevent crashes in the SQL_SELECT::test_quick_select function. mysql-test/include/mix1.inc: Add test case for bug #44290. mysql-test/r/innodb_mysql.result: Add test case for bug #44290. sql/sql_select.cc: Bug #44290: explain crashes for subquery with distinct in SQL_SELECT::test_quick_select Quick index access related data in the SQL_SELECT::test_quick_select function was inconsistent after an incomplete cleanup. This function has been completed to prevent crashes in the SQL_SELECT::test_quick_select function.
Diffstat (limited to 'mysql-test/include')
-rw-r--r--mysql-test/include/mix1.inc19
1 files changed, 19 insertions, 0 deletions
diff --git a/mysql-test/include/mix1.inc b/mysql-test/include/mix1.inc
index c9cbf2d2839..7c87949830f 100644
--- a/mysql-test/include/mix1.inc
+++ b/mysql-test/include/mix1.inc
@@ -1516,4 +1516,23 @@ DROP TABLE t1;
# DROP TABLE t1;
#
+--echo #
+--echo # Bug #44290: explain crashes for subquery with distinct in
+--echo # SQL_SELECT::test_quick_select
+--echo # (reproduced only with InnoDB tables)
+--echo #
+
+eval
+CREATE TABLE t1 (c1 INT, c2 INT, c3 INT, KEY (c3), KEY (c2, c3))
+ ENGINE=$engine_type;
+INSERT INTO t1 VALUES (1,1,1), (1,1,1), (1,1,2), (1,1,1), (1,1,2);
+
+SELECT 1 FROM (SELECT COUNT(DISTINCT c1)
+ FROM t1 WHERE c2 IN (1, 1) AND c3 = 2 GROUP BY c2) x;
+EXPLAIN
+SELECT 1 FROM (SELECT COUNT(DISTINCT c1)
+ FROM t1 WHERE c2 IN (1, 1) AND c3 = 2 GROUP BY c2) x;
+
+DROP TABLE t1;
+
--echo End of 5.1 tests