[MDEV-5366] Assertion `!do_fix_fields || !(*expr)->fixed' fails in replace_where_subcondition with semijoin=on, IN subquery, merge view or select sq Created: 2013-11-30  Updated: 2014-01-14  Resolved: 2014-01-14

Status: Closed
Project: MariaDB Server
Component/s: None
Affects Version/s: 10.0.6
Fix Version/s: 10.0.7

Type: Bug Priority: Major
Reporter: Elena Stepanova Assignee: Sergei Petrunia
Resolution: Fixed Votes: 0
Labels: None

Issue Links:
Relates

 Description   

There was a similar bug MDEV-5284, but it's fixed and the fix is merged into 10.0, while the test case below still fails (only on 10.0 for me).

sql/opt_subselect.cc:1314: bool replace_where_subcondition(JOIN*, Item**, Item*, Item*, bool): Assertion `!do_fix_fields || !(*expr)->fixed' failed.
131130 19:36:26 [ERROR] mysqld got signal 6 ;

#6  0x00007f7e1c575621 in *__GI___assert_fail (assertion=0x1015188 "!do_fix_fields || !(*expr)->fixed", file=<optimized out>, line=1314, function=0x10163a0 "bool replace_where_subcondition(JOIN*, Item**, Item*, Item*, bool)") at assert.c:81
#7  0x00000000007bf55a in replace_where_subcondition (join=0x7f7e13b4e808, expr=0x7f7e139d5920, old_cond=0x7f7e13b4e098, new_cond=0x7f7e13941978, do_fix_fields=true) at /home/elenst/bzr/10.0/sql/opt_subselect.cc:1314
#8  0x00000000007bf04e in convert_join_subqueries_to_semijoins (join=0x7f7e13b4e808) at /home/elenst/bzr/10.0/sql/opt_subselect.cc:1175
#9  0x0000000000697306 in JOIN::optimize_inner (this=0x7f7e13b4e808) at /home/elenst/bzr/10.0/sql/sql_select.cc:1106
#10 0x0000000000696ebc in JOIN::optimize (this=0x7f7e13b4e808) at /home/elenst/bzr/10.0/sql/sql_select.cc:1012
#11 0x000000000069ea95 in mysql_select (thd=0x7f7e16735070, rref_pointer_array=0x7f7e16739688, tables=0x7f7e139d52c0, wild_num=1, fields=..., conds=0x0, og_num=0, order=0x0, group=0x0, having=0x0, proc_param=0x0, select_options=2147748608, result=0x7f7e13b4e7e8, unit=0x7f7e16738d38, select_lex=0x7f7e16739418) at /home/elenst/bzr/10.0/sql/sql_select.cc:3278
#12 0x0000000000695213 in handle_select (thd=0x7f7e16735070, lex=0x7f7e16738c78, result=0x7f7e13b4e7e8, setup_tables_done_option=0) at /home/elenst/bzr/10.0/sql/sql_select.cc:371
#13 0x000000000066a6e8 in execute_sqlcom_select (thd=0x7f7e16735070, all_tables=0x7f7e139d52c0) at /home/elenst/bzr/10.0/sql/sql_parse.cc:5221
#14 0x0000000000662ba8 in mysql_execute_command (thd=0x7f7e16735070) at /home/elenst/bzr/10.0/sql/sql_parse.cc:2552
#15 0x000000000066ce68 in mysql_parse (thd=0x7f7e16735070, rawbuf=0x7f7e139d5088 "SELECT * FROM t1 INNER JOIN v1 ON ( v1.a = t1.a OR v1.b > 0 )", length=61, parser_state=0x7f7e1deeb630) at /home/elenst/bzr/10.0/sql/sql_parse.cc:6365
#16 0x000000000065fdaa in dispatch_command (command=COM_QUERY, thd=0x7f7e16735070, packet=0x7f7e14848071 "SELECT * FROM t1 INNER JOIN v1 ON ( v1.a = t1.a OR v1.b > 0 )", packet_length=61) at /home/elenst/bzr/10.0/sql/sql_parse.cc:1296
#17 0x000000000065f14c in do_command (thd=0x7f7e16735070) at /home/elenst/bzr/10.0/sql/sql_parse.cc:993
#18 0x0000000000776f7d in do_handle_one_connection (thd_arg=0x7f7e16735070) at /home/elenst/bzr/10.0/sql/sql_connect.cc:1379
#19 0x0000000000776cd0 in handle_one_connection (arg=0x7f7e16735070) at /home/elenst/bzr/10.0/sql/sql_connect.cc:1293
#20 0x0000000000a859e1 in pfs_spawn_thread (arg=0x7f7e16ffb8f0) at /home/elenst/bzr/10.0/storage/perfschema/pfs.cc:1853
#21 0x00007f7e1dad5b50 in start_thread (arg=<optimized out>) at pthread_create.c:304
#22 0x00007f7e1c624a7d in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:112

revision-id: bar@mnogosearch.org-20131126065321-vcuhvtfjs7d09xpl
revno: 3911
branch-nick: 10.0

SET optimizer_switch='semijoin=on';
 
CREATE TABLE t1 (a INT, b INT) ENGINE=MyISAM;
INSERT INTO t1 VALUES (1,2),(3,4);
 
CREATE VIEW v1 AS SELECT * FROM t1 WHERE a IN ( SELECT b FROM t1 );
 
SELECT * FROM t1 INNER JOIN v1 ON ( v1.a = t1.a OR v1.b > 0 );

Also fails with a subquery instead of a view (in this case derived_merge=on is also neede).



 Comments   
Comment by Elena Stepanova [ 2014-01-14 ]

The assertion on the provided test case disappeared with the following revision:

revno: 3950 [merge]
revision-id: sergii@pisem.net-20131216122835-kvnj9gruo9pid956
committer: Sergei Golubchik <sergii@pisem.net>
branch nick: 10.0
timestamp: Mon 2013-12-16 13:28:35 +0100
message:
merge

If there is still one on a different test case, it will be filed separately.

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