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

Assertion `arg2_int >= 0' or Assertion `arg1_int >= 0' failed in Item_func_additive_op::result_precision

    XMLWordPrintable

    Details

      Description

      CREATE TABLE t (d DECIMAL(65,32));
      INSERT INTO t VALUES (1.1),(2.2); # Optional, fails either way
       
      SELECT ROUND(d, CRC32(d)) + 1 FROM t;
       
      # Cleanup
      DROP TABLE t;
      

      10.2 cdb86faf

      mysqld: /data/src/10.2/sql/item_func.cc:1404: virtual void Item_func_additive_op::result_precision(): Assertion `arg1_int >= 0' failed.
      210326  2:37:40 [ERROR] mysqld got signal 6 ;
       
      #7  0x00007f60d1f8cf36 in __GI___assert_fail (assertion=0x56181483fe97 "arg1_int >= 0", file=0x56181483f908 "/data/src/10.2/sql/item_func.cc", line=1404, function=0x56181483fe60 "virtual void Item_func_additive_op::result_precision()") at assert.c:101
      #8  0x0000561813fe8f2d in Item_func_additive_op::result_precision (this=0x7f60bc012ca0) at /data/src/10.2/sql/item_func.cc:1404
      #9  0x0000561813fe66f0 in Item_num_op::fix_length_and_dec (this=0x7f60bc012ca0) at /data/src/10.2/sql/item_func.cc:776
      #10 0x0000561813fe4bba in Item_func::fix_fields (this=0x7f60bc012ca0, thd=0x7f60bc000d90, ref=0x7f60bc012d78) at /data/src/10.2/sql/item_func.cc:230
      #11 0x0000561813c7e98d in setup_fields (thd=0x7f60bc000d90, ref_pointer_array=..., fields=..., mark_used_columns=MARK_COLUMNS_READ, sum_func_list=0x7f60bc013838, pre_fix=0x7f60bc005208, allow_sum_func=true) at /data/src/10.2/sql/sql_base.cc:7283
      #12 0x0000561813d27399 in JOIN::prepare (this=0x7f60bc013518, tables_init=0x7f60bc012e00, 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=0x7f60bc0050c8, unit_arg=0x7f60bc004988) at /data/src/10.2/sql/sql_select.cc:798
      #13 0x0000561813d31e4a in mysql_select (thd=0x7f60bc000d90, tables=0x7f60bc012e00, wild_num=0, fields=..., conds=0x0, og_num=0, order=0x0, group=0x0, having=0x0, proc_param=0x0, select_options=2147748608, result=0x7f60bc0134f8, unit=0x7f60bc004988, select_lex=0x7f60bc0050c8) at /data/src/10.2/sql/sql_select.cc:3818
      #14 0x0000561813d2605e in handle_select (thd=0x7f60bc000d90, lex=0x7f60bc0048c8, result=0x7f60bc0134f8, setup_tables_done_option=0) at /data/src/10.2/sql/sql_select.cc:361
      #15 0x0000561813cf067f in execute_sqlcom_select (thd=0x7f60bc000d90, all_tables=0x7f60bc012e00) at /data/src/10.2/sql/sql_parse.cc:6274
      #16 0x0000561813ce71f3 in mysql_execute_command (thd=0x7f60bc000d90) at /data/src/10.2/sql/sql_parse.cc:3585
      #17 0x0000561813cf443b in mysql_parse (thd=0x7f60bc000d90, rawbuf=0x7f60bc0126f8 "SELECT ROUND(d, CRC32(d)) + 1 FROM t", length=36, parser_state=0x7f60cc0e75f0, is_com_multi=false, is_next_command=false) at /data/src/10.2/sql/sql_parse.cc:7794
      #18 0x0000561813ce2664 in dispatch_command (command=COM_QUERY, thd=0x7f60bc000d90, packet=0x7f60bc008b51 "SELECT ROUND(d, CRC32(d)) + 1 FROM t", packet_length=36, is_com_multi=false, is_next_command=false) at /data/src/10.2/sql/sql_parse.cc:1827
      #19 0x0000561813ce115f in do_command (thd=0x7f60bc000d90) at /data/src/10.2/sql/sql_parse.cc:1381
      #20 0x0000561813e3bc94 in do_handle_one_connection (connect=0x561816959110) at /data/src/10.2/sql/sql_connect.cc:1336
      #21 0x0000561813e3b9f9 in handle_one_connection (arg=0x561816959110) at /data/src/10.2/sql/sql_connect.cc:1241
      #22 0x0000561814664d10 in pfs_spawn_thread (arg=0x56181693c580) at /data/src/10.2/storage/perfschema/pfs.cc:1869
      #23 0x00007f60d249e609 in start_thread (arg=<optimized out>) at pthread_create.c:477
      #24 0x00007f60d2078293 in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95
      

      CREATE TABLE t (d DECIMAL(65,32));
      INSERT INTO t VALUES (1.1),(2.2); # Optional, fails either way
       
      SELECT 1 + ROUND(d, CRC32(d)) FROM t;
       
      # Cleanup
      DROP TABLE t;
      

      mysqld: /data/src/10.2/sql/item_func.cc:1405: virtual void Item_func_additive_op::result_precision(): Assertion `arg2_int >= 0' failed.
      210326  2:38:16 [ERROR] mysqld got signal 6 ;
       
      #7  0x00007fc2873faf36 in __GI___assert_fail (assertion=0x55d777f70ea5 "arg2_int >= 0", file=0x55d777f70908 "/data/src/10.2/sql/item_func.cc", line=1405, function=0x55d777f70e60 "virtual void Item_func_additive_op::result_precision()") at assert.c:101
      #8  0x000055d777719f52 in Item_func_additive_op::result_precision (this=0x7fc270012ca0) at /data/src/10.2/sql/item_func.cc:1405
      #9  0x000055d7777176f0 in Item_num_op::fix_length_and_dec (this=0x7fc270012ca0) at /data/src/10.2/sql/item_func.cc:776
      #10 0x000055d777715bba in Item_func::fix_fields (this=0x7fc270012ca0, thd=0x7fc270000d90, ref=0x7fc270012d78) at /data/src/10.2/sql/item_func.cc:230
      #11 0x000055d7773af98d in setup_fields (thd=0x7fc270000d90, ref_pointer_array=..., fields=..., mark_used_columns=MARK_COLUMNS_READ, sum_func_list=0x7fc270013838, pre_fix=0x7fc270005208, allow_sum_func=true) at /data/src/10.2/sql/sql_base.cc:7283
      #12 0x000055d777458399 in JOIN::prepare (this=0x7fc270013518, tables_init=0x7fc270012e00, 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=0x7fc2700050c8, unit_arg=0x7fc270004988) at /data/src/10.2/sql/sql_select.cc:798
      #13 0x000055d777462e4a in mysql_select (thd=0x7fc270000d90, tables=0x7fc270012e00, wild_num=0, fields=..., conds=0x0, og_num=0, order=0x0, group=0x0, having=0x0, proc_param=0x0, select_options=2147748608, result=0x7fc2700134f8, unit=0x7fc270004988, select_lex=0x7fc2700050c8) at /data/src/10.2/sql/sql_select.cc:3818
      #14 0x000055d77745705e in handle_select (thd=0x7fc270000d90, lex=0x7fc2700048c8, result=0x7fc2700134f8, setup_tables_done_option=0) at /data/src/10.2/sql/sql_select.cc:361
      #15 0x000055d77742167f in execute_sqlcom_select (thd=0x7fc270000d90, all_tables=0x7fc270012e00) at /data/src/10.2/sql/sql_parse.cc:6274
      #16 0x000055d7774181f3 in mysql_execute_command (thd=0x7fc270000d90) at /data/src/10.2/sql/sql_parse.cc:3585
      #17 0x000055d77742543b in mysql_parse (thd=0x7fc270000d90, rawbuf=0x7fc2700126f8 "SELECT 1 + ROUND(d, CRC32(d)) FROM t", length=36, parser_state=0x7fc2815555f0, is_com_multi=false, is_next_command=false) at /data/src/10.2/sql/sql_parse.cc:7794
      #18 0x000055d777413664 in dispatch_command (command=COM_QUERY, thd=0x7fc270000d90, packet=0x7fc270008b51 "SELECT 1 + ROUND(d, CRC32(d)) FROM t", packet_length=36, is_com_multi=false, is_next_command=false) at /data/src/10.2/sql/sql_parse.cc:1827
      #19 0x000055d77741215f in do_command (thd=0x7fc270000d90) at /data/src/10.2/sql/sql_parse.cc:1381
      #20 0x000055d77756cc94 in do_handle_one_connection (connect=0x55d77a030110) at /data/src/10.2/sql/sql_connect.cc:1336
      #21 0x000055d77756c9f9 in handle_one_connection (arg=0x55d77a030110) at /data/src/10.2/sql/sql_connect.cc:1241
      #22 0x000055d777d95d10 in pfs_spawn_thread (arg=0x55d77a013580) at /data/src/10.2/storage/perfschema/pfs.cc:1869
      #23 0x00007fc28790c609 in start_thread (arg=<optimized out>) at pthread_create.c:477
      #24 0x00007fc2874e6293 in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95
      

      Reproducible on 10.2-10.6, with at least MyISAM and InnoDB.
      No obvious problem on a non-debug build.

        Attachments

          Activity

            People

            Assignee:
            sanja Oleksandr Byelkin
            Reporter:
            elenst Elena Stepanova
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Dates

              Created:
              Updated:

                Git Integration