You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Fixed mdev-14947 Assertion `0' fails in Field_null::can_optimize_keypart_ref
when number of NULLs in IN list reaches in_predicate_conversion_threshold
The bug was fixed by removing an assertion that had been set in order
just to test whether the code could be ever executed.
Copy file name to clipboardExpand all lines: mysql-test/r/opt_tvc.result
+24Lines changed: 24 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -614,3 +614,27 @@ Warnings:
614
614
Note 1003 /* select#1 */ select `test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t2`.`c` AS `c` from `test`.`t2` where !<expr_cache><`test`.`t2`.`a`,`test`.`t2`.`c`>(<in_optimizer>((`test`.`t2`.`a`,`test`.`t2`.`c`),(`test`.`t2`.`a`,`test`.`t2`.`c`) in ( <materialize> (/* select#2 */ select `tvc_0`.`1`,`tvc_0`.`2` from (values (1,2),(8,9),(5,1)) `tvc_0` ), <primary_index_lookup>(`test`.`t2`.`a` in <temporary table> on distinct_key where `test`.`t2`.`a` = `<subquery2>`.`1` and `test`.`t2`.`c` = `<subquery2>`.`2`))))
615
615
drop table t1, t2, t3;
616
616
set @@in_predicate_conversion_threshold= default;
617
+
#
618
+
# MDEV-14947: conversion of TVC with only NULL values
619
+
#
620
+
CREATE TABLE t1 (i INT);
621
+
INSERT INTO t1 VALUES (3), (2), (7);
622
+
SELECT * FROM t1 WHERE i IN (NULL, NULL, NULL, NULL, NULL);
623
+
i
624
+
EXPLAIN EXTENDED SELECT * FROM t1 WHERE i IN (NULL, NULL, NULL, NULL, NULL);
625
+
id select_type table type possible_keys key key_len ref rows filtered Extra
626
+
1 SIMPLE t1 ALL NULL NULL NULL NULL 3 100.00 Using where
627
+
Warnings:
628
+
Note 1003 select `test`.`t1`.`i` AS `i` from `test`.`t1` where `test`.`t1`.`i` in (NULL,NULL,NULL,NULL,NULL)
629
+
SET in_predicate_conversion_threshold= 5;
630
+
SELECT * FROM t1 WHERE i IN (NULL, NULL, NULL, NULL, NULL);
631
+
i
632
+
EXPLAIN EXTENDED SELECT * FROM t1 WHERE i IN (NULL, NULL, NULL, NULL, NULL);
633
+
id select_type table type possible_keys key key_len ref rows filtered Extra
634
+
1 PRIMARY t1 ALL NULL NULL NULL NULL 3 100.00
635
+
1 PRIMARY <derived3> ALL NULL NULL NULL NULL 2 100.00 Using where; FirstMatch(t1); Using join buffer (flat, BNL join)
636
+
3 DERIVED NULL NULL NULL NULL NULL NULL NULL NULL No tables used
637
+
Warnings:
638
+
Note 1003 /* select#1 */ select `test`.`t1`.`i` AS `i` from `test`.`t1` semi join ((values (NULL),(NULL),(NULL),(NULL),(NULL)) `tvc_0`) where `test`.`t1`.`i` = `tvc_0`.`NULL`
0 commit comments