summaryrefslogtreecommitdiff
path: root/mysql-test/main/join_outer.test
diff options
context:
space:
mode:
authorSergei Petrunia <psergey@askmonty.org>2020-06-16 01:29:51 +0300
committerSergei Petrunia <psergey@askmonty.org>2020-06-16 01:29:51 +0300
commit57b224a5c2b774411ca8f107b3675dd2f340ccee (patch)
tree4a1a3800036712b2a70f0ab6892ca42c9903ce6b /mysql-test/main/join_outer.test
parent32b34cb95edc1032381225b58780fc92cb449200 (diff)
downloadmariadb-git-bb-10.3-mdev22866.tar.gz
MDEV-22866: Server crashes in ... with not_null_range_scan=onbb-10.3-mdev22866
Starting from 10.3, the optimizer is able to detect that entire outer join nests are constants (because of "Impossible ON") and remove them (see mark_join_nest_as_const) However, this was not properly accounted for in NESTED_JOIN structure and the way check_interleaving_with_nj() uses its n_tables member to check if the join prefix order is allowed. (The result was that the optimizer could conclude that no join prefix is allowed and fail an assertion)
Diffstat (limited to 'mysql-test/main/join_outer.test')
-rw-r--r--mysql-test/main/join_outer.test35
1 files changed, 35 insertions, 0 deletions
diff --git a/mysql-test/main/join_outer.test b/mysql-test/main/join_outer.test
index 2e5fc65ebb6..dfac9caae73 100644
--- a/mysql-test/main/join_outer.test
+++ b/mysql-test/main/join_outer.test
@@ -2252,3 +2252,38 @@ drop view v4;
drop table t1,t2,t3,t4;
SET optimizer_switch=@org_optimizer_switch;
+
+--echo #
+--echo # MDEV-22866: Server crashes in ... with not_null_range_scan=on
+--echo #
+
+CREATE TABLE t1 (a INT) ENGINE=MyISAM;
+INSERT INTO t1 VALUES (1),(2);
+
+CREATE TABLE t2 (b INT) ENGINE=MyISAM;
+INSERT INTO t2 VALUES (3),(4);
+
+CREATE TABLE t3 (c INT, KEY(c)) ENGINE=MyISAM;
+
+CREATE TABLE t4 (d INT, KEY(d)) ENGINE=MyISAM;
+INSERT INTO t4 VALUES (5),(6);
+
+CREATE TABLE t5 (e INT) ENGINE=MyISAM;
+INSERT INTO t5 VALUES (7),(8);
+
+CREATE TABLE t6 (f INT) ENGINE=MyISAM;
+INSERT INTO t6 VALUES (9),(10);
+
+SELECT *
+FROM
+ t1
+ LEFT JOIN (
+ t2 LEFT JOIN (
+ t3 JOIN
+ t4 ON t3.c = t4.d and t3.c >2 and t3.c<0
+ ) ON t2.b >= t4.d
+ ) ON t1.a <= t2.b
+ LEFT JOIN t5 ON t2.b = t5.e
+ LEFT JOIN t6 ON t3.c = t6.f;
+
+drop table t1,t2,t3,t4,t5,t6;