[MDEV-15873] Assertion `precision > 0' failed in decimal_bin_size upon EXPLAIN with combination of functions Created: 2018-04-15  Updated: 2023-08-24  Resolved: 2023-08-24

Status: Closed
Project: MariaDB Server
Component/s: Optimizer
Affects Version/s: 10.2
Fix Version/s: N/A

Type: Bug Priority: Major
Reporter: Elena Stepanova Assignee: Alexey Botchkov
Resolution: Won't Fix Votes: 0
Labels: None

Issue Links:
Relates
relates to MDEV-17759 Assertion `precision > 0' failed in d... Closed
relates to MDEV-20560 Assertion `precision > 0' failed in d... Closed
relates to MDEV-20754 Assertion `precision > 0' failed in d... Confirmed
relates to MDEV-21789 Assertion `precision > 0' failed in d... Closed
relates to MDEV-11015 Assertion failed: precision > 0 in de... Closed

 Description   

CREATE TABLE t (a INT);
EXPLAIN SELECT GROUP_CONCAT( IF( a=0, CAST( GET_LOCK( 'lck', 0 ) AS UNSIGNED ), IS_FREE_LOCK( 'lck' ) ) ) AS f FROM t;
 
# Cleanup
DROP TABLE t;

10.2 47ea2227e56

mysqld: /data/src/10.2/strings/decimal.c:1466: decimal_bin_size: Assertion `precision > 0' failed.
180416  2:03:09 [ERROR] mysqld got signal 6 ;
 
