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

Assertion `!result' failed in convert_const_to_int on SELECT NULL and using subquery

    XMLWordPrintable

Details

    • Bug
    • Status: Confirmed (View Workflow)
    • Major
    • Resolution: Unresolved
    • 10.1(EOL), 10.2(EOL), 10.3(EOL), 10.4(EOL), 10.5, 10.6, 10.7(EOL), 10.8(EOL), 10.9(EOL), 10.10(EOL), 10.11, 11.0(EOL), 11.1(EOL), 11.2(EOL), 11.4, 11.6(EOL), 11.7
    • 10.5, 10.6, 10.11, 11.4
    • None

    Description

      SET SESSION STORAGE_ENGINE = 'memory';
      CREATE TABLE t1 (col1 BIGINT DEFAULT -1);
      SELECT NULL IN (SELECT * FROM t1);
      

      Leads to:

      10.5.6 5f2728d594bf0202afebeff2323324df79b50425 (Debug)

      mysqld: /test/10.5_dbg/sql/item_cmpfunc.cc:371: bool convert_const_to_int(THD*, Item_field*, Item**): Assertion `!result' failed.
      

      10.5.6 5f2728d594bf0202afebeff2323324df79b50425 (Debug)

      Core was generated by `/test/MD110920-mariadb-10.5.6-linux-x86_64-dbg/bin/mysqld --no-defaults --core-'.
      Program terminated with signal SIGABRT, Aborted.
      #0  __pthread_kill (threadid=<optimized out>, signo=signo@entry=6)
          at ../sysdeps/unix/sysv/linux/pthread_kill.c:57
      [Current thread is 1 (Thread 0x14e0c4267700 (LWP 3071330))]
      (gdb) bt
      #0  __pthread_kill (threadid=<optimized out>, signo=signo@entry=6) at ../sysdeps/unix/sysv/linux/pthread_kill.c:57
      #1  0x000055e5b66c285a in my_write_core (sig=sig@entry=6) at /test/10.5_dbg/mysys/stacktrace.c:424
      #2  0x000055e5b5e893a9 in handle_fatal_signal (sig=6) at /test/10.5_dbg/sql/signal_handler.cc:330
      #3  <signal handler called>
      #4  __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:51
      #5  0x000014e0c24fd8b1 in __GI_abort () at abort.c:79
      #6  0x000014e0c24ed42a in __assert_fail_base (fmt=0x14e0c2674a38 "%s%s%s:%u: %s%sAssertion `%s' failed.\n%n", assertion=assertion@entry=0x55e5b69e14f9 "!result", file=f
      ile@entry=0x55e5b69e1788 "/test/10.5_dbg/sql/item_cmpfunc.cc", line=line@entry=371, function=function@entry=0x55e5b69e4e40 <convert_const_to_int(THD*, Item_field*, Item
      **)::__PRETTY_FUNCTION__> "bool convert_const_to_int(THD*, Item_field*, Item**)") at assert.c:92
      #7  0x000014e0c24ed4a2 in __GI___assert_fail (assertion=assertion@entry=0x55e5b69e14f9 "!result", file=file@entry=0x55e5b69e1788 "/test/10.5_dbg/sql/item_cmpfunc.cc", l
      ine=line@entry=371, function=function@entry=0x55e5b69e4e40 <convert_const_to_int(THD*, Item_field*, Item**)::__PRETTY_FUNCTION__> "bool convert_const_to_int(THD*, Item_
      field*, Item**)") at assert.c:101
      #8  0x000055e5b5edc1a9 in convert_const_to_int (thd=thd@entry=0x14e09f815088, field_item=field_item@entry=0x14e09f877360, item=0x14e09f878540) at /test/10.5_dbg/sql/ite
      m_cmpfunc.cc:371
      #9  0x000055e5b5edcf45 in Item_func::convert_const_compared_to_int_field (this=this@entry=0x14e09f8784a8, thd=thd@entry=0x14e09f815088) at /test/10.5_dbg/sql/item_cmpfu
      nc.cc:402
      #10 0x000055e5b5edd0f4 in Item_func::setup_args_and_comparator (this=this@entry=0x14e09f8784a8, thd=0x14e09f815088, cmp=cmp@entry=0x14e09f878578) at /test/10.5_dbg/sql/
      item_cmpfunc.cc:422
      #11 0x000055e5b5edd2ad in Item_bool_rowready_func2::fix_length_and_dec (this=0x14e09f8784a8) at /test/10.5_dbg/sql/item_cmpfunc.cc:455
      #12 0x000055e5b5f0c218 in Item_func::fix_fields (this=0x14e09f8784a8, thd=0x14e09f815088, ref=<optimized out>) at /test/10.5_dbg/sql/item_func.cc:370
      #13 0x000055e5b5edba41 in Item::fix_fields_if_needed (ref=0x14e09f878a70, thd=0x14e09f815088, this=0x14e09f8784a8) at /test/10.5_dbg/sql/item.h:982
      #14 Item::fix_fields_if_needed_for_scalar (ref=0x14e09f878a70, thd=0x14e09f815088, this=0x14e09f8784a8) at /test/10.5_dbg/sql/item.h:986
      #15 Item::fix_fields_if_needed_for_bool (ref=<optimized out>, thd=0x14e09f815088, this=0x14e09f8784a8) at /test/10.5_dbg/sql/item.h:990
      #16 Item_cond::fix_fields (this=0x14e09f878970, thd=0x14e09f815088, ref=<optimized out>) at /test/10.5_dbg/sql/item_cmpfunc.cc:4899
      #17 0x000055e5b5f0c121 in Item::fix_fields_if_needed (ref=0x14e09f878b20, thd=0x14e09f815088, this=0x14e09f878970) at /test/10.5_dbg/sql/item.h:982
      #18 Item_func::fix_fields (this=0x14e09f878a88, thd=0x14e09f815088, ref=<optimized out>) at /test/10.5_dbg/sql/item_func.cc:352
      #19 0x000055e5b5f85bb7 in Item::fix_fields_if_needed (ref=0x0, thd=0x14e09f815088, this=0x14e09f878a88) at /test/10.5_dbg/sql/item.h:982
      #20 Item_in_subselect::create_single_in_to_exists_cond (this=this@entry=0x14e09f875b38, join=join@entry=0x14e09f876dd8, where_item=where_item@entry=0x14e09f8772e0, having_item=having_item@entry=0x14e09f8772e8) at /test/10.5_dbg/sql/item_subselect.cc:2279
      #21 0x000055e5b5f88649 in Item_in_subselect::create_in_to_exists_cond (this=this@entry=0x14e09f875b38, join_arg=join_arg@entry=0x14e09f876dd8) at /test/10.5_dbg/sql/item_subselect.cc:2658
      #22 0x000055e5b5d8d716 in JOIN::choose_subquery_plan (this=this@entry=0x14e09f876dd8, join_tables=0) at /test/10.5_dbg/sql/opt_subselect.cc:6423
      #23 0x000055e5b5c54f02 in make_join_statistics (keyuse_array=0x14e09f8770c8, tables_list=<optimized out>, join=0x14e09f876dd8) at /test/10.5_dbg/sql/sql_select.cc:5589
      #24 JOIN::optimize_inner (this=this@entry=0x14e09f876dd8) at /test/10.5_dbg/sql/sql_select.cc:2247
      #25 0x000055e5b5c553b3 in JOIN::optimize (this=this@entry=0x14e09f876dd8) at /test/10.5_dbg/sql/sql_select.cc:1623
      #26 0x000055e5b5baddd2 in st_select_lex::optimize_unflattened_subqueries (this=0x14e09f874148, const_only=const_only@entry=true) at /test/10.5_dbg/sql/sql_lex.cc:4813
      #27 0x000055e5b5d8b68f in JOIN::optimize_constant_subqueries (this=this@entry=0x14e09f876788) at /test/10.5_dbg/sql/opt_subselect.cc:5590
      #28 0x000055e5b5c51752 in JOIN::optimize_inner (this=this@entry=0x14e09f876788) at /test/10.5_dbg/sql/sql_select.cc:1926
      #29 0x000055e5b5c553b3 in JOIN::optimize (this=this@entry=0x14e09f876788) at /test/10.5_dbg/sql/sql_select.cc:1623
      #30 0x000055e5b5c55d40 in mysql_select (thd=thd@entry=0x14e09f815088, tables=<optimized out>, fields=@0x14e09f874298: {<base_list> = {<Sql_alloc> = {<No data fields>}, first = 0x14e09f875db8, last = 0x14e09f875db8, elements = 1}, <No data fields>}, conds=0x0, og_num=0, order=<optimized out>, group=0x0, having=0x0, proc_param=0x0, select_options=2147748608, result=0x14e09f876760, unit=0x14e09f819220, select_lex=0x14e09f874148) at /test/10.5_dbg/sql/sql_select.cc:4649
      #31 0x000055e5b5c560bc in handle_select (thd=thd@entry=0x14e09f815088, lex=lex@entry=0x14e09f819158, result=result@entry=0x14e09f876760, setup_tables_done_option=setup_tables_done_option@entry=0) at /test/10.5_dbg/sql/sql_select.cc:417
      #32 0x000055e5b5bdd348 in execute_sqlcom_select (thd=thd@entry=0x14e09f815088, all_tables=0x14e09f874c40) at /test/10.5_dbg/sql/sql_parse.cc:6210
      #33 0x000055e5b5bd641c in mysql_execute_command (thd=thd@entry=0x14e09f815088) at /test/10.5_dbg/sql/sql_parse.cc:3932
      #34 0x000055e5b5be3324 in mysql_parse (thd=thd@entry=0x14e09f815088, rawbuf=<optimized out>, length=<optimized out>, parser_state=parser_state@entry=0x14e0c4266350, is_com_multi=is_com_multi@entry=false, is_next_command=is_next_command@entry=false) at /test/10.5_dbg/sql/sql_parse.cc:7994
      #35 0x000055e5b5bcfd54 in dispatch_command (command=command@entry=COM_QUERY, thd=thd@entry=0x14e09f815088, packet=packet@entry=0x14e09f867089 "SELECT NULL IN (SELECT * FROM t1)", packet_length=packet_length@entry=33, is_com_multi=is_com_multi@entry=false, is_next_command=is_next_command@entry=false) at /test/10.5_dbg/sql/sql_parse.cc:1867
      #36 0x000055e5b5bce53e in do_command (thd=0x14e09f815088) at /test/10.5_dbg/sql/sql_parse.cc:1348
      #37 0x000055e5b5d2d893 in do_handle_one_connection (connect=<optimized out>, connect@entry=0x14e0a30d4808, put_in_cache=put_in_cache@entry=true) at /test/10.5_dbg/sql/sql_connect.cc:1410
      #38 0x000055e5b5d2dfb7 in handle_one_connection (arg=arg@entry=0x14e0a30d4808) at /test/10.5_dbg/sql/sql_connect.cc:1312
      #39 0x000055e5b61985c2 in pfs_spawn_thread (arg=0x14e0c1046508) at /test/10.5_dbg/storage/perfschema/pfs.cc:2201
      #40 0x000014e0c31e06db in start_thread (arg=0x14e0c4267700) at pthread_create.c:463
      #41 0x000014e0c25dea3f in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95
      

      Bug confirmed present in:
      MariaDB: 10.1.47 (dbg), 10.2.34 (dbg), 10.3.25 (dbg), 10.4.15 (dbg), 10.5.6 (dbg)

      Bug confirmed not present in:
      MariaDB: 10.1.47 (opt), 10.2.34 (opt), 10.3.25 (opt), 10.4.15 (opt), 10.5.6 (opt), 10.6.0 (dbg), 10.6.0 (opt)

      Attachments

        Issue Links

          Activity

            People

              psergei Sergei Petrunia
              stepan.patryshev Stepan Patryshev (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              6 Start watching this issue

              Dates

                Created:
                Updated:

                Git Integration

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