Details
-
Bug
-
Status: Confirmed (View Workflow)
-
Major
-
Resolution: Unresolved
-
5.5(EOL), 10.1(EOL), 10.2(EOL), 10.3(EOL), 10.4(EOL), 10.5, 10.6, 10.7(EOL), 10.8(EOL), 10.9(EOL), 10.10(EOL), 10.11, 11.7(EOL)
-
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
- relates to
-
MDEV-20363 Assertion `is_unsigned() == attr.unsigned_flag' failed in Type_handler_longlong::make_table_field
-
- Closed
-
-
MDEV-15873 Assertion `precision > 0' failed in decimal_bin_size upon EXPLAIN with combination of functions
-
- Closed
-
-
MDEV-20495 Assertion `precision > 0' failed in decimal_bin_size upon CREATE .. SELECT with zerofilled decimal
-
- Closed
-
-
MDEV-21789 Assertion `precision > 0' failed in decimal_bin_size upon SELECT with GROUP BY, IFNULL, DIV
-
- Closed
-
-
MDEV-22502 MDB crashes in CREATE TABLE AS SELECT when the precision of returning type = 0.
-
- Closed
-
I don't want to create yet another issue for this assertion, so I'll extend this one in hope that this all has the same root cause.
# Cleanup
10.3 75538f94
mysqld: /data/src/10.3/strings/decimal.c:1484: decimal_bin_size: Assertion `precision > 0' failed.
210127 1:36:55 [ERROR] mysqld got signal 6 ;
#7 0x00007f74f9138f36 in __GI___assert_fail (assertion=0x5604e833b525 "precision > 0", file=0x5604e833b2a0 "/data/src/10.3/strings/decimal.c", line=1484, function=0x5604e833b790 <__PRETTY_FUNCTION__.14235> "decimal_bin_size") at assert.c:101
#8 0x00005604e7e3f32f in decimal_bin_size (precision=0, scale=0) at /data/src/10.3/strings/decimal.c:1484
#9 0x00005604e72c8de9 in my_decimal_get_binary_size (precision=0, scale=0) at /data/src/10.3/sql/my_decimal.h:263
#10 0x00005604e755b7d6 in Type_handler_decimal_result::sortlength (this=0x5604e868a998 <type_handler_newdecimal>, thd=0x7f74d8000d90, item=0x7f74d8013c78, sortorder=0x7f74d80164c8) at /data/src/10.3/sql/filesort.cc:1914
#11 0x00005604e755b973 in sortlength (thd=0x7f74d8000d90, sortorder=0x7f74d80164c8, s_length=0, multi_byte_charset=0x7f74f4101faf) at /data/src/10.3/sql/filesort.cc:1960
#12 0x00005604e755639f in filesort (thd=0x7f74d8000d90, table=0x7f74d8036310, filesort=0x7f74d8015da8, tracker=0x7f74d8016448, join=0x7f74d8013fa0, first_table_bit=1) at /data/src/10.3/sql/filesort.cc:186
#13 0x00005604e72ba4f5 in create_sort_index (thd=0x7f74d8000d90, join=0x7f74d8013fa0, tab=0x7f74d80152c8, fsort=0x7f74d8015da8) at /data/src/10.3/sql/sql_select.cc:22923
#14 0x00005604e72b46c2 in st_join_table::sort_table (this=0x7f74d80152c8) at /data/src/10.3/sql/sql_select.cc:20686
#15 0x00005604e72b429a in join_init_read_record (tab=0x7f74d80152c8) at /data/src/10.3/sql/sql_select.cc:20627
#16 0x00005604e72b1fd2 in sub_select (join=0x7f74d8013fa0, join_tab=0x7f74d80152c8, end_of_records=false) at /data/src/10.3/sql/sql_select.cc:19708
#17 0x00005604e72b1507 in do_select (join=0x7f74d8013fa0, procedure=0x0) at /data/src/10.3/sql/sql_select.cc:19251
#18 0x00005604e72884cf in JOIN::exec_inner (this=0x7f74d8013fa0) at /data/src/10.3/sql/sql_select.cc:4124
#19 0x00005604e728788e in JOIN::exec (this=0x7f74d8013fa0) at /data/src/10.3/sql/sql_select.cc:3918
#20 0x00005604e7288bab in mysql_select (thd=0x7f74d8000d90, tables=0x7f74d8012d50, wild_num=1, fields=..., conds=0x0, og_num=1, order=0x7f74d8013e50, group=0x0, having=0x0, proc_param=0x0, select_options=2147748608, result=0x7f74d8013f78, unit=0x7f74d8004c58, select_lex=0x7f74d80053e0) at /data/src/10.3/sql/sql_select.cc:4323
#21 0x00005604e727a13e in handle_select (thd=0x7f74d8000d90, lex=0x7f74d8004b98, result=0x7f74d8013f78, setup_tables_done_option=0) at /data/src/10.3/sql/sql_select.cc:370
#22 0x00005604e7240804 in execute_sqlcom_select (thd=0x7f74d8000d90, all_tables=0x7f74d8012d50) at /data/src/10.3/sql/sql_parse.cc:6316
#23 0x00005604e7237011 in mysql_execute_command (thd=0x7f74d8000d90) at /data/src/10.3/sql/sql_parse.cc:3847
#24 0x00005604e7244b88 in mysql_parse (thd=0x7f74d8000d90, rawbuf=0x7f74d8012ab8 "SELECT * FROM t1 ORDER BY CASE 1 WHEN 1 THEN (IS_FREE_LOCK('x') DIV (1 << 2)) WHEN 2 THEN WEEKDAY(d) END", length=104, parser_state=0x7f74f41035c0, is_com_multi=false, is_next_command=false) at /data/src/10.3/sql/sql_parse.cc:7840
#25 0x00005604e72312ec in dispatch_command (command=COM_QUERY, thd=0x7f74d8000d90, packet=0x7f74d8008f11 "", packet_length=104, is_com_multi=false, is_next_command=false) at /data/src/10.3/sql/sql_parse.cc:1852
#26 0x00005604e722fc8c in do_command (thd=0x7f74d8000d90) at /data/src/10.3/sql/sql_parse.cc:1398
#27 0x00005604e73ae295 in do_handle_one_connection (connect=0x5604ea3d5070) at /data/src/10.3/sql/sql_connect.cc:1403
#28 0x00005604e73adff1 in handle_one_connection (arg=0x5604ea3d5070) at /data/src/10.3/sql/sql_connect.cc:1308
#29 0x00005604e7d7a027 in pfs_spawn_thread (arg=0x5604ea3b8440) at /data/src/10.3/storage/perfschema/pfs.cc:1869
#30 0x00007f74f9648609 in start_thread (arg=<optimized out>) at pthread_create.c:477
#31 0x00007f74f9224293 in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95
# Cleanup
10.3 75538f94
mysqld: /data/src/10.3/strings/decimal.c:1484: decimal_bin_size: Assertion `precision > 0' failed.
210127 1:38:12 [ERROR] mysqld got signal 6 ;
#7 0x00007f25b4ea2f36 in __GI___assert_fail (assertion=0x5594e9ff9525 "precision > 0", file=0x5594e9ff92a0 "/data/src/10.3/strings/decimal.c", line=1484, function=0x5594e9ff9790 <__PRETTY_FUNCTION__.14235> "decimal_bin_size") at assert.c:101
#8 0x00005594e9afd32f in decimal_bin_size (precision=0, scale=0) at /data/src/10.3/strings/decimal.c:1484
#9 0x00005594e8f86de9 in my_decimal_get_binary_size (precision=0, scale=0) at /data/src/10.3/sql/my_decimal.h:263
#10 0x00005594e91dfda1 in Field_new_decimal::Field_new_decimal (this=0x7f25940acc48, ptr_arg=0x0, len_arg=0, null_ptr_arg=0x5594e9b23233 "", null_bit_arg=0 '\000', unireg_check_arg=Field::NONE, field_name_arg=0x7f2594013e50, dec_arg=0 '\000', zero_arg=false, unsigned_arg=false) at /data/src/10.3/sql/field.cc:3137
#11 0x00005594e90f9f90 in Type_handler_newdecimal::make_table_field (this=0x5594ea348998 <type_handler_newdecimal>, name=0x7f2594013e50, addr=..., attr=..., table=0x7f25940390a8) at /data/src/10.3/sql/sql_type.cc:2206
#12 0x00005594e90f9645 in Type_handler::make_and_init_table_field (this=0x5594ea348998 <type_handler_newdecimal>, name=0x7f2594013e50, addr=..., attr=..., table=0x7f25940390a8) at /data/src/10.3/sql/sql_type.cc:2033
#13 0x00005594e8dde64d in Item::tmp_table_field_from_field_type (this=0x7f2594013e00, table=0x7f25940390a8) at /data/src/10.3/sql/item.h:707
#14 0x00005594e8ddfb4c in Item::create_tmp_field (this=0x7f2594013e00, group=false, table=0x7f25940390a8) at /data/src/10.3/sql/item.h:1948
#15 0x00005594e8f686f7 in create_tmp_field_from_item (thd=0x7f2594000d90, item=0x7f2594013e00, table=0x7f25940390a8, copy_func=0x7f25b0052f78, modify_item=true) at /data/src/10.3/sql/sql_select.cc:17117
#16 0x00005594e8f6907b in create_tmp_field (thd=0x7f2594000d90, table=0x7f25940390a8, item=0x7f2594013e00, type=Item::FUNC_ITEM, copy_func=0x7f25b0052f78, from_field=0x7f259403a1c0, default_field=0x7f259403a1a0, group=true, modify_item=true, table_cant_handle_bit_fields=false, make_copy_field=false) at /data/src/10.3/sql/sql_select.cc:17343
#17 0x00005594e8f6a5c3 in create_tmp_table (thd=0x7f2594000d90, param=0x7f2594016230, fields=..., group=0x7f25940134f8, distinct=false, save_sum_fields=false, select_options=2147748608, rows_limit=18446744073709551615, table_alias=0x5594ea20ef00 <empty_clex_str>, do_not_open=true, keep_row_order=false) at /data/src/10.3/sql/sql_select.cc:17723
#18 0x00005594e8f43b67 in JOIN::create_postjoin_aggr_table (this=0x7f2594014130, tab=0x7f2594015750, table_fields=0x7f2594014450, table_group=0x7f25940134f8, save_sum_fields=false, distinct=false, keep_row_order=false) at /data/src/10.3/sql/sql_select.cc:3432
#19 0x00005594e8f421b0 in JOIN::make_aggr_tables_info (this=0x7f2594014130) at /data/src/10.3/sql/sql_select.cc:3032
#20 0x00005594e8f40ba0 in JOIN::optimize_stage2 (this=0x7f2594014130) at /data/src/10.3/sql/sql_select.cc:2679
#21 0x00005594e8f3e5f0 in JOIN::optimize_inner (this=0x7f2594014130) at /data/src/10.3/sql/sql_select.cc:1985
#22 0x00005594e8f3c9c0 in JOIN::optimize (this=0x7f2594014130) at /data/src/10.3/sql/sql_select.cc:1501
#23 0x00005594e8f46b12 in mysql_select (thd=0x7f2594000d90, tables=0x7f2594012d70, wild_num=0, fields=..., conds=0x0, og_num=2, order=0x7f2594013fe0, group=0x7f25940134f8, having=0x0, proc_param=0x0, select_options=2147748608, result=0x7f2594014108, unit=0x7f2594004c58, select_lex=0x7f25940053e0) at /data/src/10.3/sql/sql_select.cc:4309
#24 0x00005594e8f3813e in handle_select (thd=0x7f2594000d90, lex=0x7f2594004b98, result=0x7f2594014108, setup_tables_done_option=0) at /data/src/10.3/sql/sql_select.cc:370
#25 0x00005594e8efe804 in execute_sqlcom_select (thd=0x7f2594000d90, all_tables=0x7f2594012d70) at /data/src/10.3/sql/sql_parse.cc:6316
#26 0x00005594e8ef5011 in mysql_execute_command (thd=0x7f2594000d90) at /data/src/10.3/sql/sql_parse.cc:3847
#27 0x00005594e8f02b88 in mysql_parse (thd=0x7f2594000d90, rawbuf=0x7f2594012ab8 "SELECT d FROM t1 GROUP BY d ORDER BY CASE 1 WHEN 1 THEN (IS_FREE_LOCK('x') DIV (1 << 2)) WHEN 2 THEN WEEKDAY(d) END", length=115, parser_state=0x7f25b00545c0, is_com_multi=false, is_next_command=false) at /data/src/10.3/sql/sql_parse.cc:7840
#28 0x00005594e8eef2ec in dispatch_command (command=COM_QUERY, thd=0x7f2594000d90, packet=0x7f2594008f11 "SELECT d FROM t1 GROUP BY d ORDER BY CASE 1 WHEN 1 THEN (IS_FREE_LOCK('x') DIV (1 << 2)) WHEN 2 THEN WEEKDAY(d) END", packet_length=115, is_com_multi=false, is_next_command=false) at /data/src/10.3/sql/sql_parse.cc:1852
#29 0x00005594e8eedc8c in do_command (thd=0x7f2594000d90) at /data/src/10.3/sql/sql_parse.cc:1398
#30 0x00005594e906c295 in do_handle_one_connection (connect=0x5594ec48d070) at /data/src/10.3/sql/sql_connect.cc:1403
#31 0x00005594e906bff1 in handle_one_connection (arg=0x5594ec48d070) at /data/src/10.3/sql/sql_connect.cc:1308
#32 0x00005594e9a38027 in pfs_spawn_thread (arg=0x5594ec470440) at /data/src/10.3/storage/perfschema/pfs.cc:1869
#33 0x00007f25b53b2609 in start_thread (arg=<optimized out>) at pthread_create.c:477
#34 0x00007f25b4f8e293 in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95
Unlike the test case in the description, both ones above don't fail on 10.2, but fail on 10.3+, including 10.5 and 10.6.