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

Assertion `precision > 0' failed in decimal_bin_size upon CREATE .. SELECT with zerofilled decimal

    XMLWordPrintable

Details

    Description

      CREATE TABLE t1 (d DECIMAL(1,0) ZEROFILL);
      CREATE TABLE t2 AS SELECT 0 MOD d AS f FROM t1;
       
      # Cleanup
      DROP TABLE t1, t2;
      

      10.4 db4a27ab debug

      mysqld: /data/src/10.4/strings/decimal.c:1466: decimal_bin_size: Assertion `precision > 0' failed.
      190904 20:53:40 [ERROR] mysqld got signal 6 ;
       
      #7  0x00007f7329671f12 in __GI___assert_fail (assertion=0x55ea4962a425 "precision > 0", file=0x55ea4962a1a0 "/data/src/10.4/strings/decimal.c", line=1466, function=0x55ea4962a6a0 <__PRETTY_FUNCTION__.11647> "decimal_bin_size") at assert.c:101
      #8  0x000055ea4909cbf4 in decimal_bin_size (precision=0, scale=0) at /data/src/10.4/strings/decimal.c:1466
      #9  0x000055ea484aa5d5 in my_decimal_get_binary_size (precision=0, scale=0) at /data/src/10.4/sql/my_decimal.h:324
      #10 0x000055ea4873d94b in Field_new_decimal::Field_new_decimal (this=0x7f73080158d8, ptr_arg=0x0, len_arg=1, null_ptr_arg=0x55ea4911162e "", null_bit_arg=1 '\001', unireg_check_arg=Field::NONE, field_name_arg=0x7f7308013f58, dec_arg=0 '\000', zero_arg=false, unsigned_arg=false) at /data/src/10.4/sql/field.cc:3153
      #11 0x000055ea48631499 in Type_handler_newdecimal::make_table_field (this=0x55ea49be1bd0 <type_handler_newdecimal>, name=0x7f7308013f58, addr=..., attr=..., table=0x7f731f7faae0) at /data/src/10.4/sql/sql_type.cc:3170
      #12 0x000055ea48630a0a in Type_handler::make_and_init_table_field (this=0x55ea49be1bd0 <type_handler_newdecimal>, name=0x7f7308013f58, addr=..., attr=..., table=0x7f731f7faae0) at /data/src/10.4/sql/sql_type.cc:2996
      #13 0x000055ea482ed9ec in Item::tmp_table_field_from_field_type (this=0x7f7308013f08, table=0x7f731f7faae0) at /data/src/10.4/sql/item.h:806
      #14 0x000055ea48381ef7 in Item_func::create_field_for_create_select (this=0x7f7308013f08, table=0x7f731f7faae0) at /data/src/10.4/sql/item_func.h:192
      #15 0x000055ea483cfea1 in select_create::create_table_from_items (this=0x7f7308015178, thd=0x7f7308000b00, items=0x7f731f7fbea0, lock=0x7f731f7fbe90, hooks=0x7f731f7fbee0) at /data/src/10.4/sql/sql_insert.cc:4212
      #16 0x000055ea483d092f in select_create::prepare (this=0x7f7308015178, _values=..., u=0x7f7308004a30) at /data/src/10.4/sql/sql_insert.cc:4455
      #17 0x000055ea4845befc in JOIN::prepare (this=0x7f7308015270, tables_init=0x7f7308014030, 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=0x7f73080138f0, unit_arg=0x7f7308004a30) at /data/src/10.4/sql/sql_select.cc:1441
      #18 0x000055ea484676ed in mysql_select (thd=0x7f7308000b00, tables=0x7f7308014030, wild_num=0, fields=..., conds=0x0, og_num=0, order=0x0, group=0x0, having=0x0, proc_param=0x0, select_options=2416184064, result=0x7f7308015178, unit=0x7f7308004a30, select_lex=0x7f73080138f0) at /data/src/10.4/sql/sql_select.cc:4568
      #19 0x000055ea48457671 in handle_select (thd=0x7f7308000b00, lex=0x7f7308004968, result=0x7f7308015178, setup_tables_done_option=0) at /data/src/10.4/sql/sql_select.cc:425
      #20 0x000055ea4850a829 in Sql_cmd_create_table_like::execute (this=0x7f73080131d8, thd=0x7f7308000b00) at /data/src/10.4/sql/sql_table.cc:11390
      #21 0x000055ea4841c34d in mysql_execute_command (thd=0x7f7308000b00) at /data/src/10.4/sql/sql_parse.cc:6099
      #22 0x000055ea48421a96 in mysql_parse (thd=0x7f7308000b00, rawbuf=0x7f7308013118 "CREATE TABLE t2 AS SELECT 0 MOD d AS f FROM t1", length=46, parser_state=0x7f731f7fd170, is_com_multi=false, is_next_command=false) at /data/src/10.4/sql/sql_parse.cc:7909
      #23 0x000055ea4840ca96 in dispatch_command (command=COM_QUERY, thd=0x7f7308000b00, packet=0x7f7308008321 "CREATE TABLE t2 AS SELECT 0 MOD d AS f FROM t1", packet_length=46, is_com_multi=false, is_next_command=false) at /data/src/10.4/sql/sql_parse.cc:1843
      #24 0x000055ea4840b0e0 in do_command (thd=0x7f7308000b00) at /data/src/10.4/sql/sql_parse.cc:1360
      #25 0x000055ea48594e95 in do_handle_one_connection (connect=0x55ea4b8fe010) at /data/src/10.4/sql/sql_connect.cc:1412
      #26 0x000055ea48594be4 in handle_one_connection (arg=0x55ea4b8fe010) at /data/src/10.4/sql/sql_connect.cc:1316
      #27 0x000055ea48fcafb5 in pfs_spawn_thread (arg=0x55ea4b933420) at /data/src/10.4/storage/perfschema/pfs.cc:1862
      #28 0x00007f732b1e64a4 in start_thread (arg=0x7f731f7fe700) at pthread_create.c:456
      #29 0x00007f732972ed0f in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:97
      

      No obvious effect on a non-debug build.

      Attachments

        Issue Links

          Activity

            People

              bar Alexander Barkov
              elenst Elena Stepanova
              Votes:
              0 Vote for this issue
              Watchers:
              2 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.