Ordered_key::cmp_key_with_search_key(rownum_t): Assertion `!compare_pred[i]->null_value' failed with subquery on both sides of NOT IN and materialization
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
MariaDB |
Fix Released
|
Low
|
Timour Katchaounov |
Bug Description
Repeatable with maria-5.3 and maria-5.3-mwl89. A crash happens when there is a subquery on both sides of a NOT IN statement. It appears that the right-side table must have at least 100 rows for the crash to occur.
backtrace:
mysqld: item_subselect.
#8 0x006b0d98 in __assert_fail () from /lib/libc.so.6
#9 0x0823f8fd in Ordered_
#10 0x0823f9e0 in Ordered_key::lookup (this=0xae675bb8) at item_subselect.
#11 0x08240bdd in subselect_
#12 0x0823fefc in subselect_
#13 0x08236995 in Item_subselect:
#14 0x08236b8e in Item_in_
#15 0x082369c4 in Item_subselect:
#16 0x08236b8e in Item_in_
#17 0x0823850d in Item_in_
#18 0x081d659c in Item::val_
#19 0x08201f4d in Item_in_
#20 0x081d653e in Item::val_
#21 0x081d2262 in Item_cache_
#22 0x081da1e2 in Item_cache_
#23 0x081cffe1 in Item_cache_
#24 0x081fe1f7 in Item_func_
#25 0x0832475a in evaluate_
#26 0x083243c5 in sub_select (join=0xae665260, join_tab=
#27 0x08323747 in do_select (join=0xae665260, fields=0xae81624, table=0x0, procedure=0x0) at sql_select.cc:13363
#28 0x0830a3cb in JOIN::exec (this=0xae665260) at sql_select.cc:2435
#29 0x0830ab99 in mysql_select (thd=0xae7fbf8, rref_pointer_
order=0x0, group=0x0, having=0x0, proc_param=0x0, select_
at sql_select.cc:2652
#30 0x08303441 in handle_select (thd=0xae7fbf8, lex=0xae81298, result=0xae62ef28, setup_tables_
#31 0x082a0f54 in execute_
#32 0x08297f63 in mysql_execute_
#33 0x082a34ec in mysql_parse (thd=0xae7fbf8, rawbuf=0xae62da10 "SELECT *\nFROM t2\nWHERE ( SELECT f1 FROM t4 ) NOT IN ( SELECT f1 FROM t1 )", length=73,
found_
#34 0x08295bfb in dispatch_command (command=COM_QUERY, thd=0xae7fbf8, packet=0xae99d31 "", packet_length=74) at sql_parse.cc:1210
#35 0x082950a8 in do_command (thd=0xae7fbf8) at sql_parse.cc:903
#36 0x08292186 in handle_
#37 0x00821919 in start_thread () from /lib/libpthread
#38 0x0076acce in clone () from /lib/libc.so.6
test case:
CREATE TABLE t1 ( f1 int(11)) ;
INSERT IGNORE INTO t1 VALUES (1),(2)
CREATE TABLE t2 ( f11 varchar(1) );
INSERT IGNORE INTO t2 VALUES (f),(d);
CREATE TABLE t4 ( f1 int(11)) ;
set session optimizer_
SELECT *
FROM t2
WHERE ( SELECT f1 FROM t4 ) NOT IN ( SELECT f1 FROM t1 ) ;
Changed in maria: | |
status: | New → Confirmed |
importance: | Undecided → Low |
summary: |
Ordered_key::cmp_key_with_search_key(rownum_t): Assertion `!compare_pred[i]->null_value' failed with subquery on both sides of NOT - IN + IN and materialization |
Changed in maria: | |
status: | Confirmed → In Progress |
Changed in maria: | |
status: | In Progress → Fix Committed |
Changed in maria: | |
status: | Fix Committed → Fix Released |
This bug was not detected previously since subselects on the left side of the IN statement were only introduced recently.