summaryrefslogtreecommitdiff
path: root/mysql-test/main/derived_cond_pushdown.test
diff options
context:
space:
mode:
authorIgor Babaev <igor@askmonty.org>2018-08-03 14:54:02 -0700
committerIgor Babaev <igor@askmonty.org>2018-08-03 15:09:49 -0700
commitd453374fc480112266996a1026b97654cc174c09 (patch)
treee3dbc26ed568dec0c2c86b3d11ed88dc72c06c86 /mysql-test/main/derived_cond_pushdown.test
parent7749745b7d688bd35d92219869f93dd0b44117fc (diff)
downloadmariadb-git-d453374fc480112266996a1026b97654cc174c09.tar.gz
MDEV-16801 seg_fault on a query
The bug was in the in the code of JOIN::check_for_splittable_materialized() where the structures describing the fields of a materialized derived table that potentially could be used in split optimization were build. As a result of this bug some fields that were not usable for splitting were detected as usable. This could trigger crashes further in st_join_table::choose_best_splitting().
Diffstat (limited to 'mysql-test/main/derived_cond_pushdown.test')
-rw-r--r--mysql-test/main/derived_cond_pushdown.test33
1 files changed, 33 insertions, 0 deletions
diff --git a/mysql-test/main/derived_cond_pushdown.test b/mysql-test/main/derived_cond_pushdown.test
index 0c3a542f907..b75c56e9ff2 100644
--- a/mysql-test/main/derived_cond_pushdown.test
+++ b/mysql-test/main/derived_cond_pushdown.test
@@ -2986,3 +2986,36 @@ END;$$
DELIMITER ;$$
SELECT a FROM (SELECT "aa" a) t WHERE f1(t.a, (SELECT MAX('aa') FROM DUAL LIMIT 1));
DROP FUNCTION f1;
+
+--echo #
+--echo # MDEV-16801: splittable materialized derived/views with
+--echo # one grouping field from table without keys
+--echo #
+
+CREATE TABLE t1 (a int, b int, INDEX idx_a(a), INDEX idx_b(b)) ENGINE=MYISAM;
+CREATE TABLE t2 (c int) ENGINE=MYISAM;
+CREATE TABLE t3 (d int) ENGINE=MYISAM;
+INSERT INTO t1 VALUES
+ (77,7), (11,1), (33,3), (44,4), (8,88),
+ (78,7), (98,9), (38,3), (28,2), (79,7),
+ (58,5), (42,4), (71,7), (27,2), (91,9);
+INSERT INTO t1 SELECT a+100, b+10 FROM t1;
+INSERT INTO t2 VALUES
+ (100), (700), (200), (100), (200);
+INSERT INTO t3 VALUES
+ (3), (4), (1), (8), (3);
+
+ANALYZE tables t1,t2,t3;
+
+let $q=
+SELECT *
+ FROM t3,
+ (SELECT t1.b, t2.c
+ FROM t1, t2
+ GROUP BY t1.b,t2.c) dt
+WHERE t3.d = dt.b;
+
+eval $q;
+eval EXPLAIN EXTENDED $q;
+
+DROP TABLE t1,t2,t3;