diff --git a/mysql-test/main/partition.result b/mysql-test/main/partition.result index 4a77e2221ea..b9bc65b6cfb 100644 --- a/mysql-test/main/partition.result +++ b/mysql-test/main/partition.result @@ -2858,3 +2858,16 @@ id select_type table type possible_keys key key_len ref rows Extra 2 DEPENDENT SUBQUERY t3 ref_or_null a1,b a1 10 func,test.t2.a 198 Using where; Full scan on NULL key set optimizer_switch=@tmp_os; drop table t1,t2,t3; +# +# MDEV-32388 MSAN / Valgrind errors in +# Item_func_like::get_mm_leaf upon query from partitioned table +# +CREATE TABLE t1 (a INT) PARTITION BY HASH(a) PARTITIONS 2; +INSERT INTO t1 VALUES (1),(2); +SELECT * FROM t1 WHERE a LIKE '1'; +a +1 +DROP TABLE t1; +# +# End of 10.6 tests +# diff --git a/mysql-test/main/partition.test b/mysql-test/main/partition.test index 81cc3567629..dd778ebdab9 100644 --- a/mysql-test/main/partition.test +++ b/mysql-test/main/partition.test @@ -3066,3 +3066,17 @@ set optimizer_switch=@tmp_os; drop table t1,t2,t3; + +--echo # +--echo # MDEV-32388 MSAN / Valgrind errors in +--echo # Item_func_like::get_mm_leaf upon query from partitioned table +--echo # + +CREATE TABLE t1 (a INT) PARTITION BY HASH(a) PARTITIONS 2; +INSERT INTO t1 VALUES (1),(2); +SELECT * FROM t1 WHERE a LIKE '1'; +DROP TABLE t1; + +--echo # +--echo # End of 10.6 tests +--echo # diff --git a/sql/opt_range.cc b/sql/opt_range.cc index ddfa7dd838e..09b19944bb5 100644 --- a/sql/opt_range.cc +++ b/sql/opt_range.cc @@ -2757,6 +2757,7 @@ int SQL_SELECT::test_quick_select(THD *thd, key_map keys_to_use, DBUG_RETURN(0); // Fatal error flag is set /* set up parameter that is passed to all functions */ + bzero((void*) ¶m, sizeof(param)); param.thd= thd; param.baseflag= head->file->ha_table_flags(); param.prev_tables=prev_tables | const_tables; @@ -3949,6 +3950,7 @@ bool prune_partitions(THD *thd, TABLE *table, Item *pprune_cond) prune_param.part_info= part_info; init_sql_alloc(key_memory_quick_range_select_root, &alloc, thd->variables.range_alloc_block_size, 0, MYF(MY_THREAD_SPECIFIC)); + bzero((void*) range_par, sizeof(*range_par)); range_par->mem_root= &alloc; range_par->old_root= thd->mem_root; @@ -3974,6 +3976,7 @@ bool prune_partitions(THD *thd, TABLE *table, Item *pprune_cond) range_par->remove_jump_scans= FALSE; range_par->real_keynr[0]= 0; range_par->alloced_sel_args= 0; + range_par->note_unusable_keys= 0; thd->no_errors=1; // Don't warn about NULL thd->mem_root=&alloc;