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

Assertion `0' failed in Item_type_holder::val_str on utf16 charset table query

    XMLWordPrintable

    Details

      Description

      USE test;
      CREATE TABLE t1 (a TEXT CHARACTER SET utf16);
      SELECT * FROM (VALUES (1) UNION SELECT * FROM t1) AS t;
      

      Leads to:

      10.5.3 98003440c2f8d20164a191ced1b7d92b283bb68f

      mysqld: /test/10.5_dbg/sql/item.cc:10378: virtual String* Item_type_holder::val_str(String*): Assertion `0' failed.
      

      10.5.3 98003440c2f8d20164a191ced1b7d92b283bb68f

      Core was generated by `/test/MD210420-mariadb-10.5.3-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 0x7ff27aa9a700 (LWP 784401))]
      (gdb) bt
      #0  __pthread_kill (threadid=<optimized out>, signo=signo@entry=6) at ../sysdeps/unix/sysv/linux/pthread_kill.c:57
      #1  0x0000555b708ec03d in my_write_core (sig=sig@entry=6) at /test/10.5_dbg/mysys/stacktrace.c:518
      #2  0x0000555b70091d7b in handle_fatal_signal (sig=6) at /test/10.5_dbg/sql/signal_handler.cc:329
      #3  <signal handler called>
      #4  __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:51
      #5  0x00007ff2791de801 in __GI_abort () at abort.c:79
      #6  0x00007ff2791ce39a in __assert_fail_base (fmt=0x7ff2793557d8 "%s%s%s:%u: %s%sAssertion `%s' failed.\n%n", assertion=assertion@entry=0x555b70c1cd21 "0", file=file@entry=0x555b70bfdb0e "/test/10.5_dbg/sql/item.cc", line=line@entry=10378, function=function@entry=0x555b70bfa8c0 <Item_type_holder::val_str(String*)::__PRETTY_FUNCTION__> "virtual String* Item_type_holder::val_str(String*)") at assert.c:92
      #7  0x00007ff2791ce412 in __GI___assert_fail (assertion=assertion@entry=0x555b70c1cd21 "0", file=file@entry=0x555b70bfdb0e "/test/10.5_dbg/sql/item.cc", line=line@entry=10378, function=function@entry=0x555b70bfa8c0 <Item_type_holder::val_str(String*)::__PRETTY_FUNCTION__> "virtual String* Item_type_holder::val_str(String*)") at assert.c:101
      #8  0x0000555b700b2aa0 in Item_type_holder::val_str (this=<optimized out>) at /test/10.5_dbg/sql/item.cc:10378
      #9  0x0000555b700d4c9f in Item_func_conv_charset::Item_func_conv_charset (this=0x7ff24d0786f8, thd=<optimized out>, a=0x7ff24d077e70, cs=0x555b715f5f40 <my_charset_utf16_general_ci>, cache_if_const=<optimized out>) at /test/10.5_dbg/sql/item_strfunc.h:1423
      #10 0x0000555b700ba085 in Item::safe_charset_converter (this=0x7ff24d077e70, thd=0x7ff24d015088, tocs=0x555b715f5f40 <my_charset_utf16_general_ci>) at /test/10.5_dbg/sql/item.cc:1189
      #11 0x0000555b700beb77 in Type_std_attributes::agg_item_set_converter (this=this@entry=0x7ff24d0786a0, coll=..., fname=fname@entry=0x555b70a5d64e "UNION", args=args@entry=0x7ff24d0786c8, nargs=nargs@entry=2, flags=flags@entry=11, item_sep=1) at /test/10.5_dbg/sql/item.cc:2515
      #12 0x0000555b6ffcad4d in Type_std_attributes::agg_arg_charsets (item_sep=1, flags=11, nitems=2, items=0x7ff24d0786c8, func_name=0x555b70a5d64e "UNION", c=..., this=0x7ff24d0786a0) at /test/10.5_dbg/sql/sql_type.h:3034
      #13 Type_std_attributes::agg_arg_charsets_for_string_result (item_sep=1, nitems=2, items=0x7ff24d0786c8, func_name=0x555b70a5d64e "UNION", c=..., this=0x7ff24d0786a0) at /test/10.5_dbg/sql/sql_type.h:3048
      #14 Type_std_attributes::aggregate_attributes_string (this=this@entry=0x7ff24d0786a0, func_name=0x555b70a5d64e "UNION", items=0x7ff24d0786c8, nitems=nitems@entry=2) at /test/10.5_dbg/sql/sql_type.cc:1248
      #15 0x0000555b6ffcb017 in Type_handler_blob_common::Item_hybrid_func_fix_attributes (this=<optimized out>, thd=<optimized out>, func_name=<optimized out>, handler=0x7ff24d0786e0, func=0x7ff24d078698, items=<optimized out>, nitems=2) at /test/10.5_dbg/sql/sql_type.cc:4539
      #16 0x0000555b6fed012b in Type_holder::aggregate_attributes (thd=0x7ff24d015088, this=0x7ff24d078698) at /test/10.5_dbg/sql/sql_class.h:7266
      #17 st_select_lex_unit::join_union_type_attributes (this=this@entry=0x7ff24d074cd0, thd_arg=thd_arg@entry=0x7ff24d015088, holders=holders@entry=0x7ff24d078698, count=count@entry=2) at /test/10.5_dbg/sql/sql_union.cc:1202
      #18 0x0000555b6fed02dc in st_select_lex_unit::join_union_item_types (this=this@entry=0x7ff24d074cd0, thd_arg=0x7ff24d015088, types=..., count=count@entry=2) at /test/10.5_dbg/sql/sql_union.cc:1224
      #19 0x0000555b6fed467c in st_select_lex_unit::prepare (this=this@entry=0x7ff24d074cd0, derived_arg=derived_arg@entry=0x7ff24d076660, sel_result=<optimized out>, additional_options=additional_options@entry=0) at /test/10.5_dbg/sql/sql_union.cc:1620
      #20 0x0000555b6fd9c51e in mysql_derived_prepare (thd=0x7ff24d015088, lex=0x7ff24d018fd0, derived=0x7ff24d076660) at /test/10.5_dbg/sql/sql_derived.cc:816
      #21 0x0000555b6fd9a97d in mysql_handle_single_derived (lex=lex@entry=0x7ff24d018fd0, derived=derived@entry=0x7ff24d076660, phases=phases@entry=2) at /test/10.5_dbg/sql/sql_derived.cc:206
      #22 0x0000555b6fef7a59 in TABLE_LIST::handle_derived (this=this@entry=0x7ff24d076660, lex=lex@entry=0x7ff24d018fd0, phases=phases@entry=2) at /test/10.5_dbg/sql/table.cc:8989
      #23 0x0000555b6fdbd417 in LEX::handle_list_of_derived (phases=2, table_list=<optimized out>, this=0x7ff24d018fd0) at /test/10.5_dbg/sql/sql_lex.h:4402
      #24 st_select_lex::handle_derived (this=<optimized out>, lex=0x7ff24d018fd0, phases=phases@entry=2) at /test/10.5_dbg/sql/sql_lex.cc:4837
      #25 0x0000555b6fe56734 in JOIN::prepare (this=this@entry=0x7ff24d0776d0, tables_init=tables_init@entry=0x7ff24d076660, conds_init=conds_init@entry=0x0, og_num=og_num@entry=0, order_init=order_init@entry=0x0, skip_order_by=skip_order_by@entry=false, group_init=0x0, having_init=0x0, proc_param_init=0x0, select_lex_arg=0x7ff24d074170, unit_arg=0x7ff24d019098) at /test/10.5_dbg/sql/sql_select.cc:1140
      #26 0x0000555b6fe64385 in mysql_select (thd=thd@entry=0x7ff24d015088, tables=0x7ff24d076660, fields=..., conds=0x0, og_num=0, order=0x0, group=0x0, having=0x0, proc_param=0x0, select_options=2147748608, result=0x7ff24d0776a8, unit=0x7ff24d019098, select_lex=0x7ff24d074170) at /test/10.5_dbg/sql/sql_select.cc:4634
      #27 0x0000555b6fe64787 in handle_select (thd=thd@entry=0x7ff24d015088, lex=lex@entry=0x7ff24d018fd0, result=result@entry=0x7ff24d0776a8, setup_tables_done_option=setup_tables_done_option@entry=0) at /test/10.5_dbg/sql/sql_select.cc:417
      #28 0x0000555b6fdeeef4 in execute_sqlcom_select (thd=thd@entry=0x7ff24d015088, all_tables=0x7ff24d076660) at /test/10.5_dbg/sql/sql_parse.cc:6172
      #29 0x0000555b6fde7919 in mysql_execute_command (thd=thd@entry=0x7ff24d015088) at /test/10.5_dbg/sql/sql_parse.cc:3901
      #30 0x0000555b6fdf4f2b in mysql_parse (thd=thd@entry=0x7ff24d015088, rawbuf=<optimized out>, length=<optimized out>, parser_state=parser_state@entry=0x7ff27aa99450, 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:7957
      #31 0x0000555b6fde0c45 in dispatch_command (command=command@entry=COM_QUERY, thd=thd@entry=0x7ff24d015088, packet=packet@entry=0x7ff24d067089 "SELECT * FROM (VALUES (1) UNION SELECT * FROM t1) AS t", packet_length=packet_length@entry=54, 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:1839
      #32 0x0000555b6fddf49b in do_command (thd=0x7ff24d015088) at /test/10.5_dbg/sql/sql_parse.cc:1358
      #33 0x0000555b6ff3a415 in do_handle_one_connection (connect=<optimized out>, connect@entry=0x7ff258bc53a8, put_in_cache=put_in_cache@entry=true) at /test/10.5_dbg/sql/sql_connect.cc:1422
      #34 0x0000555b6ff3a744 in handle_one_connection (arg=arg@entry=0x7ff258bc53a8) at /test/10.5_dbg/sql/sql_connect.cc:1319
      #35 0x0000555b7039afb0 in pfs_spawn_thread (arg=0x7ff278445b08) at /test/10.5_dbg/storage/perfschema/pfs.cc:2201
      #36 0x00007ff279ec16db in start_thread (arg=0x7ff27aa9a700) at pthread_create.c:463
      #37 0x00007ff2792bf88f in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95
      

      Bug confirmed present in:
      MariaDB: 10.3.23 (dbg), 10.4.13 (dbg), 10.5.2 (dbg), 10.5.3 (dbg)

      Bug confirmed not present in:
      MariaDB: 10.1.45 (dbg), 10.1.45 (opt), 10.2.32 (dbg), 10.2.32 (opt), 10.3.23 (opt), 10.4.13 (opt), 10.5.2 (opt), 10.5.3 (opt)
      MySQL: 5.5.62 (dbg), 5.5.62 (opt), 5.6.47 (dbg), 5.6.47 (opt), 5.7.29 (dbg), 5.7.29 (opt), 8.0.19 (dbg), 8.0.19 (opt)

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              bar Alexander Barkov
              Reporter:
              Roel Roel Van de Paar
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: