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

Types mismatch when cloning items causes debug assertion

    XMLWordPrintable

Details

    Description

      CREATE TABLE t1 (c YEAR);
      CREATE TABLE t2 (c INT);
      SELECT * FROM t1 JOIN t2 ON t1.c=t2.c WHERE t1.c<=>5;
      

      Leads to:

      10.5.26 9dafde575f0f91a25d0357c060c311a098c1a737 (Debug)

      mariadbd: /test/10.5_dbg/sql/item.h:1712: Item* Item::clone_const_item(THD*) const: Assertion `typeid(*clone) == typeid(*this)' failed.
      

      10.5.26 9dafde575f0f91a25d0357c060c311a098c1a737 (Debug)

      Core was generated by `/test/MD180724-mariadb-10.5.26-linux-x86_64-dbg/bin/mariadbd --no-defaults --ma'.
      Program terminated with signal SIGABRT, Aborted.
      #0  __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:50
      [Current thread is 1 (Thread 0x14858862c700 (LWP 2626091))]
      (gdb) bt
      #0  __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:50
      #1  0x000014859dd29859 in __GI_abort () at abort.c:79
      #2  0x000014859dd29729 in __assert_fail_base (fmt=0x14859debf588 "%s%s%s:%u: %s%sAssertion `%s' failed.\n%n", assertion=0x563c12438b48 "typeid(*clone) == typeid(*this)", file=0x563c12423308 "/test/10.5_dbg/sql/item.h", line=1712, function=<optimized out>) at assert.c:92
      #3  0x000014859dd3afd6 in __GI___assert_fail (assertion=assertion@entry=0x563c12438b48 "typeid(*clone) == typeid(*this)", file=file@entry=0x563c12423308 "/test/10.5_dbg/sql/item.h", line=line@entry=1712, function=function@entry=0x563c1244a158 "Item* Item::clone_const_item(THD*) const") at assert.c:101
      #4  0x0000563c11741e08 in Item::clone_const_item (thd=0x148534000d48, this=0x148534016950) at /test/10.5_dbg/sql/item.h:1712
      #5  change_cond_ref_to_const (thd=thd@entry=0x148534000d48, save_list=save_list@entry=0x14858862a5b0, and_father=0x148534016a00, cond=0x148534014648, field_value_owner=field_value_owner@entry=0x148534015220, field=field@entry=0x148534015040, value=0x148534016950) at /test/10.5_dbg/sql/sql_select.cc:16665
      #6  0x0000563c11741c39 in change_cond_ref_to_const (thd=thd@entry=0x148534000d48, save_list=save_list@entry=0x14858862a5b0, and_father=and_father@entry=0x148534016a00, cond=cond@entry=0x148534016a00, field_value_owner=field_value_owner@entry=0x148534015220, field=0x148534015040, value=0x148534016950) at /test/10.5_dbg/sql/sql_select.cc:16619
      #7  0x0000563c1174225f in propagate_cond_constants (thd=thd@entry=0x148534000d48, save_list=save_list@entry=0x14858862a5b0, and_father=0x148534016a00, cond=<optimized out>) at /test/10.5_dbg/sql/sql_select.cc:16736
      #8  0x0000563c117422cc in propagate_cond_constants (thd=thd@entry=0x148534000d48, save_list=save_list@entry=0x0, and_father=and_father@entry=0x148534016a00, cond=cond@entry=0x148534016a00) at /test/10.5_dbg/sql/sql_select.cc:16703
      #9  0x0000563c11742627 in optimize_cond (join=join@entry=0x148534015e38, conds=0x148534016a00, join_list=0x148534013068, ignore_on_conds=ignore_on_conds@entry=false, cond_value=cond_value@entry=0x148534016158, cond_equal=cond_equal@entry=0x148534016280, flags=1) at /test/10.5_dbg/sql/sql_select.cc:17575
      #10 0x0000563c1178a11f in JOIN::optimize_inner (this=this@entry=0x148534015e38) at /test/10.5_dbg/sql/sql_select.cc:2140
      #11 0x0000563c1178af77 in JOIN::optimize (this=this@entry=0x148534015e38) at /test/10.5_dbg/sql/sql_select.cc:1765
      #12 0x0000563c1178b04f in mysql_select (thd=thd@entry=0x148534000d48, tables=0x1485340134e0, fields=@0x148534012ff0: {<base_list> = {<Sql_alloc> = {<No data fields>}, first = 0x148534013498, last = 0x148534016808, elements = 2}, <No data fields>}, conds=0x148534015220, og_num=0, order=0x0, group=0x0, having=0x0, proc_param=0x0, select_options=2147748608, result=0x148534015e10, unit=0x148534004ef8, select_lex=0x148534012e88) at /test/10.5_dbg/sql/sql_select.cc:4897
      #13 0x0000563c1178bba5 in handle_select (thd=thd@entry=0x148534000d48, lex=lex@entry=0x148534004e30, result=result@entry=0x148534015e10, setup_tables_done_option=setup_tables_done_option@entry=0) at /test/10.5_dbg/sql/sql_select.cc:449
      #14 0x0000563c11703f44 in execute_sqlcom_select (thd=thd@entry=0x148534000d48, all_tables=0x1485340134e0) at /test/10.5_dbg/sql/sql_parse.cc:6425
      #15 0x0000563c11710fba in mysql_execute_command (thd=thd@entry=0x148534000d48) at /test/10.5_dbg/sql/sql_parse.cc:4030
      #16 0x0000563c116fd280 in mysql_parse (thd=thd@entry=0x148534000d48, rawbuf=<optimized out>, length=<optimized out>, parser_state=parser_state@entry=0x14858862b2c0, 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:8223
      #17 0x0000563c1170bfc5 in dispatch_command (command=command@entry=COM_QUERY, thd=thd@entry=0x148534000d48, packet=packet@entry=0x14853400aa19 "SELECT * FROM t1 JOIN t2 ON t1.c=t2.c WHERE t1.c<=>5", packet_length=packet_length@entry=52, is_com_multi=is_com_multi@entry=false, is_next_command=is_next_command@entry=false) at /test/10.5_dbg/sql/sql_class.h:1329
      #18 0x0000563c1170ecfe in do_command (thd=0x148534000d48) at /test/10.5_dbg/sql/sql_parse.cc:1376
      #19 0x0000563c1185bd26 in do_handle_one_connection (connect=<optimized out>, connect@entry=0x563c151a95f8, put_in_cache=put_in_cache@entry=true) at /test/10.5_dbg/sql/sql_connect.cc:1417
      #20 0x0000563c1185c3c4 in handle_one_connection (arg=arg@entry=0x563c151a95f8) at /test/10.5_dbg/sql/sql_connect.cc:1319
      #21 0x0000563c11cdbe57 in pfs_spawn_thread (arg=0x563c146ad668) at /test/10.5_dbg/storage/perfschema/pfs.cc:2201
      #22 0x000014859e23a609 in start_thread (arg=<optimized out>) at pthread_create.c:477
      #23 0x000014859de26133 in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95
      

      Bug confirmed present in:
      MariaDB: 10.5.26 (dbg), 10.6.19 (dbg)

      Bug (or feature/syntax) confirmed not present in:
      MariaDB: 10.5.26 (opt), 10.6.19 (opt), 10.11.9 (dbg), 10.11.9 (opt), 11.1.6 (dbg), 11.1.6 (opt), 11.2.5 (dbg), 11.2.5 (opt), 11.4.3 (dbg), 11.4.3 (opt), 11.5.2 (dbg), 11.5.2 (opt)

      Attachments

        Issue Links

          Activity

            People

              oleg.smirnov Oleg Smirnov
              ramesh Ramesh Sivaraman
              Votes:
              0 Vote for this issue
              Watchers:
              7 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.