[MDEV-6874] Server crashes in subselect_union_engine::no_rows on query with UNION ALL in WHERE Created: 2014-10-15  Updated: 2014-10-20  Resolved: 2014-10-20

Status: Closed
Project: MariaDB Server
Component/s: Optimizer
Affects Version/s: N/A
Fix Version/s: 10.1.2

Type: Bug Priority: Major
Reporter: Elena Stepanova Assignee: Igor Babaev
Resolution: Fixed Votes: 0
Labels: None

Issue Links:
Relates
relates to MDEV-334 [backport] Implement UNION ALL withou... Closed

 Description   

Test case

CREATE TABLE t1 (a INT, b INT);
INSERT INTO t1 VALUES (1,1),(2,8);
 
SELECT * FROM t1 t1_1 LEFT JOIN t1 t1_2 ON ( t1_2.b = t1_1.a )
WHERE t1_2.b NOT IN ( SELECT 4 UNION ALL SELECT 5 );

Stack trace from rev 7aed441963823191e94da3df069e123dc8794eee

#3  <signal handler called>
#4  0x00007fc03d0c3ab9 in subselect_union_engine::no_rows (this=0x7fc031100fe0) at 10.1/sql/item_subselect.cc:3398
#5  0x00007fc03d0546f5 in Item_in_optimizer::val_int (this=0x7fc03120bdb8) at 10.1/sql/item_cmpfunc.cc:1774
#6  0x00007fc03cd4f8ad in Item::val_int_result (this=0x7fc03120bdb8) at 10.1/sql/item.h:1062
#7  0x00007fc03d0459dd in Item_cache_int::cache_value (this=0x7fc03105ab58) at 10.1/sql/item.cc:9018
#8  0x00007fc03d04d33c in Item_cache_wrapper::cache (this=0x7fc03105aaa0) at 10.1/sql/item.cc:7819
#9  0x00007fc03d042b9d in Item_cache_wrapper::val_bool (this=0x7fc03105aaa0) at 10.1/sql/item.cc:7983
#10 0x00007fc03d05017c in Item_func_not::val_int (this=0x7fc03120afd0) at 10.1/sql/item_cmpfunc.cc:335
#11 0x00007fc03ce770e9 in Item_func_trig_cond::val_int (this=0x7fc031187f28) at 10.1/sql/item_cmpfunc.h:492
#12 0x00007fc03d02d4df in Item::val_bool (this=0x7fc031187f28) at 10.1/sql/item.cc:214
#13 0x00007fc03d05e802 in Item_cond_and::val_int (this=0x7fc031059ef0) at 10.1/sql/item_cmpfunc.cc:4748
#14 0x00007fc03ced539e in SQL_SELECT::skip_record (this=0x7fc031059c28, thd=0x7fc034726070) at 10.1/sql/opt_range.h:1007
#15 0x00007fc03cf67c2a in JOIN_CACHE::check_match (this=0x7fc03105a000, rec_ptr=0x7fc03128f07c "\001\371\002") at 10.1/sql/sql_join_cache.cc:2486
#16 0x00007fc03cf637a7 in JOIN_CACHE::generate_full_extensions (this=0x7fc03105a000, rec_ptr=0x7fc03128f07c "\001\371\002") at 10.1/sql/sql_join_cache.cc:2397
#17 0x00007fc03cf63b37 in JOIN_CACHE::join_null_complements (this=0x7fc03105a000, skip_last=false) at 10.1/sql/sql_join_cache.cc:2554
#18 0x00007fc03cf6310e in JOIN_CACHE::join_records (this=0x7fc03105a000, skip_last=false) at 10.1/sql/sql_join_cache.cc:2126
#19 0x00007fc03ce614e1 in sub_select_cache (join=0x7fc03120b120, join_tab=0x7fc031059578, end_of_records=true) at 10.1/sql/sql_select.cc:17419
#20 0x00007fc03ce616e2 in sub_select (join=0x7fc03120b120, join_tab=0x7fc031059238, end_of_records=true) at 10.1/sql/sql_select.cc:17589
#21 0x00007fc03ce611b9 in do_select (join=0x7fc03120b120, fields=0x7fc03472a590, table=0x0, procedure=0x0) at 10.1/sql/sql_select.cc:17297
#22 0x00007fc03ce3cc9b in JOIN::exec_inner (this=0x7fc03120b120) at 10.1/sql/sql_select.cc:3087
#23 0x00007fc03ce39f1a in JOIN::exec (this=0x7fc03120b120) at 10.1/sql/sql_select.cc:2389
#24 0x00007fc03ce3d52e in mysql_select (thd=0x7fc034726070, rref_pointer_array=0x7fc03472a6f0, tables=0x7fc0310ff340, wild_num=1, fields=..., conds=0x7fc03120afd0, og_num=0, order=0x0, group=0x0, having=0x0, proc_param=0x0, select_options=2147748608, result=0x7fc031101028, unit=0x7fc034729d90, select_lex=0x7fc03472a478) at 10.1/sql/sql_select.cc:3313
#25 0x00007fc03ce334f6 in handle_select (thd=0x7fc034726070, lex=0x7fc034729cc8, result=0x7fc031101028, setup_tables_done_option=0) at 10.1/sql/sql_select.cc:372
#26 0x00007fc03ce054b5 in execute_sqlcom_select (thd=0x7fc034726070, all_tables=0x7fc0310ff340) at 10.1/sql/sql_parse.cc:5665
#27 0x00007fc03cdfbc22 in mysql_execute_command (thd=0x7fc034726070) at 10.1/sql/sql_parse.cc:2804
#28 0x00007fc03ce085ff in mysql_parse (thd=0x7fc034726070, rawbuf=0x7fc0310ff088 "SELECT * FROM t1 t1_1 LEFT JOIN t1 t1_2 ON ( t1_2.b = t1_1.a )\nWHERE t1_2.b NOT IN ( SELECT 4 UNION ALL SELECT 5 )", length=114, parser_state=0x7fc03c8d21c0) at 10.1/sql/sql_parse.cc:6935
#29 0x00007fc03cdf88a0 in dispatch_command (command=COM_QUERY, thd=0x7fc034726070, packet=0x7fc0357f6071 "", packet_length=114) at 10.1/sql/sql_parse.cc:1468
#30 0x00007fc03cdf76be in do_command (thd=0x7fc034726070) at 10.1/sql/sql_parse.cc:1097
#31 0x00007fc03cf23846 in do_handle_one_connection (thd_arg=0x7fc034726070) at 10.1/sql/sql_connect.cc:1351
#32 0x00007fc03cf2358b in handle_one_connection (arg=0x7fc034726070) at 10.1/sql/sql_connect.cc:1262
#33 0x00007fc03d4aedfe in pfs_spawn_thread (arg=0x7fc039c24770) at 10.1/storage/perfschema/pfs.cc:1860
#34 0x00007fc03c508b50 in start_thread (arg=<optimized out>) at pthread_create.c:304
#35 0x00007fc03a59f20d in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:112



 Comments   
Comment by Igor Babaev [ 2014-10-20 ]

Two patches that fix the bug were pushed into the 10.1 tree.

Generated at Thu Feb 08 07:15:14 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.