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

Assertion `args[0]->max_length <= ((9 * 9) + 2)' failed in Item_func_int_val::fix_length_and_dec_int_or_decimal

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Open (View Workflow)
    • Priority: Major
    • Resolution: Unresolved
    • Affects Version/s: 10.4, 10.5
    • Fix Version/s: 10.4, 10.5
    • Component/s: Data types
    • Labels:
      None

      Description

      SET collation_connection= utf32_unicode_520_ci;
      SELECT CEIL(@f := (TIMESTAMP('2012-12-12 00:00:00.0000')) / 1);
      

      10.4 0f080dd6

      mysqld: /data/src/10.4/sql/item_func.cc:2179: void Item_func_int_val::fix_length_and_dec_int_or_decimal(): Assertion `args[0]->max_length <= ((9 * 9) + 2)' failed.
      200903  0:10:58 [ERROR] mysqld got signal 6 ;
       
      #7  0x00007f95ab775f12 in __GI___assert_fail (assertion=0x5623b0ac03f0 "args[0]->max_length <= ((9 * 9) + 2)", file=0x5623b0ac00b0 "/data/src/10.4/sql/item_func.cc", line=2179, function=0x5623b0ac1f20 <Item_func_int_val::fix_length_and_dec_int_or_decimal()::__PRETTY_FUNCTION__> "void Item_func_int_val::fix_length_and_dec_int_or_decimal()") at assert.c:101
      #8  0x00005623affea530 in Item_func_int_val::fix_length_and_dec_int_or_decimal (this=0x7f9594013d60) at /data/src/10.4/sql/item_func.cc:2179
      #9  0x00005623afe218be in Type_handler_decimal_result::Item_func_int_val_fix_length_and_dec (this=0x5623b13dac98 <type_handler_newdecimal>, item=0x7f9594013d60) at /data/src/10.4/sql/sql_type.cc:5919
      #10 0x00005623affea7cb in Item_func_int_val::fix_length_and_dec (this=0x7f9594013d60) at /data/src/10.4/sql/item_func.cc:2256
      #11 0x00005623affe2e09 in Item_func::fix_fields (this=0x7f9594013d60, thd=0x7f9594000af0, ref=0x7f9594013e38) at /data/src/10.4/sql/item_func.cc:370
      #12 0x00005623afae763b in Item::fix_fields_if_needed (this=0x7f9594013d60, thd=0x7f9594000af0, ref=0x7f9594013e38) at /data/src/10.4/sql/item.h:960
      #13 0x00005623afae7669 in Item::fix_fields_if_needed_for_scalar (this=0x7f9594013d60, thd=0x7f9594000af0, ref=0x7f9594013e38) at /data/src/10.4/sql/item.h:964
      #14 0x00005623afb660bb in setup_fields (thd=0x7f9594000af0, ref_pointer_array=..., fields=..., column_usage=MARK_COLUMNS_READ, sum_func_list=0x7f9594014ad8, pre_fix=0x7f95940133d8, allow_sum_func=true) at /data/src/10.4/sql/sql_base.cc:7685
      #15 0x00005623afc440cb in JOIN::prepare (this=0x7f95940147b8, 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=0x7f9594013278, unit_arg=0x7f9594004a18) at /data/src/10.4/sql/sql_select.cc:1250
      #16 0x00005623afc50dd5 in mysql_select (thd=0x7f9594000af0, tables=0x0, wild_num=0, fields=..., conds=0x0, og_num=0, order=0x0, group=0x0, having=0x0, proc_param=0x0, select_options=2147748608, result=0x7f9594014790, unit=0x7f9594004a18, select_lex=0x7f9594013278) at /data/src/10.4/sql/sql_select.cc:4658
      #17 0x00005623afc40936 in handle_select (thd=0x7f9594000af0, lex=0x7f9594004958, result=0x7f9594014790, setup_tables_done_option=0) at /data/src/10.4/sql/sql_select.cc:422
      #18 0x00005623afc070b8 in execute_sqlcom_select (thd=0x7f9594000af0, all_tables=0x0) at /data/src/10.4/sql/sql_parse.cc:6355
      #19 0x00005623afbfd6ef in mysql_execute_command (thd=0x7f9594000af0) at /data/src/10.4/sql/sql_parse.cc:3889
      #20 0x00005623afc0b065 in mysql_parse (thd=0x7f9594000af0, rawbuf=0x7f9594013198 "SELECT CEIL(@f := (TIMESTAMP('2012-12-12 00:00:00.0000')) / 1)", length=62, parser_state=0x7f95a591f570, is_com_multi=false, is_next_command=false) at /data/src/10.4/sql/sql_parse.cc:7896
      #21 0x00005623afbf7599 in dispatch_command (command=COM_QUERY, thd=0x7f9594000af0, packet=0x7f95941364f1 "SELECT CEIL(@f := (TIMESTAMP('2012-12-12 00:00:00.0000')) / 1)", packet_length=62, is_com_multi=false, is_next_command=false) at /data/src/10.4/sql/sql_parse.cc:1835
      #22 0x00005623afbf5d3b in do_command (thd=0x7f9594000af0) at /data/src/10.4/sql/sql_parse.cc:1353
      #23 0x00005623afd7fd9c in do_handle_one_connection (connect=0x5623b279bcf0) at /data/src/10.4/sql/sql_connect.cc:1412
      #24 0x00005623afd7faeb in handle_one_connection (arg=0x5623b279bcf0) at /data/src/10.4/sql/sql_connect.cc:1316
      #25 0x00005623b0784995 in pfs_spawn_thread (arg=0x5623b27b7870) at /data/src/10.4/storage/perfschema/pfs.cc:1869
      #26 0x00007f95ad6fe4a4 in start_thread (arg=0x7f95a5920700) at pthread_create.c:456
      #27 0x00007f95ab832d0f in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:97
      

      Reproducible on 10.4+.

      The failure started happening on 10.4 after this commit:

      commit 6a2ee9c8bbec437e7eb50b1a273a017cdefc6e15
      Author: Alexander Barkov <bar@mariadb.com>
      Date:   Mon Aug 3 13:56:10 2020 +0400
       
          MDEV-23032 FLOOR()/CEIL() incorrectly calculate the precision of a DECIMAL(M,D) column
      

      but it could be just because the commit added the assertion. I have no information whether the underlying issue existed before (unless the assertion itself is wrong).

        Attachments

          Activity

            People

            Assignee:
            bar Alexander Barkov
            Reporter:
            elenst Elena Stepanova
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Dates

              Created:
              Updated:

                Git Integration