#7  0x00007f4501187ee2 in __assert_fail () from /lib/x86_64-linux-gnu/libc.so.6
#8  0x00005593c5aac72e in decimal_bin_size (precision=0, scale=0) at /data/src/10.2/strings/decimal.c:1466
#9  0x00005593c5111396 in my_decimal_get_binary_size (precision=0, scale=0) at /data/src/10.2/sql/my_decimal.h:263
#10 0x00005593c52d2a4b in Field_new_decimal::Field_new_decimal (this=0x7f44e000c438, len_arg=0, maybe_null_arg=true, name=0x0, dec_arg=0 '\000', unsigned_arg=false) at /data/src/10.2/sql/field.cc:3011
#11 0x00005593c52d2bb7 in Field_new_decimal::create_from_item (mem_root=0x7f44e0150020, item=0x7f44e0012e58) at /data/src/10.2/sql/field.cc:3056
#12 0x00005593c50f5841 in Item::create_tmp_field (this=0x7f44e0012e58, group=false, table=0x7f44e014f568, convert_int_length=9) at /data/src/10.2/sql/sql_select.cc:16161
#13 0x00005593c4fc8d53 in Item::create_tmp_field (this=0x7f44e0012e58, group=false, table=0x7f44e014f568) at /data/src/10.2/sql/item.h:1771
#14 0x00005593c50f5946 in create_tmp_field_from_item (thd=0x7f44e0000b00, item=0x7f44e0012e58, table=0x7f44e014f568, copy_func=0x7f44fc407818, modify_item=true) at /data/src/10.2/sql/sql_select.cc:16205
#15 0x00005593c50f60af in create_tmp_field (thd=0x7f44e0000b00, table=0x7f44e014f568, item=0x7f44e0012e58, type=Item::FUNC_ITEM, copy_func=0x7f44fc407818, from_field=0x7f44e01505f8, default_field=0x7f44e01505e8, group=false, modify_item=true, table_cant_handle_bit_fields=false, make_copy_field=false) at /data/src/10.2/sql/sql_select.cc:16425
#16 0x00005593c50f74ee in create_tmp_table (thd=0x7f44e0000b00, param=0x7f44e0015ce0, fields=..., group=0x0, distinct=false, save_sum_fields=true, select_options=2147748612, rows_limit=18446744073709551615, table_alias=0x5593c5bf7dfe "", do_not_open=false, keep_row_order=false) at /data/src/10.2/sql/sql_select.cc:16813
#17 0x00005593c53e1b75 in Item_func_group_concat::setup (this=0x7f44e0012f88, thd=0x7f44e0000b00) at /data/src/10.2/sql/item_sum.cc:3645
#18 0x00005593c53e2776 in Aggregator_simple::setup (this=0x7f44e0015cd0, thd=0x7f44e0000b00) at /data/src/10.2/sql/item_sum.h:705
#19 0x00005593c5112a2c in Item_sum::aggregator_setup (this=0x7f44e0012f88, thd=0x7f44e0000b00) at /data/src/10.2/sql/item_sum.h:540
#20 0x00005593c5108361 in setup_sum_funcs (thd=0x7f44e0000b00, func_ptr=0x7f44e0014948) at /data/src/10.2/sql/sql_select.cc:23529
#21 0x00005593c50d33f1 in JOIN::make_aggr_tables_info (this=0x7f44e00141a8) at /data/src/10.2/sql/sql_select.cc:2762
#22 0x00005593c50d0fdd in JOIN::optimize_inner (this=0x7f44e00141a8) at /data/src/10.2/sql/sql_select.cc:2187
#23 0x00005593c50cd491 in JOIN::optimize (this=0x7f44e00141a8) at /data/src/10.2/sql/sql_select.cc:1113
#24 0x00005593c50d65b8 in mysql_select (thd=0x7f44e0000b00, tables=0x7f44e0013438, wild_num=0, fields=..., conds=0x0, og_num=0, order=0x0, group=0x0, having=0x0, proc_param=0x0, select_options=2147748612, result=0x7f44e0013b28, unit=0x7f44e00046a8, select_lex=0x7f44e0004de0) at /data/src/10.2/sql/sql_select.cc:3747
#25 0x00005593c510cd4a in mysql_explain_union (thd=0x7f44e0000b00, unit=0x7f44e00046a8, result=0x7f44e0013b28) at /data/src/10.2/sql/sql_select.cc:25071
#26 0x00005593c5096657 in execute_sqlcom_select (thd=0x7f44e0000b00, all_tables=0x7f44e0013438) at /data/src/10.2/sql/sql_parse.cc:6411
#27 0x00005593c508ca99 in mysql_execute_command (thd=0x7f44e0000b00) at /data/src/10.2/sql/sql_parse.cc:3483
#28 0x00005593c509a496 in mysql_parse (thd=0x7f44e0000b00, rawbuf=0x7f44e00124f8 "EXPLAIN SELECT GROUP_CONCAT( IF( a=0, CAST( GET_LOCK( 'lck', 0 ) AS UNSIGNED ), IS_FREE_LOCK( 'lck' ) ) ) AS f FROM t", length=117, parser_state=0x7f44fc409200, is_com_multi=false, is_next_command=false) at /data/src/10.2/sql/sql_parse.cc:7924
#29 0x00005593c508832b in dispatch_command (command=COM_QUERY, thd=0x7f44e0000b00, packet=0x7f44e01471a1 "", packet_length=117, is_com_multi=false, is_next_command=false) at /data/src/10.2/sql/sql_parse.cc:1820
#30 0x00005593c5086c8e in do_command (thd=0x7f44e0000b00) at /data/src/10.2/sql/sql_parse.cc:1374
#31 0x00005593c51d563e in do_handle_one_connection (connect=0x5593c7648130) at /data/src/10.2/sql/sql_connect.cc:1335
#32 0x00005593c51d53cb in handle_one_connection (arg=0x5593c7648130) at /data/src/10.2/sql/sql_connect.cc:1241
#33 0x00005593c55f55b6 in pfs_spawn_thread (arg=0x5593c75a7010) at /data/src/10.2/storage/perfschema/pfs.cc:1862
#34 0x00007f4502e5e494 in start_thread (arg=0x7f44fc40a700) at pthread_create.c:333
#35 0x00007f450124493f in clone () from /lib/x86_64-linux-gnu/libc.so.6

Reproducible on 10.2.
Can't reproduce neither on 10.1 nor, strangely, on 10.3.
No obvious problem on a release or non-debug-ASAN build.



 Comments   
Comment by Elena Stepanova [ 2023-08-24 ]

10.2 is EOL

Generated at Thu Feb 08 08:24:40 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.