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

LP:718593 - Crash in substitute_for_best_equal_field -> eliminate_item_equal -> Item_field::find_item_equal -> Item_equal::contains

    XMLWordPrintable

Details

    • Bug
    • Status: Closed (View Workflow)
    • Major
    • Resolution: Fixed
    • None
    • None
    • None

    Description

      Not repeatable in Maria-5.3, though maria-5.3 suffers from a similar crash - bug 601124 . EXPLAIN also crashes.

      backtrace:

      #5 0x0820d246 in Item_equal::contains (this=0xae6675d8, field=0xae644090) at item_cmpfunc.cc:5618
      #6 0x081caeca in Item_field::find_item_equal (this=0xae632da8, cond_equal=0xae66684c) at item.cc:4663
      #7 0x0831bd86 in eliminate_item_equal (cond=0xae633070, upper_levels=0xae66684c, item_equal=0xae666c48) at sql_select.cc:9696
      #8 0x0831c1fc in substitute_for_best_equal_field (cond=0xae633070, cond_equal=0xae63310c, table_join_idx=0xae667130) at sql_select.cc:9847
      #9 0x0831c181 in substitute_for_best_equal_field (cond=0xae633130, cond_equal=0xae667b1c, table_join_idx=0xae667130) at sql_select.cc:9833
      #10 0x0831c181 in substitute_for_best_equal_field (cond=0xae667a80, cond_equal=0xae667b1c, table_join_idx=0xae667130) at sql_select.cc:9833
      #11 0x083068c2 in JOIN::optimize (this=0xae661470) at sql_select.cc:1026
      #12 0x081aecc0 in st_select_lex::optimize_unflattened_subqueries (this=0xb3735d0) at sql_lex.cc:3140
      #13 0x083c336b in JOIN::optimize_unflattened_subqueries (this=0xae65c5d8) at opt_subselect.cc:3617
      #14 0x08307b44 in JOIN::optimize (this=0xae65c5d8) at sql_select.cc:1414
      #15 0x0830bb0c in mysql_select (thd=0xb371c38, rref_pointer_array=0xb3736d4, tables=0xae631bb8, wild_num=1, fields=..., conds=0xae6331e0, og_num=0,
      order=0x0, group=0x0, having=0x0, proc_param=0x0, select_options=2147764736, result=0xae633380, unit=0xb373334, select_lex=0xb3735d0)
      at sql_select.cc:2653
      #16 0x083045ed in handle_select (thd=0xb371c38, lex=0xb3732d8, result=0xae633380, setup_tables_done_option=0) at sql_select.cc:283
      #17 0x082a20ac in execute_sqlcom_select (thd=0xb371c38, all_tables=0xae631bb8) at sql_parse.cc:5070
      #18 0x082990bb in mysql_execute_command (thd=0xb371c38) at sql_parse.cc:2234
      #19 0x082a4644 in mysql_parse (thd=0xb371c38,
      rawbuf=0xae631948 "SELECT * FROM t2\nWHERE ( f12 ) IN (\nSELECT alias2.f3\nFROM t1 AS alias1 JOIN t1 AS alias2 ON alias2.f10 = alias1.f11\nWHERE alias1.f11 OR alias1.f3 = 50 AND alias1.f10\n)", length=168, found_semicolon=0xae9e1228) at sql_parse.cc:6077
      #20 0x08296d53 in dispatch_command (command=COM_QUERY, thd=0xb371c38,
      packet=0xb389d69 "SELECT * FROM t2\nWHERE ( f12 ) IN (\nSELECT alias2.f3\nFROM t1 AS alias1 JOIN t1 AS alias2 ON alias2.f10 = alias1.f11\nWHERE alias1.f11 OR alias1.f3 = 50 AND alias1.f10\n)", packet_length=168) at sql_parse.cc:1210
      #21 0x08296200 in do_command (thd=0xb371c38) at sql_parse.cc:903
      #22 0x082932de in handle_one_connection (arg=0xb371c38) at sql_connect.cc:1154
      #23 0x00821919 in start_thread () from /lib/libpthread.so.0
      #24 0x0076acce in clone () from /lib/libc.so.6

      test case:

      SET SESSION optimizer_switch = 'semijoin=off';

      CREATE TABLE t1 ( f3 int(11), f10 varchar(1), f11 varchar(1)) ;
      INSERT IGNORE INTO t1 VALUES (6,'f','f'),(2,'d','d');

      CREATE TABLE t2 ( f12 int(11), f13 int(11)) ;

      SELECT * FROM t2
      WHERE ( f12 ) IN (
      SELECT alias2.f3
      FROM t1 AS alias1 JOIN t1 AS alias2 ON alias2.f10 = alias1.f11
      WHERE alias1.f11 OR alias1.f3 = 50 AND alias1.f10
      );

      Attachments

        Activity

          People

            timour Timour Katchaounov (Inactive)
            philipstoev Philip Stoev (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 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.