Skip to content

Commit d4177a7

Browse files
committed
MDEV-23937: SIGSEGV in looped best_extension_by_limited_search from greedy_search
Add a testcase (fixed by fix for MDEV-17783)
1 parent cdb2996 commit d4177a7

File tree

2 files changed

+41
-0
lines changed

2 files changed

+41
-0
lines changed

mysql-test/r/selectivity_no_engine.result

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -293,6 +293,26 @@ SELECT * FROM t1 WHERE t1.d = 0 AND t1.p = '1' AND t1.i != '-1' AND t1.n = 'some
293293
i n d p
294294
set optimizer_use_condition_selectivity= @tmp_mdev8779;
295295
DROP TABLE t1;
296+
#
297+
# MDEV-23937: SIGSEGV in looped best_extension_by_limited_search from greedy_search
298+
# (Testcase only)
299+
#
300+
set
301+
@tmp_jcl= @@join_cache_level,
302+
@tmp_ucs= @@optimizer_use_condition_selectivity;
303+
set
304+
join_cache_level=3,
305+
optimizer_use_condition_selectivity=2;
306+
CREATE TABLE t1 AS SELECT * FROM mysql.user;
307+
CREATE TABLE t3 (b VARCHAR (1));
308+
CREATE TABLE t2 (c2 INT);
309+
INSERT INTO t2 VALUES (1);
310+
EXPLAIN
311+
SELECT * FROM t1 AS a NATURAL JOIN t1 AS b;
312+
id select_type table type possible_keys key key_len ref rows Extra
313+
1 SIMPLE a ALL NULL NULL NULL NULL 4
314+
1 SIMPLE b hash_ALL NULL #hash#$hj 827 test.a.Host,test.a.User,test.a.Password,test.a.Select_priv,test.a.Insert_priv,test.a.Update_priv,test.a.Delete_priv,test.a.Create_priv,test.a.Drop_priv,test.a.Reload_priv,test.a.Shutdown_priv,test.a.Process_priv,test.a.File_priv,test.a.Grant_priv,test.a.References_priv,test.a.Index_priv,test.a.Alter_priv,test.a.Show_db_priv,test.a.Super_priv,test.a.Create_tmp_table_priv,test.a.Lock_tables_priv,test.a.Execute_priv,test.a.Repl_slave_priv,test.a.Repl_client_priv,test.a.Create_view_priv,test.a.Show_view_priv,test.a.Create_routine_priv,test.a.Alter_routine_priv,test.a.Create_user_priv,test.a.Event_priv,test.a.Trigger_priv,test.a.Create_tablespace_priv,test.a.ssl_type,test.a.ssl_cipher,test.a.x509_issuer,test.a.x509_subject,test.a.max_questions,test.a.max_updates,test.a.max_connections,test.a.max_user_connections,test.a.plugin,test.a.authentication_string,test.a.password_expired,test.a.is_role,test.a.default_role,test.a.max_statement_time 4 Using where; Using join buffer (flat, BNLH join)
315+
DROP TABLE t1,t2,t3;
296316
#
297317
# End of the test file
298318
#

mysql-test/t/selectivity_no_engine.test

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -228,6 +228,27 @@ SELECT * FROM t1 WHERE t1.d = 0 AND t1.p = '1' AND t1.i != '-1' AND t1.n = 'some
228228
set optimizer_use_condition_selectivity= @tmp_mdev8779;
229229
DROP TABLE t1;
230230

231+
--echo #
232+
--echo # MDEV-23937: SIGSEGV in looped best_extension_by_limited_search from greedy_search
233+
--echo # (Testcase only)
234+
--echo #
235+
set
236+
@tmp_jcl= @@join_cache_level,
237+
@tmp_ucs= @@optimizer_use_condition_selectivity;
238+
set
239+
join_cache_level=3,
240+
optimizer_use_condition_selectivity=2;
241+
242+
CREATE TABLE t1 AS SELECT * FROM mysql.user;
243+
CREATE TABLE t3 (b VARCHAR (1));
244+
CREATE TABLE t2 (c2 INT);
245+
INSERT INTO t2 VALUES (1);
246+
247+
EXPLAIN
248+
SELECT * FROM t1 AS a NATURAL JOIN t1 AS b;
249+
250+
DROP TABLE t1,t2,t3;
251+
231252
--echo #
232253
--echo # End of the test file
233254
--echo #

0 commit comments

Comments
 (0)