Commit 97bd8d89 authored by Sergey Petrunya's avatar Sergey Petrunya

MDEV-405: Server crashes in test_if_skip_sort_order on EXPLAIN with GROUP BY...

MDEV-405: Server crashes in test_if_skip_sort_order on EXPLAIN with GROUP BY and HAVING in EXISTS subquery
- Testcase
parent 78497dbf
...@@ -6846,3 +6846,16 @@ id select_type table type possible_keys key key_len ref rows Extra ...@@ -6846,3 +6846,16 @@ id select_type table type possible_keys key key_len ref rows Extra
2 SUBQUERY t1 index a a 5 NULL 1 Using where; Using index 2 SUBQUERY t1 index a a 5 NULL 1 Using where; Using index
2 SUBQUERY t2 ref b b 5 test.t1.a 2 Using index 2 SUBQUERY t2 ref b b 5 test.t1.a 2 Using index
DROP TABLE t1,t2; DROP TABLE t1,t2;
#
# MDEV-405: Server crashes in test_if_skip_sort_order on EXPLAIN with GROUP BY and HAVING in EXISTS subquery
#
CREATE TABLE t1 (a INT, KEY(a));
INSERT INTO t1 VALUES (1),(8);
CREATE TABLE t2 (b INT, KEY(b));
INSERT INTO t2 VALUES (45),(17),(20);
EXPLAIN SELECT * FROM t1 WHERE EXISTS ( SELECT a FROM t1, t2 WHERE b = a GROUP BY a HAVING a <> 1 ) ;
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE
2 SUBQUERY t1 index a a 5 NULL 1 Using where; Using index
2 SUBQUERY t2 ref b b 5 test.t1.a 2 Using index
DROP TABLE t1,t2;
...@@ -6844,6 +6844,19 @@ id select_type table type possible_keys key key_len ref rows Extra ...@@ -6844,6 +6844,19 @@ id select_type table type possible_keys key key_len ref rows Extra
2 SUBQUERY t1 index a a 5 NULL 1 Using where; Using index 2 SUBQUERY t1 index a a 5 NULL 1 Using where; Using index
2 SUBQUERY t2 ref b b 5 test.t1.a 2 Using index 2 SUBQUERY t2 ref b b 5 test.t1.a 2 Using index
DROP TABLE t1,t2; DROP TABLE t1,t2;
#
# MDEV-405: Server crashes in test_if_skip_sort_order on EXPLAIN with GROUP BY and HAVING in EXISTS subquery
#
CREATE TABLE t1 (a INT, KEY(a));
INSERT INTO t1 VALUES (1),(8);
CREATE TABLE t2 (b INT, KEY(b));
INSERT INTO t2 VALUES (45),(17),(20);
EXPLAIN SELECT * FROM t1 WHERE EXISTS ( SELECT a FROM t1, t2 WHERE b = a GROUP BY a HAVING a <> 1 ) ;
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE
2 SUBQUERY t1 index a a 5 NULL 1 Using where; Using index
2 SUBQUERY t2 ref b b 5 test.t1.a 2 Using index
DROP TABLE t1,t2;
set optimizer_switch=default; set optimizer_switch=default;
select @@optimizer_switch like '%materialization=on%'; select @@optimizer_switch like '%materialization=on%';
@@optimizer_switch like '%materialization=on%' @@optimizer_switch like '%materialization=on%'
......
...@@ -6841,4 +6841,17 @@ id select_type table type possible_keys key key_len ref rows Extra ...@@ -6841,4 +6841,17 @@ id select_type table type possible_keys key key_len ref rows Extra
2 SUBQUERY t1 index a a 5 NULL 1 Using where; Using index 2 SUBQUERY t1 index a a 5 NULL 1 Using where; Using index
2 SUBQUERY t2 ref b b 5 test.t1.a 2 Using index 2 SUBQUERY t2 ref b b 5 test.t1.a 2 Using index
DROP TABLE t1,t2; DROP TABLE t1,t2;
#
# MDEV-405: Server crashes in test_if_skip_sort_order on EXPLAIN with GROUP BY and HAVING in EXISTS subquery
#
CREATE TABLE t1 (a INT, KEY(a));
INSERT INTO t1 VALUES (1),(8);
CREATE TABLE t2 (b INT, KEY(b));
INSERT INTO t2 VALUES (45),(17),(20);
EXPLAIN SELECT * FROM t1 WHERE EXISTS ( SELECT a FROM t1, t2 WHERE b = a GROUP BY a HAVING a <> 1 ) ;
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE
2 SUBQUERY t1 index a a 5 NULL 1 Using where; Using index
2 SUBQUERY t2 ref b b 5 test.t1.a 2 Using index
DROP TABLE t1,t2;
set @optimizer_switch_for_subselect_test=null; set @optimizer_switch_for_subselect_test=null;
...@@ -6852,6 +6852,19 @@ id select_type table type possible_keys key key_len ref rows Extra ...@@ -6852,6 +6852,19 @@ id select_type table type possible_keys key key_len ref rows Extra
2 SUBQUERY t1 index a a 5 NULL 1 Using where; Using index 2 SUBQUERY t1 index a a 5 NULL 1 Using where; Using index
2 SUBQUERY t2 ref b b 5 test.t1.a 2 Using index 2 SUBQUERY t2 ref b b 5 test.t1.a 2 Using index
DROP TABLE t1,t2; DROP TABLE t1,t2;
#
# MDEV-405: Server crashes in test_if_skip_sort_order on EXPLAIN with GROUP BY and HAVING in EXISTS subquery
#
CREATE TABLE t1 (a INT, KEY(a));
INSERT INTO t1 VALUES (1),(8);
CREATE TABLE t2 (b INT, KEY(b));
INSERT INTO t2 VALUES (45),(17),(20);
EXPLAIN SELECT * FROM t1 WHERE EXISTS ( SELECT a FROM t1, t2 WHERE b = a GROUP BY a HAVING a <> 1 ) ;
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE
2 SUBQUERY t1 index a a 5 NULL 1 Using where; Using index
2 SUBQUERY t2 ref b b 5 test.t1.a 2 Using index
DROP TABLE t1,t2;
set optimizer_switch=default; set optimizer_switch=default;
select @@optimizer_switch like '%subquery_cache=on%'; select @@optimizer_switch like '%subquery_cache=on%';
@@optimizer_switch like '%subquery_cache=on%' @@optimizer_switch like '%subquery_cache=on%'
......
...@@ -6841,5 +6841,18 @@ id select_type table type possible_keys key key_len ref rows Extra ...@@ -6841,5 +6841,18 @@ id select_type table type possible_keys key key_len ref rows Extra
2 SUBQUERY t1 index a a 5 NULL 1 Using where; Using index 2 SUBQUERY t1 index a a 5 NULL 1 Using where; Using index
2 SUBQUERY t2 ref b b 5 test.t1.a 2 Using index 2 SUBQUERY t2 ref b b 5 test.t1.a 2 Using index
DROP TABLE t1,t2; DROP TABLE t1,t2;
#
# MDEV-405: Server crashes in test_if_skip_sort_order on EXPLAIN with GROUP BY and HAVING in EXISTS subquery
#
CREATE TABLE t1 (a INT, KEY(a));
INSERT INTO t1 VALUES (1),(8);
CREATE TABLE t2 (b INT, KEY(b));
INSERT INTO t2 VALUES (45),(17),(20);
EXPLAIN SELECT * FROM t1 WHERE EXISTS ( SELECT a FROM t1, t2 WHERE b = a GROUP BY a HAVING a <> 1 ) ;
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE
2 SUBQUERY t1 index a a 5 NULL 1 Using where; Using index
2 SUBQUERY t2 ref b b 5 test.t1.a 2 Using index
DROP TABLE t1,t2;
set @optimizer_switch_for_subselect_test=null; set @optimizer_switch_for_subselect_test=null;
set @join_cache_level_for_subselect_test=NULL; set @join_cache_level_for_subselect_test=NULL;
...@@ -5756,3 +5756,16 @@ EXPLAIN SELECT * FROM t1 WHERE EXISTS ( SELECT a FROM t1, t2 WHERE b = a GROUP B ...@@ -5756,3 +5756,16 @@ EXPLAIN SELECT * FROM t1 WHERE EXISTS ( SELECT a FROM t1, t2 WHERE b = a GROUP B
DROP TABLE t1,t2; DROP TABLE t1,t2;
--echo #
--echo # MDEV-405: Server crashes in test_if_skip_sort_order on EXPLAIN with GROUP BY and HAVING in EXISTS subquery
--echo #
CREATE TABLE t1 (a INT, KEY(a));
INSERT INTO t1 VALUES (1),(8);
CREATE TABLE t2 (b INT, KEY(b));
INSERT INTO t2 VALUES (45),(17),(20);
EXPLAIN SELECT * FROM t1 WHERE EXISTS ( SELECT a FROM t1, t2 WHERE b = a GROUP BY a HAVING a <> 1 ) ;
DROP TABLE t1,t2;
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