@@ -2062,4 +2062,67 @@ LEFT JOIN (t1 a LEFT JOIN t1 b ON t1.i = b.i) ON c.i = t1.i);
206220621
206320631
20642064DROP TABLE t1;
2065+ #
2066+ # MDEV-35206: Assertion in JOIN::dbug_verify_sj_inner_tables
2067+ #
2068+ SET @save_optimizer_join_limit_pref_ratio= @@optimizer_join_limit_pref_ratio;
2069+ SET @save_optimizer_search_depth= @@optimizer_search_depth;
2070+ CREATE TABLE t1 (c1 VARCHAR(64) DEFAULT NULL, c2 VARCHAR(8) DEFAULT NULL);
2071+ INSERT INTO t1 (c1) values ('one');
2072+ INSERT INTO t1 (c2) values ('2');
2073+ SET optimizer_join_limit_pref_ratio=10;
2074+ SET optimizer_search_depth=1;
2075+ SELECT
2076+ c1
2077+ FROM
2078+ t1
2079+ WHERE
2080+ c2 IN (SELECT c2
2081+ FROM t1
2082+ WHERE c1 IN (SELECT c1
2083+ FROM t1
2084+ WHERE c1 IN (NULL)
2085+ )
2086+ )
2087+ ORDER BY c1 LIMIT 1;
2088+ c1
2089+ DROP TABLE t1;
2090+ #
2091+ # similar issue with join::cur_embedding_map
2092+ #
2093+ CREATE TABLE t10 (a int, b int, index(b));
2094+ INSERT INTO t10 SELECT seq, seq FROM seq_1_to_10;
2095+ CREATE TABLE t11(a int, b int);
2096+ CREATE TABLE t12(a int, b int, index(b));
2097+ INSERT INTO t11 select seq, seq FROM seq_1_to_20;
2098+ INSERT INTO t12 select seq, seq FROM seq_1_to_40;
2099+ CREATE TABLE t13(a int, b int);
2100+ CREATE TABLE t14(a int, b int, index(b));
2101+ INSERT INTO t13 select seq, seq FROM seq_1_to_20;
2102+ INSERT INTO t14 select seq, seq FROM seq_1_to_40;
2103+ ANALYZE TABLE t10, t11, t12;
2104+ Table Op Msg_type Msg_text
2105+ test.t10 analyze status Engine-independent statistics collected
2106+ test.t10 analyze status Table is already up to date
2107+ test.t11 analyze status Engine-independent statistics collected
2108+ test.t11 analyze status OK
2109+ test.t12 analyze status Engine-independent statistics collected
2110+ test.t12 analyze status Table is already up to date
2111+ EXPLAIN SELECT *
2112+ FROM
2113+ t10 LEFT JOIN
2114+ (
2115+ t11 JOIN t12 ON t11.b=t12.b
2116+ left join (t13 join t14 on t13.b=t14.b) on t13.a=t11.a
2117+ ) ON t10.a=t11.a
2118+ ORDER BY t10.b LIMIT 1;
2119+ id select_type table type possible_keys key key_len ref rows Extra
2120+ 1 SIMPLE t10 ALL NULL NULL NULL NULL 10 Using temporary; Using filesort
2121+ 1 SIMPLE t11 ALL NULL NULL NULL NULL 20 Using where
2122+ 1 SIMPLE t12 ref b b 5 test.t11.b 1
2123+ 1 SIMPLE t13 ALL NULL NULL NULL NULL 20 Using where
2124+ 1 SIMPLE t14 ref b b 5 test.t13.b 1
2125+ DROP TABLE t10, t11, t12, t13, t14;
2126+ SET optimizer_join_limit_pref_ratio= @save_optimizer_join_limit_pref_ratio;
2127+ SET optimizer_search_depth= @save_optimizer_search_depth;
20652128# end of 10.11 tests
0 commit comments