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

Assertion `args[0]->decimals == 0' failed in Item_func_round::fix_arg_int

    XMLWordPrintable

Details

    Description

      SELECT ROUND(GREATEST('1', CAST('2020-12-12' AS DATE)));
      

      10.4 00f964ab

      mysqld: /data/src/10.4/sql/item_func.cc:2470: void Item_func_round::fix_arg_int(const Type_handler*, const Type_std_attributes*, bool): Assertion `args[0]->decimals == 0' failed.
      200803 17:06:14 [ERROR] mysqld got signal 6 ;
       
      #7  0x00007fc24e0fff12 in __GI___assert_fail (assertion=0x55f41cf88633 "args[0]->decimals == 0", file=0x55f41cf882d0 "/data/src/10.4/sql/item_func.cc", line=2470, function=0x55f41cf8a600 <Item_func_round::fix_arg_int(Type_handler const*, Type_std_attributes const*, bool)::__PRETTY_FUNCTION__> "void Item_func_round::fix_arg_int(const Type_handler*, const Type_std_attributes*, bool)") at assert.c:101
      #8  0x000055f41c4b60b1 in Item_func_round::fix_arg_int (this=0x7fc238013d18, preferred=0x55f41d89dcb0 <type_handler_long>, preferred_attrs=0x55f41daa8200 <Type_handler_date_common::Item_func_round_fix_length_and_dec(Item_func_round*) const::attr>, use_decimal_on_length_increase=false) at /data/src/10.4/sql/item_func.cc:2470
      #9  0x000055f41c2edcb8 in Type_handler_date_common::Item_func_round_fix_length_and_dec (this=0x55f41d89dd40 <type_handler_newdate>, item=0x7fc238013d18) at /data/src/10.4/sql/sql_type.cc:5736
      #10 0x000055f41c4c8eb0 in Item_func_round::fix_length_and_dec (this=0x7fc238013d18) at /data/src/10.4/sql/item_func.h:1790
      #11 0x000055f41c4ad759 in Item_func::fix_fields (this=0x7fc238013d18, thd=0x7fc238000af0, ref=0x7fc238013df0) at /data/src/10.4/sql/item_func.cc:370
      #12 0x000055f41bfb585f in Item::fix_fields_if_needed (this=0x7fc238013d18, thd=0x7fc238000af0, ref=0x7fc238013df0) at /data/src/10.4/sql/item.h:960
      #13 0x000055f41bfb588d in Item::fix_fields_if_needed_for_scalar (this=0x7fc238013d18, thd=0x7fc238000af0, ref=0x7fc238013df0) at /data/src/10.4/sql/item.h:964
      #14 0x000055f41c034287 in setup_fields (thd=0x7fc238000af0, ref_pointer_array=..., fields=..., column_usage=MARK_COLUMNS_READ, sum_func_list=0x7fc238014a80, pre_fix=0x7fc238013520, allow_sum_func=true) at /data/src/10.4/sql/sql_base.cc:7685
      #15 0x000055f41c111e26 in JOIN::prepare (this=0x7fc238014760, tables_init=0x0, wild_num=0, conds_init=0x0, og_num=0, order_init=0x0, skip_order_by=false, group_init=0x0, having_init=0x0, proc_param_init=0x0, select_lex_arg=0x7fc2380133c0, unit_arg=0x7fc238004a18) at /data/src/10.4/sql/sql_select.cc:1245
      #16 0x000055f41c11eae5 in mysql_select (thd=0x7fc238000af0, tables=0x0, wild_num=0, fields=..., conds=0x0, og_num=0, order=0x0, group=0x0, having=0x0, proc_param=0x0, select_options=2147748608, result=0x7fc238014738, unit=0x7fc238004a18, select_lex=0x7fc2380133c0) at /data/src/10.4/sql/sql_select.cc:4650
      #17 0x000055f41c10e75c in handle_select (thd=0x7fc238000af0, lex=0x7fc238004958, result=0x7fc238014738, setup_tables_done_option=0) at /data/src/10.4/sql/sql_select.cc:422
      #18 0x000055f41c0d4f86 in execute_sqlcom_select (thd=0x7fc238000af0, all_tables=0x0) at /data/src/10.4/sql/sql_parse.cc:6355
      #19 0x000055f41c0cb5bd in mysql_execute_command (thd=0x7fc238000af0) at /data/src/10.4/sql/sql_parse.cc:3889
      #20 0x000055f41c0d8f33 in mysql_parse (thd=0x7fc238000af0, rawbuf=0x7fc2380132f0 "SELECT ROUND(GREATEST('1', CAST('2020-12-12' AS DATE)))", length=55, parser_state=0x7fc2482a9570, is_com_multi=false, is_next_command=false) at /data/src/10.4/sql/sql_parse.cc:7896
      #21 0x000055f41c0c5468 in dispatch_command (command=COM_QUERY, thd=0x7fc238000af0, packet=0x7fc2381364b1 "SELECT ROUND(GREATEST('1', CAST('2020-12-12' AS DATE)))", packet_length=55, is_com_multi=false, is_next_command=false) at /data/src/10.4/sql/sql_parse.cc:1835
      #22 0x000055f41c0c3c0a in do_command (thd=0x7fc238000af0) at /data/src/10.4/sql/sql_parse.cc:1353
      #23 0x000055f41c24cfa0 in do_handle_one_connection (connect=0x55f4200ffba0) at /data/src/10.4/sql/sql_connect.cc:1412
      #24 0x000055f41c24ccef in handle_one_connection (arg=0x55f4200ffba0) at /data/src/10.4/sql/sql_connect.cc:1316
      #25 0x000055f41cc4f0d5 in pfs_spawn_thread (arg=0x55f42011b720) at /data/src/10.4/storage/perfschema/pfs.cc:1869
      #26 0x00007fc2500884a4 in start_thread (arg=0x7fc2482aa700) at pthread_create.c:456
      #27 0x00007fc24e1bcd0f in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:97
      

      Reproducible on 10.4-10.5.
      Not reproducible on 10.3.
      The failure started happening on 10.4 after this commit:

      commit dc513dff911d72eaaf9f752f390fef8d1ef9a4b0
      Author: Alexander Barkov
      Date:   Fri Jul 31 10:42:44 2020 +0400
       
          MDEV-23351 Rounding functions return wrong data types for DATE input
      

      Attachments

        Issue Links

          Activity

            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.