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

Assertion `length > 0' failed in create_ref_for_key

    Details

    • Type: Bug
    • Status: Closed (View Workflow)
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 5.5, 10.0, 10.1, 10.2
    • Fix Version/s: 5.5.60
    • Component/s: Optimizer
    • Labels:
      None

      Description

      CREATE TABLE t1 (i INT);
      INSERT INTO t1 VALUES (1),(2); # Optional
      CREATE TABLE t2 (f CHAR(1));
      INSERT INTO t2 VALUES ('a'),('b'); # Optional
      SELECT * FROM t2 WHERE f IN ( SELECT LEFT('foo',0) FROM t1 ORDER BY 1 );
       
      # Cleanup
      DROP TABLE t1, t2;
      

      5.5 7a63ffab7164

      mysqld: /data/src/5.5/sql/sql_select.cc:8172: bool create_ref_for_key(JOIN*, JOIN_TAB*, KEYUSE*, bool, table_map): Assertion `length > 0' failed.
      180207 15:53:34 [ERROR] mysqld got signal 6 ;
       
      #7  0x00007f5434c70ee2 in __assert_fail () from /lib/x86_64-linux-gnu/libc.so.6
      #8  0x000000000064494f in create_ref_for_key (join=0x7f542f980078, j=0x7f542f941fe0, org_keyuse=0x7f542f890660, allow_full_scan=true, used_tables=4611686018427387907) at /data/src/5.5/sql/sql_select.cc:8172
      #9  0x0000000000643f2c in get_best_combination (join=0x7f542f980078) at /data/src/5.5/sql/sql_select.cc:7928
      #10 0x000000000063a2e5 in make_join_statistics (join=0x7f542f980078, tables_list=..., conds=0x7f542f998ea8, keyuse_array=0x7f542f9803a0) at /data/src/5.5/sql/sql_select.cc:3856
      #11 0x0000000000630fb4 in JOIN::optimize (this=0x7f542f980078) at /data/src/5.5/sql/sql_select.cc:1247
      #12 0x000000000063795f in mysql_select (thd=0x7f5430a64060, rref_pointer_array=0x7f5430a67d08, tables=0x7f542f9482c8, wild_num=1, fields=..., conds=0x7f542f949d98, og_num=0, order=0x0, group=0x0, having=0x0, proc_param=0x0, select_options=2147748608, result=0x7f542f94a030, unit=0x7f5430a67388, select_lex=0x7f5430a67a68) at /data/src/5.5/sql/sql_select.cc:3104
      #13 0x000000000062e19c in handle_select (thd=0x7f5430a64060, lex=0x7f5430a672d8, result=0x7f542f94a030, setup_tables_done_option=0) at /data/src/5.5/sql/sql_select.cc:323
      #14 0x0000000000607632 in execute_sqlcom_select (thd=0x7f5430a64060, all_tables=0x7f542f9482c8) at /data/src/5.5/sql/sql_parse.cc:4678
      #15 0x00000000006009b3 in mysql_execute_command (thd=0x7f5430a64060) at /data/src/5.5/sql/sql_parse.cc:2224
      #16 0x000000000060a1fe in mysql_parse (thd=0x7f5430a64060, rawbuf=0x7f542f948078 "SELECT * FROM t2 WHERE f IN ( SELECT LEFT('foo',0) FROM t1 ORDER BY 1 )", length=71, parser_state=0x7f54366e4640) at /data/src/5.5/sql/sql_parse.cc:5923
      #17 0x00000000005fdf13 in dispatch_command (command=COM_QUERY, thd=0x7f5430a64060, packet=0x7f543475b061 "SELECT * FROM t2 WHERE f IN ( SELECT LEFT('foo',0) FROM t1 ORDER BY 1 )", packet_length=71) at /data/src/5.5/sql/sql_parse.cc:1066
      #18 0x00000000005fd105 in do_command (thd=0x7f5430a64060) at /data/src/5.5/sql/sql_parse.cc:793
      #19 0x0000000000700235 in do_handle_one_connection (thd_arg=0x7f5430a64060) at /data/src/5.5/sql/sql_connect.cc:1268
      #20 0x00000000006fffc2 in handle_one_connection (arg=0x7f5430a64060) at /data/src/5.5/sql/sql_connect.cc:1184
      #21 0x0000000000a0e01b in pfs_spawn_thread (arg=0x7f5431776fc0) at /data/src/5.5/storage/perfschema/pfs.cc:1015
      #22 0x00007f5436317494 in start_thread (arg=0x7f54366e5700) at pthread_create.c:333
      #23 0x00007f5434d2d93f in clone () from /lib/x86_64-linux-gnu/libc.so.6
      

      No visible effect on a non-debug build.
      Also reproducible on 10.3.

        Attachments

          Activity

            People

            • Assignee:
              varun Varun Gupta
              Reporter:
              elenst Elena Stepanova
            • Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: