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

Assertion `args[0]->fixed' fails in Item_func_conv_charset::Item_func_conv_charset

Details

    Description

      CREATE TABLE t1 (f1 VARCHAR(10) CHARSET utf8) ENGINE=MyISAM;
      INSERT INTO t1 VALUES ('foo'),('bar');
       
      CREATE TABLE t2 (f2 VARCHAR(10) CHARSET latin1) ENGINE=MyISAM;
      INSERT INTO t2 VALUES  ('qux'),('foobar');
       
      SELECT ( SELECT COUNT(*) FROM t1 WHERE f1 <= f2 ) AS sq
      FROM t2 GROUP BY sq;

      Stack trace from 5.5 commit 34f37aa0c0aa87cfb6908500e937516ff37ea6f0

      mysqld: 5.5/sql/item_strfunc.h:830: Item_func_conv_charset::Item_func_conv_charset(Item*, CHARSET_INFO*, bool): Assertion `args[0]->fixed' failed.
      150323  0:10:05 [ERROR] mysqld got signal 6 ;
       
      #6  0x00007f3d028de311 in *__GI___assert_fail (assertion=0xe0cdf8 "args[0]->fixed", file=<optimized out>, line=830, function=0xe10260 "Item_func_conv_charset::Item_func_conv_charset(Item*, CHARSET_INFO*, bool)") at assert.c:81
      #7  0x00000000008135b1 in Item_func_conv_charset::Item_func_conv_charset (this=0x7f3cfd569f20, a=0x7f3cfd569de8, cs=0x1551240, cache_if_const=true) at 5.5/sql/item_strfunc.h:830
      #8  0x00000000007f857f in Item::safe_charset_converter (this=0x7f3cfd569de8, tocs=0x1551240) at 5.5/sql/item.cc:1133
      #9  0x00000000007fb460 in agg_item_set_converter (coll=..., fname=0xe114e2 "<=", args=0x7f3cfd688680, nargs=2, flags=7, item_sep=1) at 5.5/sql/item.cc:2181
      #10 0x00000000007fb6ae in agg_item_charsets (coll=..., fname=0xe114e2 "<=", args=0x7f3cfd688680, nargs=2, flags=7, item_sep=1) at 5.5/sql/item.cc:2262
      #11 0x000000000082a792 in agg_item_charsets_for_comparison (c=..., name=0xe114e2 "<=", items=0x7f3cfd688680, nitems=2, item_sep=1) at 5.5/sql/item.h:1906
      #12 0x000000000082a898 in Item_func::agg_arg_charsets_for_comparison (this=0x7f3cfd6885f0, c=..., items=0x7f3cfd688680, nitems=2, item_sep=1) at 5.5/sql/item_func.h:217
      #13 0x000000000081873a in Item_bool_func2::fix_length_and_dec (this=0x7f3cfd6885f0) at 5.5/sql/item_cmpfunc.cc:554
      #14 0x000000000084291f in Item_func::fix_fields (this=0x7f3cfd6885f0, thd=0x7f3cfe550060, ref=0x7f3cfd569bd0) at 5.5/sql/item_func.cc:231
      #15 0x00000000005e4000 in setup_conds (thd=0x7f3cfe550060, tables=0x7f3cfd687df8, leaves=..., conds=0x7f3cfd569bd0) at 5.5/sql/sql_base.cc:8894
      #16 0x00000000006a4b0a in setup_without_group (thd=0x7f3cfe550060, ref_pointer_array=0x7f3cfd569cf8, tables=0x7f3cfd687df8, leaves=..., fields=..., all_fields=..., conds=0x7f3cfd569bd0, order=0x0, group=0x0, hidden_group_fields=0x7f3cfd569ab8) at 5.5/sql/sql_select.cc:577
      #17 0x0000000000663d64 in JOIN::prepare (this=0x7f3cfd5697b8, rref_pointer_array=0x7f3cfd6873f8, tables_init=0x7f3cfd687df8, wild_num=0, conds_init=0x7f3cfd6885f0, og_num=0, order_init=0x0, skip_order_by=false, group_init=0x0, having_init=0x0, proc_param_init=0x0, select_lex_arg=0x7f3cfd687188, unit_arg=0x7f3cfd6874f8) at 5.5/sql/sql_select.cc:727
      #18 0x0000000000883bca in subselect_single_select_engine::prepare (this=0x7f3cfd688898) at 5.5/sql/item_subselect.cc:3025
      #19 0x000000000087c4bb in Item_subselect::fix_fields (this=0x7f3cfd688760, thd_param=0x7f3cfe550060, ref=0x7f3cfd6888e8) at 5.5/sql/item_subselect.cc:245
      #20 0x00000000005e2328 in setup_fields (thd=0x7f3cfe550060, ref_pointer_array=0x7f3cfd569678, fields=..., mark_used_columns=MARK_COLUMNS_READ, sum_func_list=0x7f3cfd569468, allow_sum_func=true) at 5.5/sql/sql_base.cc:8169
      #21 0x0000000000663cac in JOIN::prepare (this=0x7f3cfd569138, rref_pointer_array=0x7f3cfe553cd0, tables_init=0x7f3cfd688930, wild_num=0, conds_init=0x0, og_num=1, order_init=0x0, skip_order_by=false, group_init=0x7f3cfd689020, having_init=0x0, proc_param_init=0x0, select_lex_arg=0x7f3cfe553a60, unit_arg=0x7f3cfe553380) at 5.5/sql/sql_select.cc:723
      #22 0x000000000066c3fb in mysql_select (thd=0x7f3cfe550060, rref_pointer_array=0x7f3cfe553cd0, tables=0x7f3cfd688930, wild_num=0, fields=..., conds=0x0, og_num=1, order=0x0, group=0x7f3cfd689020, having=0x0, proc_param=0x0, select_options=2147748608, result=0x7f3cfd569118, unit=0x7f3cfe553380, select_lex=0x7f3cfe553a60) at 5.5/sql/sql_select.cc:3074
      #23 0x0000000000662f7d in handle_select (thd=0x7f3cfe550060, lex=0x7f3cfe5532d0, result=0x7f3cfd569118, setup_tables_done_option=0) at 5.5/sql/sql_select.cc:319
      #24 0x000000000063c1bc in execute_sqlcom_select (thd=0x7f3cfe550060, all_tables=0x7f3cfd688930) at 5.5/sql/sql_parse.cc:4689
      #25 0x000000000063539e in mysql_execute_command (thd=0x7f3cfe550060) at 5.5/sql/sql_parse.cc:2234
      #26 0x000000000063eca2 in mysql_parse (thd=0x7f3cfe550060, rawbuf=0x7f3cfd687078 "SELECT ( SELECT COUNT(*) FROM t1 WHERE f1 <= f2 ) AS sq\nFROM t2 GROUP BY sq", length=75, parser_state=0x7f3cfdfb5620) at 5.5/sql/sql_parse.cc:5909
      #27 0x00000000006328e5 in dispatch_command (command=COM_QUERY, thd=0x7f3cfe550060, packet=0x7f3cfe609061 "SELECT ( SELECT COUNT(*) FROM t1 WHERE f1 <= f2 ) AS sq\nFROM t2 GROUP BY sq", packet_length=75) at 5.5/sql/sql_parse.cc:1079
      #28 0x0000000000631a71 in do_command (thd=0x7f3cfe550060) at 5.5/sql/sql_parse.cc:793
      #29 0x00000000007340f2 in do_handle_one_connection (thd_arg=0x7f3cfe550060) at 5.5/sql/sql_connect.cc:1266
      #30 0x0000000000733bb1 in handle_one_connection (arg=0x7f3cfe550060) at 5.5/sql/sql_connect.cc:1181
      #31 0x0000000000b6c5f9 in pfs_spawn_thread (arg=0x7f3cfe571fc0) at 5.5/storage/perfschema/pfs.cc:1015
      #32 0x00007f3d046d9b50 in start_thread (arg=<optimized out>) at pthread_create.c:304
      #33 0x00007f3d0298f70d in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:112

      Attachments

        Issue Links

          Activity

            There is an upstream bug http://bugs.mysql.com/bug.php?id=74695, but it isn't moving forward, and besides if it gets fixed, it will be either in 5.6 or (more likely) in 5.7, so we won't get the fix automatically anyway. If it's as simple as removing a wrong assertion, maybe it could be done in MariaDB without waiting for an upstream fix?

            elenst Elena Stepanova added a comment - There is an upstream bug http://bugs.mysql.com/bug.php?id=74695 , but it isn't moving forward, and besides if it gets fixed, it will be either in 5.6 or (more likely) in 5.7, so we won't get the fix automatically anyway. If it's as simple as removing a wrong assertion, maybe it could be done in MariaDB without waiting for an upstream fix?
            bar Alexander Barkov added a comment - - edited

            A smaller test case reproducing the problem:

            DROP TABLE IF EXISTS t1,t2;
            CREATE TABLE t1(a CHAR(1) CHARACTER SET latin1, b INT NOT NULL);
            CREATE TABLE t2(a CHAR(1) CHARACTER SET utf8 COLLATE utf8_general_ci, b INT NOT NULL);
            SELECT(SELECT t2.a FROM t2 WHERE t2.a=t1.a)aa,b,COUNT(b) FROM t1 GROUP BY aa;

            bar Alexander Barkov added a comment - - edited A smaller test case reproducing the problem: DROP TABLE IF EXISTS t1,t2; CREATE TABLE t1(a CHAR (1) CHARACTER SET latin1, b INT NOT NULL ); CREATE TABLE t2(a CHAR (1) CHARACTER SET utf8 COLLATE utf8_general_ci, b INT NOT NULL ); SELECT ( SELECT t2.a FROM t2 WHERE t2.a=t1.a)aa,b, COUNT (b) FROM t1 GROUP BY aa;

            I populate tables in my test cases whenever possible, because problems on empty/constant tables are commonly considered corner cases.

            elenst Elena Stepanova added a comment - I populate tables in my test cases whenever possible, because problems on empty/constant tables are commonly considered corner cases.

            People

              bar Alexander Barkov
              elenst Elena Stepanova
              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.