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

Assertion `precision > 0' failed in decimal_bin_size upon SELECT with GROUP BY and/or ORDER BY

    XMLWordPrintable

Details

    • Bug
    • Status: Confirmed (View Workflow)
    • Major
    • Resolution: Unresolved
    • 5.5, 10.1, 10.2, 10.3, 10.4, 10.5, 10.6, 10.7, 10.8, 10.9, 10.10, 10.11
    • 10.4, 10.5, 10.6
    • Data types
    • None

    Description

      Note: Patch for MDEV-20495 is already in the trees, so it can't be a duplicate of it, and I can't find any other suitable candidates.

      CREATE TABLE t1 (a DECIMAL(1,0) ZEROFILL DEFAULT 0);
      INSERT INTO t1 VALUES (1),(2);
      SELECT DISTINCT a FROM t1 GROUP BY DEFAULT(a) WITH ROLLUP;
       
      # Cleanup
      DROP TABLE t1;
      

      10.4 eb0a10b0

      mysqld: /data/src/10.4/strings/decimal.c:1466: decimal_bin_size: Assertion `precision > 0' failed.
      191004 17:09:37 [ERROR] mysqld got signal 6 ;
       
      #7  0x00007f68d064ef12 in __GI___assert_fail (assertion=0x55e20b51e725 "precision > 0", file=0x55e20b51e4a0 "/data/src/5.5-bug/strings/decimal.c", line=1460, function=0x55e20b51e9a0 <__PRETTY_FUNCTION__.10294> "decimal_bin_size") at assert.c:101
      #8  0x000055e20b24bcd4 in decimal_bin_size (precision=0, scale=0) at /data/src/5.5-bug/strings/decimal.c:1460
      #9  0x000055e20abd3f71 in my_decimal_get_binary_size (precision=0, scale=0) at /data/src/5.5-bug/sql/my_decimal.h:263
      #10 0x000055e20acf2b07 in Field_new_decimal::Field_new_decimal (this=0x7f68cb459978, len_arg=1, maybe_null_arg=true, name=0x0, dec_arg=0 '\000', unsigned_arg=false) at /data/src/5.5-bug/sql/field.cc:2530
      #11 0x000055e20acf2c61 in Field_new_decimal::create_from_item (item=0x7f68cb580098) at /data/src/5.5-bug/sql/field.cc:2574
      #12 0x000055e20abbad8b in create_tmp_field_from_item (thd=0x7f68cc3f0060, item=0x7f68cb580098, table=0x7f68cb598078, copy_func=0x7f68d20c2288, modify_item=true, convert_blob_length=0) at /data/src/5.5-bug/sql/sql_select.cc:14804
      #13 0x000055e20abbb56d in create_tmp_field (thd=0x7f68cc3f0060, table=0x7f68cb598078, item=0x7f68cb580098, type=Item::FUNC_ITEM, copy_func=0x7f68d20c2288, from_field=0x7f68cb598db8, default_field=0x7f68cb598d98, group=false, modify_item=true, table_cant_handle_bit_fields=false, make_copy_field=false, convert_blob_length=0) at /data/src/5.5-bug/sql/sql_select.cc:15040
      #14 0x000055e20abbc899 in create_tmp_table (thd=0x7f68cc3f0060, param=0x7f68cb548dd0, fields=..., group=0x0, distinct=false, save_sum_fields=true, select_options=2147748609, rows_limit=18446744073709551615, table_alias=0x55e20b289802 "", do_not_open=false, keep_row_order=false) at /data/src/5.5-bug/sql/sql_select.cc:15394
      #15 0x000055e20ab99f20 in JOIN::init_execution (this=0x7f68cb548bc0) at /data/src/5.5-bug/sql/sql_select.cc:1894
      #16 0x000055e20ab9bf04 in JOIN::exec (this=0x7f68cb548bc0) at /data/src/5.5-bug/sql/sql_select.cc:2440
      #17 0x000055e20ab9e3f7 in mysql_select (thd=0x7f68cc3f0060, rref_pointer_array=0x7f68cc3f3d08, tables=0x7f68cb5482b8, wild_num=0, fields=..., conds=0x0, og_num=1, order=0x0, group=0x7f68cb548ac0, having=0x0, proc_param=0x0, select_options=2147748609, result=0x7f68cb548ba0, unit=0x7f68cc3f3388, select_lex=0x7f68cc3f3a68) at /data/src/5.5-bug/sql/sql_select.cc:3135
      #18 0x000055e20ab949c4 in handle_select (thd=0x7f68cc3f0060, lex=0x7f68cc3f32d8, result=0x7f68cb548ba0, setup_tables_done_option=0) at /data/src/5.5-bug/sql/sql_select.cc:312
      #19 0x000055e20ab6d890 in execute_sqlcom_select (thd=0x7f68cc3f0060, all_tables=0x7f68cb5482b8) at /data/src/5.5-bug/sql/sql_parse.cc:4684
      #20 0x000055e20ab66791 in mysql_execute_command (thd=0x7f68cc3f0060) at /data/src/5.5-bug/sql/sql_parse.cc:2222
      #21 0x000055e20ab70453 in mysql_parse (thd=0x7f68cc3f0060, rawbuf=0x7f68cb548078 "SELECT DISTINCT a FROM t1 GROUP BY DEFAULT(a) WITH ROLLUP", length=57, parser_state=0x7f68d20c3620) at /data/src/5.5-bug/sql/sql_parse.cc:5929
      #22 0x000055e20ab63d0f in dispatch_command (command=COM_QUERY, thd=0x7f68cc3f0060, packet=0x7f68cc2f2061 "SELECT DISTINCT a FROM t1 GROUP BY DEFAULT(a) WITH ROLLUP", packet_length=57) at /data/src/5.5-bug/sql/sql_parse.cc:1067
      #23 0x000055e20ab62f1f in do_command (thd=0x7f68cc3f0060) at /data/src/5.5-bug/sql/sql_parse.cc:793
      #24 0x000055e20ac68a8f in do_handle_one_connection (thd_arg=0x7f68cc3f0060) at /data/src/5.5-bug/sql/sql_connect.cc:1268
      #25 0x000055e20ac687fe in handle_one_connection (arg=0x7f68cc3f0060) at /data/src/5.5-bug/sql/sql_connect.cc:1184
      #26 0x000055e20afed250 in pfs_spawn_thread (arg=0x7f68cc29a080) at /data/src/5.5-bug/storage/perfschema/pfs.cc:1015
      #27 0x00007f68d1cf54a4 in start_thread (arg=0x7f68d20c4700) at pthread_create.c:456
      #28 0x00007f68d070bd0f in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:97
      

      Reproducible on 5.5-10.4 with at least MyISAM, InnoDB, Aria.
      Couldn't reproduce on 10.5, but see comments for other test cases which also fail on 10.5+.

      Non-debug build produces a warning:

      SELECT DISTINCT a FROM t1 GROUP BY DEFAULT(a) WITH ROLLUP;
      a
      0
      Warnings:
      Warning	1918	Encountered illegal value '' when converting to DECIMAL
      

      I am not sure whether it's expected.

      Attachments

        Issue Links

          Activity

            People

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

              Dates

                Created:
                Updated:

                Git Integration

                  Error rendering 'com.xiplink.jira.git.jira_git_plugin:git-issue-webpanel'. Please contact your Jira administrators.