EXIST2IN in any place of the query (MDEV-4236)

[MDEV-4246] Assertion `!exists_transformed || null_value == (0)' fails with exists_to_in=on, LEFT JOIN, NOT EXISTS Created: 2013-03-05  Updated: 2015-11-17

Status: Open
Project: MariaDB Server
Component/s: None
Affects Version/s: N/A
Fix Version/s: None

Type: Technical task Priority: Major
Reporter: Elena Stepanova Assignee: Oleksandr Byelkin
Resolution: Unresolved Votes: 0
Labels: None

Issue Links:
Relates
relates to MDEV-4236 EXIST2IN in any place of the query Open

 Description   

mysqld: 10.0-base-exists2in-select/sql/item_subselect.cc:1663: virtual bool Item_in_subselect::val_bool(): Assertion `!exists_transformed || null_value == (0)' failed.
[ERROR] mysqld got signal 6 ;

#6  0x00007f86308030ee in __assert_fail_base (fmt=<optimized out>, assertion=0xe35a38 "!exists_transformed || null_value == (0)", file=0xe35488 "10.0-base-exists2in-select/sql/item_subselect.cc", line=<optimized out>, function=<optimized out>) at assert.c:94
#7  0x00007f8630803192 in __GI___assert_fail (assertion=0xe35a38 "!exists_transformed || null_value == (0)", file=0xe35488 "10.0-base-exists2in-select/sql/item_subselect.cc", line=1663, function=0xe37980 "virtual bool Item_in_subselect::val_bool()") at assert.c:103
#8  0x000000000087b2ee in Item_in_subselect::val_bool (this=0x7f8614025910) at 10.0-base-exists2in-select/sql/item_subselect.cc:1663
#9  0x0000000000578d45 in Item::val_bool_result (this=0x7f8614025910) at 10.0-base-exists2in-select/sql/item.h:969
#10 0x000000000081696b in Item_in_optimizer::val_int (this=0x7f8614024d20) at 10.0-base-exists2in-select/sql/item_cmpfunc.cc:1765
#11 0x0000000000578cb9 in Item::val_int_result (this=0x7f8614024d20) at 10.0-base-exists2in-select/sql/item.h:965
#12 0x000000000080870d in Item_cache_int::cache_value (this=0x7f8614031da0) at 10.0-base-exists2in-select/sql/item.cc:8735
#13 0x000000000080f768 in Item_cache_wrapper::cache (this=0x7f8614031cb0) at 10.0-base-exists2in-select/sql/item.cc:7541
#14 0x00000000008058eb in Item_cache_wrapper::val_bool (this=0x7f8614031cb0) at 10.0-base-exists2in-select/sql/item.cc:7705
#15 0x000000000082071d in Item_cond_and::val_int (this=0x7f8614026500) at 10.0-base-exists2in-select/sql/item_cmpfunc.cc:4677
#16 0x00000000007f10ad in Item::val_bool (this=0x7f8614026500) at 10.0-base-exists2in-select/sql/item.cc:215
#17 0x0000000000812589 in Item_func_not::val_int (this=0x7f8614021ba0) at 10.0-base-exists2in-select/sql/item_cmpfunc.cc:335
#18 0x0000000000682629 in Item_func_trig_cond::val_int (this=0x7f8614029040) at 10.0-base-exists2in-select/sql/item_cmpfunc.h:490
#19 0x00000000007f10ad in Item::val_bool (this=0x7f8614029040) at 10.0-base-exists2in-select/sql/item.cc:215
#20 0x000000000082071d in Item_cond_and::val_int (this=0x7f8614029240) at 10.0-base-exists2in-select/sql/item_cmpfunc.cc:4677
#21 0x00000000006d91c0 in SQL_SELECT::skip_record (this=0x7f8614028e10, thd=0x3a28528) at 10.0-base-exists2in-select/sql/opt_range.h:1013
#22 0x000000000075e272 in JOIN_CACHE::check_match (this=0x7f8614029410, rec_ptr=0x7f8614042369 "\001\371\001") at 10.0-base-exists2in-select/sql/sql_join_cache.cc:2476
#23 0x0000000000759edd in JOIN_CACHE::generate_full_extensions (this=0x7f8614029410, rec_ptr=0x7f8614042369 "\001\371\001") at 10.0-base-exists2in-select/sql/sql_join_cache.cc:2389
#24 0x000000000075a272 in JOIN_CACHE::join_null_complements (this=0x7f8614029410, skip_last=false) at 10.0-base-exists2in-select/sql/sql_join_cache.cc:2544
#25 0x0000000000759870 in JOIN_CACHE::join_records (this=0x7f8614029410, skip_last=false) at 10.0-base-exists2in-select/sql/sql_join_cache.cc:2120
#26 0x000000000066db90 in sub_select_cache (join=0x7f86140233f0, join_tab=0x7f8614028658, end_of_records=true) at 10.0-base-exists2in-select/sql/sql_select.cc:16118
#27 0x000000000066dd47 in sub_select (join=0x7f86140233f0, join_tab=0x7f8614028330, end_of_records=true) at 10.0-base-exists2in-select/sql/sql_select.cc:16280
#28 0x000000000066d87d in do_select (join=0x7f86140233f0, fields=0x3a2b318, table=0x0, procedure=0x0) at 10.0-base-exists2in-select/sql/sql_select.cc:15999
#29 0x000000000064db9a in JOIN::exec_inner (this=0x7f86140233f0) at 10.0-base-exists2in-select/sql/sql_select.cc:2995
#30 0x000000000064ae29 in JOIN::exec (this=0x7f86140233f0) at 10.0-base-exists2in-select/sql/sql_select.cc:2287
#31 0x000000000064e451 in mysql_select (thd=0x3a28528, rref_pointer_array=0x3a2b4b0, tables=0x7f861403d540, wild_num=1, fields=..., conds=0x7f8614021ba0, og_num=0, order=0x0, group=0x0, having=0x0, proc_param=0x0, select_options=2147748608, result=0x7f86140233a0, unit=0x3a2ab08, select_lex=0x3a2b200) at 10.0-base-exists2in-select/sql/sql_select.cc:3223
#32 0x0000000000644ac7 in handle_select (thd=0x3a28528, lex=0x3a2aa50, result=0x7f86140233a0, setup_tables_done_option=0) at 10.0-base-exists2in-select/sql/sql_select.cc:368
#33 0x000000000061bf1f in execute_sqlcom_select (thd=0x3a28528, all_tables=0x7f861403d540) at 10.0-base-exists2in-select/sql/sql_parse.cc:4787
#34 0x0000000000614583 in mysql_execute_command (thd=0x3a28528) at 10.0-base-exists2in-select/sql/sql_parse.cc:2258
#35 0x000000000061e7a6 in mysql_parse (thd=0x3a28528, rawbuf=0x7f861403c7e0 "SELECT * FROM t1 LEFT JOIN t2 ON (c2 = c1) WHERE NOT EXISTS ( SELECT 1 FROM t1 WHERE i1 = i2 AND c1 = c2)", length=105, parser_state=0x7f862d99d4f0) at 10.0-base-exists2in-select/sql/sql_parse.cc:5903
#36 0x00000000006118cd in dispatch_command (command=COM_QUERY, thd=0x3a28528, packet=0x3a2d4f9 "", packet_length=105) at 10.0-base-exists2in-select/sql/sql_parse.cc:1083
#37 0x0000000000610b12 in do_command (thd=0x3a28528) at 10.0-base-exists2in-select/sql/sql_parse.cc:809
#38 0x000000000072635c in do_handle_one_connection (thd_arg=0x3a28528) at 10.0-base-exists2in-select/sql/sql_connect.cc:1266
#39 0x0000000000725d47 in handle_one_connection (arg=0x3a28528) at 10.0-base-exists2in-select/sql/sql_connect.cc:1181
#40 0x0000000000cccc02 in pfs_spawn_thread (arg=0x39bec48) at 10.0-base-exists2in-select/storage/perfschema/pfs.cc:1015
#41 0x00007f86315d3e9a in start_thread (arg=0x7f862d99e700) at pthread_create.c:308
#42 0x00007f86308c7cbd in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:112
#43 0x0000000000000000 in ?? ()

revision-id: sanja@montyprogram.com-20130304113805-tghzwrsr96nz167i
revno: 3501
branch-nick: 10.0-base-exists2in-select

Test case:

SET optimizer_switch='exists_to_in=on';
 
CREATE TABLE t1 (i1 INT, c1 CHAR(1)) ENGINE=MyISAM;
INSERT INTO t1 VALUES (1,'v'),(7,'s');
 
CREATE TABLE t2 (i2 INT, c2 CHAR(1)) ENGINE=MyISAM;
INSERT INTO t2 VALUES (8,'b'),(9,'a');
 
SELECT * FROM t1 LEFT JOIN t2 ON (c2 = c1) WHERE NOT EXISTS ( SELECT 1 FROM t1 WHERE i1 = i2 AND c1 = c2 );


Generated at Thu Feb 08 06:54:56 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.