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

Assertion `ctx.compare_type_handler()->cmp_type() != STRING_RESULT' failed

Details

    • Bug
    • Status: Closed (View Workflow)
    • Major
    • Resolution: Fixed
    • 10.4(EOL)
    • 10.4.0
    • Optimizer
    • None

    Description

      CREATE TABLE t1 (id int NOT NULL AUTO_INCREMENT PRIMARY KEY );
      CREATE TABLE t2 (id int  zerofill);
       
      SELECT 1 FROM t2 WHERE t2.id IN (SELECT MIN(t1.id) from t1);
      

      Thread 1 (Thread 0x7f4a3db70700 (LWP 7881)):
      #0  __pthread_kill (threadid=<optimized out>, signo=6) at ../sysdeps/unix/sysv/linux/pthread_kill.c:62
      #1  0x00005570b2582761 in my_write_core (sig=6) at /home/alice/git/10.4/mysys/stacktrace.c:481
      #2  0x00005570b1dc50d1 in handle_fatal_signal (sig=6) at /home/alice/git/10.4/sql/signal_handler.cc:305
      #3  <signal handler called>
      #4  0x00007f4a4372c428 in __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:54
      #5  0x00007f4a4372e02a in __GI_abort () at abort.c:89
      #6  0x00007f4a43724bd7 in __assert_fail_base (fmt=<optimized out>, assertion=assertion@entry=0x5570b27a8ad0 "ctx.compare_type_handler()->cmp_type() != STRING_RESULT", file=file@entry=0x5570b27a8958 "/home/alice/git/10.4/sql/field.cc", line=line@entry=1417, function=function@entry=0x5570b27a9da0 <Field_num::get_equal_zerofill_const_item(THD*, Value_source::Context const&, Item*)::__PRETTY_FUNCTION__> "Item* Field_num::get_equal_zerofill_const_item(THD*, const Value_source::Context&, Item*)") at assert.c:92
      #7  0x00007f4a43724c82 in __GI___assert_fail (assertion=0x5570b27a8ad0 "ctx.compare_type_handler()->cmp_type() != STRING_RESULT", file=0x5570b27a8958 "/home/alice/git/10.4/sql/field.cc", line=1417, function=0x5570b27a9da0 <Field_num::get_equal_zerofill_const_item(THD*, Value_source::Context const&, Item*)::__PRETTY_FUNCTION__> "Item* Field_num::get_equal_zerofill_const_item(THD*, const Value_source::Context&, Item*)") at assert.c:101
      #8  0x00005570b1d8f972 in Field_num::get_equal_zerofill_const_item (this=0x7f49f4035898, thd=0x7f49f4000b00, ctx=..., const_item=0x7f49f4019898) at /home/alice/git/10.4/sql/field.cc:1417
      #9  0x00005570b1db4cff in Field_num::get_equal_const_item (this=0x7f49f4035898, thd=0x7f49f4000b00, ctx=..., const_item=0x7f49f4019898) at /home/alice/git/10.4/sql/field.h:1674
      #10 0x00005570b1b3b83c in check_simple_equality (thd=0x7f49f4000b00, ctx=..., left_item=0x7f49f4015ae8, right_item=0x7f49f4019898, cond_equal=0x7f4a3db6e540) at /home/alice/git/10.4/sql/sql_select.cc:13682
      #11 0x00005570b1c95cde in and_new_conditions_to_optimized_cond (thd=0x7f49f4000b00, cond=0x0, cond_eq=0x7f49f4018028, new_conds=..., cond_value=0x7f49f4017f00) at /home/alice/git/10.4/sql/opt_subselect.cc:5493
      #12 0x00005570b1b19e46 in JOIN::optimize_inner (this=0x7f49f4017bf0) at /home/alice/git/10.4/sql/sql_select.cc:1708
      #13 0x00005570b1b18f33 in JOIN::optimize (this=0x7f49f4017bf0) at /home/alice/git/10.4/sql/sql_select.cc:1448
      #14 0x00005570b1b22e43 in mysql_select (thd=0x7f49f4000b00, tables=0x7f49f4015478, wild_num=0, fields=..., conds=0x7f49f40170f0, og_num=0, order=0x0, group=0x0, having=0x0, proc_param=0x0, select_options=2147748608, result=0x7f49f4017bd0, unit=0x7f49f40049a8, select_lex=0x7f49f4014f68) at /home/alice/git/10.4/sql/sql_select.cc:4261
      #15 0x00005570b1b149d6 in handle_select (thd=0x7f49f4000b00, lex=0x7f49f40048e0, result=0x7f49f4017bd0, setup_tables_done_option=0) at /home/alice/git/10.4/sql/sql_select.cc:382
      #16 0x00005570b1adf315 in execute_sqlcom_select (thd=0x7f49f4000b00, all_tables=0x7f49f4015478) at /home/alice/git/10.4/sql/sql_parse.cc:6545
      #17 0x00005570b1ad576e in mysql_execute_command (thd=0x7f49f4000b00) at /home/alice/git/10.4/sql/sql_parse.cc:3768
      #18 0x00005570b1ae304d in mysql_parse (thd=0x7f49f4000b00, rawbuf=0x7f49f4014e88 "SELECT 1 FROM t2 WHERE t2.id IN (SELECT MIN(t1.id) from t1)", length=59, parser_state=0x7f4a3db6f5f0, is_com_multi=false, is_next_command=false) at /home/alice/git/10.4/sql/sql_parse.cc:8063
      #19 0x00005570b1ad01d0 in dispatch_command (command=COM_QUERY, thd=0x7f49f4000b00, packet=0x7f49f412e0d1 "SELECT 1 FROM t2 WHERE t2.id IN (SELECT MIN(t1.id) from t1)", packet_length=59, is_com_multi=false, is_next_command=false) at /home/alice/git/10.4/sql/sql_parse.cc:1847
      #20 0x00005570b1acebed in do_command (thd=0x7f49f4000b00) at /home/alice/git/10.4/sql/sql_parse.cc:1392
      #21 0x00005570b1c35613 in do_handle_one_connection (connect=0x5570b4b5fe30) at /home/alice/git/10.4/sql/sql_connect.cc:1402
      #22 0x00005570b1c35364 in handle_one_connection (arg=0x5570b4b5fe30) at /home/alice/git/10.4/sql/sql_connect.cc:1308
      #23 0x00005570b2512baa in pfs_spawn_thread (arg=0x5570b4b67f20) at /home/alice/git/10.4/storage/perfschema/pfs.cc:1862
      #24 0x00007f4a443696ba in start_thread (arg=0x7f4a3db70700) at pthread_create.c:333
      #25 0x00007f4a437fe41d in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:109
      
      

      Attachments

        Activity

          The bug appears in DBUG_ASSERT(ctx.compare_type_handler()->cmp_type() != STRING_RESULT); call in Field_num::get_equal_zerofill_const_item() method.

          (gdb) print ctx.compare_type_handler()->cmp_type()
          $2 = STRING_RESULT
          

          This means that cmp_type() should already be defined on this step. Field "t2.`id`" wasn't fixed and fix_fields() call is missing.

          "t2.`id`" is a part of "t2.`id` = NULL" condition that was created in execute_degenerate_jtbm_semi_join() method. This method was created in MDEV-12387 as a result of refactoring of setup_jtbm_semi_joins() method.

          Comparing versions before and after MDEV-12387 changes it can be seen that fix_fields() call for the case when degenerated semi join is defined is missing. This call should be made just after the creation of equalities.

          shagalla Galina Shalygina (Inactive) added a comment - The bug appears in DBUG_ASSERT(ctx.compare_type_handler()->cmp_type() != STRING_RESULT); call in Field_num::get_equal_zerofill_const_item() method. (gdb) print ctx.compare_type_handler()->cmp_type() $2 = STRING_RESULT This means that cmp_type() should already be defined on this step. Field "t2.`id`" wasn't fixed and fix_fields() call is missing. "t2.`id`" is a part of "t2.`id` = NULL" condition that was created in execute_degenerate_jtbm_semi_join() method. This method was created in MDEV-12387 as a result of refactoring of setup_jtbm_semi_joins() method. Comparing versions before and after MDEV-12387 changes it can be seen that fix_fields() call for the case when degenerated semi join is defined is missing. This call should be made just after the creation of equalities.

          Ok to push.

          igor Igor Babaev (Inactive) added a comment - Ok to push.

          Pushed in 10.4

          shagalla Galina Shalygina (Inactive) added a comment - Pushed in 10.4

          People

            shagalla Galina Shalygina (Inactive)
            alice Alice Sherepa
            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.