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

Types mismatch when cloning items causes debug assertion

    XMLWordPrintable

Details

    Description

      CREATE VIEW t AS SELECT 1 AS a;
      SELECT * FROM t WHERE a=b'';
      

      Leads to:

      10.5.27 f41a120298aa17ca80eecaa68614a6addf91ebc6 (Debug)

      mariadbd: /test/10.5_dbg/sql/item.h:1677: Item* Item::get_copy(THD*) const: Assertion `typeid(*copy) == typeid(*this)' failed.
      

      10.5.27 f41a120298aa17ca80eecaa68614a6addf91ebc6 (Debug)

      Core was generated by `/test/MD160824-mariadb-10.5.27-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 0x14c6043c2700 (LWP 2295405))]
      (gdb) bt
      #0  __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:50
      #1  0x000014c607814859 in __GI_abort () at abort.c:79
      #2  0x000014c607814729 in __assert_fail_base (fmt=0x14c6079aa588 "%s%s%s:%u: %s%sAssertion `%s' failed.\n%n", assertion=0x557f28ab96d0 "typeid(*copy) == typeid(*this)", file=0x557f28ab9308 "/test/10.5_dbg/sql/item.h", line=1677, function=<optimized out>) at assert.c:92
      #3  0x000014c607825fd6 in __GI___assert_fail (assertion=assertion@entry=0x557f28ab96d0 "typeid(*copy) == typeid(*this)", file=file@entry=0x557f28ab9308 "/test/10.5_dbg/sql/item.h", line=line@entry=1677, function=function@entry=0x557f28ab96a8 "Item* Item::get_copy(THD*) const") at assert.c:101
      #4  0x0000557f280b0c94 in Item::get_copy (thd=<optimized out>, this=0x14c5b8013d18) at /test/10.5_dbg/sql/item.h:1677
      #5  Item_hex_hybrid::do_build_clone (this=0x14c5b8013d18, thd=<optimized out>) at /test/10.5_dbg/sql/item.h:4900
      #6  0x0000557f280915ba in Item::build_clone (thd=0x14c5b8000d48, this=0x14c5b8013d18) at /test/10.5_dbg/sql/item.h:1691
      #7  Item_func_or_sum::do_build_clone (this=0x14c5b8013db8, thd=0x14c5b8000d48) at /test/10.5_dbg/sql/item.cc:2731
      #8  0x0000557f280bdbef in Item_bool_rowready_func2::do_build_clone (thd=<optimized out>, this=<optimized out>) at /test/10.5_dbg/sql/item_cmpfunc.h:584
      #9  Item_func_eq::do_build_clone (this=<optimized out>, thd=<optimized out>) at /test/10.5_dbg/sql/item_cmpfunc.cc:1823
      #10 0x0000557f280a139a in Item::build_clone (thd=0x14c5b8000d48, this=0x14c5b8013db8) at /test/10.5_dbg/sql/item.h:1691
      #11 Item::build_pushable_cond (this=this@entry=0x14c5b8013db8, thd=thd@entry=0x14c5b8000d48, checker=<optimized out>, arg=0x14c5b801d5f0 "\001") at /test/10.5_dbg/sql/item.cc:7798
      #12 0x0000557f27d4e7c9 in pushdown_cond_for_derived (thd=0x14c5b8000d48, cond=0x14c5b8013db8, derived=derived@entry=0x14c5b80134b0) at /test/10.5_dbg/sql/sql_derived.cc:1526
      #13 0x0000557f27e1f434 in JOIN::optimize_inner (this=this@entry=0x14c5b8017948) at /test/10.5_dbg/sql/sql_select.cc:2229
      #14 0x0000557f27e1ff3d in JOIN::optimize (this=this@entry=0x14c5b8017948) at /test/10.5_dbg/sql/sql_select.cc:1765
      #15 0x0000557f27e20015 in mysql_select (thd=thd@entry=0x14c5b8000d48, tables=0x14c5b80134b0, fields=@0x14c5b8012fc0: {<base_list> = {<Sql_alloc> = {<No data fields>}, first = 0x14c5b8013468, last = 0x14c5b8013468, elements = 1}, <No data fields>}, conds=0x14c5b8013db8, og_num=0, order=0x0, group=0x0, having=0x0, proc_param=0x0, select_options=2147748608, result=0x14c5b8017920, unit=0x14c5b8004ef8, select_lex=0x14c5b8012e58) at /test/10.5_dbg/sql/sql_select.cc:4900
      #16 0x0000557f27e20b6b in handle_select (thd=thd@entry=0x14c5b8000d48, lex=lex@entry=0x14c5b8004e30, result=result@entry=0x14c5b8017920, setup_tables_done_option=setup_tables_done_option@entry=0) at /test/10.5_dbg/sql/sql_select.cc:449
      #17 0x0000557f27d98fce in execute_sqlcom_select (thd=thd@entry=0x14c5b8000d48, all_tables=0x14c5b80134b0) at /test/10.5_dbg/sql/sql_parse.cc:6431
      #18 0x0000557f27da6044 in mysql_execute_command (thd=thd@entry=0x14c5b8000d48) at /test/10.5_dbg/sql/sql_parse.cc:4030
      #19 0x0000557f27d9230a in mysql_parse (thd=thd@entry=0x14c5b8000d48, rawbuf=<optimized out>, length=<optimized out>, parser_state=parser_state@entry=0x14c6043c12c0, 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:8229
      #20 0x0000557f27da104f in dispatch_command (command=command@entry=COM_QUERY, thd=thd@entry=0x14c5b8000d48, packet=packet@entry=0x14c5b800aa19 "SELECT * FROM t WHERE a=b''", packet_length=packet_length@entry=27, 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
      #21 0x0000557f27da3d88 in do_command (thd=0x14c5b8000d48) at /test/10.5_dbg/sql/sql_parse.cc:1376
      #22 0x0000557f27ef0d06 in do_handle_one_connection (connect=<optimized out>, connect@entry=0x557f2ada7808, put_in_cache=put_in_cache@entry=true) at /test/10.5_dbg/sql/sql_connect.cc:1417
      #23 0x0000557f27ef13a4 in handle_one_connection (arg=arg@entry=0x557f2ada7808) at /test/10.5_dbg/sql/sql_connect.cc:1319
      #24 0x0000557f28371733 in pfs_spawn_thread (arg=0x557f2a261778) at /test/10.5_dbg/storage/perfschema/pfs.cc:2201
      #25 0x000014c607d25609 in start_thread (arg=<optimized out>) at pthread_create.c:477
      #26 0x000014c607911133 in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95
      

      Bug confirmed present in:
      MariaDB: 10.5.27 (dbg), 10.6.19 (dbg), 10.11.9 (dbg), 11.6.0 (dbg)

      Bug (or feature/syntax) confirmed not present in:
      MariaDB: 10.5.27 (opt), 10.6.19 (opt), 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), 11.6.0 (opt)

      Attachments

        Issue Links

          Activity

            People

              sanja Oleksandr Byelkin
              ramesh Ramesh Sivaraman
              Votes:
              0 Vote for this issue
              Watchers:
              4 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.