Uploaded image for project: 'MariaDB Server'
  1. MariaDB Server
  2. MDEV-5284

Assertion `!(*expr)->fixed' fails in replace_where_subcondition with IN suquery

    XMLWordPrintable

Details

    • Bug
    • Status: Closed (View Workflow)
    • Critical
    • Resolution: Fixed
    • None
    • 5.5.35, 5.3.13
    • None
    • None

    Description

      The problem was introduced in 5.3 tree with the following revision and later merged into 5.5:

      revno: 3716
      revision-id: sanja@askmonty.org-20131111152814-nwnnc4upr0xs78jm
      timestamp: Mon 2013-11-11 17:28:14 +0200
      message:
        MDEV-5153: Server crashes in Item_ref::fix_fields on 2nd execution of PS with LEFT JOIN and MERGE view or SELECT SQ
        
        1. Transformation of row IN subquery made the same as single value.
        2. replace_where_subcondition() made working on several layers of OR/AND because it called on expression before fix_fields().

      mysqld: opt_subselect.cc:1296: bool replace_where_subcondition(JOIN*, Item**, Item*, Item*, bool): Assertion `!(*expr)->fixed' failed.
      131112 19:25:07 [ERROR] mysqld got signal 6 ;

      #7  0x00007fbfbeca8192 in __GI___assert_fail (assertion=0xd565d0 "!(*expr)->fixed", file=0xd563b9 "opt_subselect.cc", line=1296, function=0xd571c0 "bool replace_where_subcondition(JOIN*, Item**, Item*, Item*, bool)") at assert.c:103
      #8  0x00000000007f5516 in replace_where_subcondition (join=0x7fbfa4032d90, expr=0x7fbfa4033178, old_cond=0x7fbfa401ab98, new_cond=0x7fbfa4034248, do_fix_fields=false) at opt_subselect.cc:1296
      #9  0x00000000007f4e65 in convert_join_subqueries_to_semijoins (join=0x7fbfa4032d90) at opt_subselect.cc:1123
      #10 0x0000000000709378 in JOIN::optimize (this=0x7fbfa4032d90) at sql_select.cc:951
      #11 0x0000000000710b1d in mysql_select (thd=0x1d868c8, rref_pointer_array=0x1d895b8, tables=0x7fbfa4019198, wild_num=1, fields=..., conds=0x7fbfa401ad80, og_num=0, order=0x0, group=0x0, having=0x0, proc_param=0x0, select_options=2147764736, result=0x7fbfa4032d70, unit=0x1d88e58, select_lex=0x1d89360) at sql_select.cc:2995
      #12 0x0000000000707495 in handle_select (thd=0x1d868c8, lex=0x1d88db8, result=0x7fbfa4032d70, setup_tables_done_option=0) at sql_select.cc:288
      #13 0x000000000069365a in execute_sqlcom_select (thd=0x1d868c8, all_tables=0x7fbfa4019198) at sql_parse.cc:5172
      #14 0x000000000068a422 in mysql_execute_command (thd=0x1d868c8) at sql_parse.cc:2305
      #15 0x00000000006960e4 in mysql_parse (thd=0x1d868c8, rawbuf=0x7fbfa4018f40 "SELECT * FROM t1 WHERE ( i < 200 OR i = 300 ) AND i IN ( SELECT i FROM t1 )", length=75, found_semicolon=0x7fbfbdb2b7e0) at sql_parse.cc:6173
      #16 0x0000000000687b3f in dispatch_command (command=COM_QUERY, thd=0x1d868c8, packet=0x1e00b29 "SELECT * FROM t1 WHERE ( i < 200 OR i = 300 ) AND i IN ( SELECT i FROM t1 )", packet_length=75) at sql_parse.cc:1243
      #17 0x0000000000686db0 in do_command (thd=0x1d868c8) at sql_parse.cc:923
      #18 0x0000000000683c4a in handle_one_connection (arg=0x1d868c8) at sql_connect.cc:1231
      #19 0x00007fbfbf843e9a in start_thread (arg=0x7fbfbdb2c700) at pthread_create.c:308
      #20 0x00007fbfbed6ccbd in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:112

      The stack trace is from the revision above.

      CREATE TABLE t1 (i INT) ENGINE=MyISAM;
      INSERT INTO t1 VALUES (1),(2);
      SELECT * FROM t1 WHERE ( i < 200 OR i = 300 ) AND i IN ( SELECT i FROM t1 );

      Attachments

        Activity

          People

            serg Sergei Golubchik
            elenst Elena Stepanova
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Git Integration

                Error rendering 'com.xiplink.jira.git.jira_git_plugin:git-issue-webpanel'. Please contact your Jira administrators.