Bug #59527 decimal_bin_size: Assertion `scale >= 0 && precision > 0 && scale <= precision
Submitted: 15 Jan 2011 22:46 Modified: 19 Apr 2011 16:51
Reporter: Shane Bester (Platinum Quality Contributor) Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Data Types Severity:S1 (Critical)
Version:5.0.92-debug,5.1.56-debug,5.5.10-debug,5.6.2-debug OS:Any
Assigned to: CPU Architecture:Any

[15 Jan 2011 22:46] Shane Bester
Description:
mysqld: /home/sbester/build/bzr/mysql-trunk/strings/decimal.c:1440: decimal_bin_size: Assertion `scale >= 0 && precision > 0 && scale <= precision' failed.

                                                                  
(gdb) bt                                                          
#0  in raise (sig=6) at ../nptl/sysdeps/unix/sysv/linux/raise.c:64
#1  in abort () at abort.c:92                                     
#2  in __assert_fail at assert.c:81                               
#3  in decimal_bin_size at ./strings/decimal.c:1440               
#4  in my_decimal_get_binary_size at ./sql/my_decimal.h:261       
#5  in Field_new_decimal::Field_new_decimal at ./sql/field.cc:2516
#6  in Field_new_decimal::create_from_item at ./sql/field.cc:2560 
#7  in create_tmp_field_from_item at ./sql/sql_select.cc:14944    
#8  in create_tmp_field at ./sql/sql_select.cc:15156              
#9  in create_tmp_table  at ./sql/sql_select.cc:15502             
#10 in JOIN::optimize at ./sql/sql_select.cc:2522                 
#11 in mysql_select  at ./sql/sql_select.cc:3540                  
#12 in handle_select at ./sql/sql_select.cc:323                   
#13 in execute_sqlcom_select at ./sql/sql_parse.cc:4513           
#14 in mysql_execute_command at ./sql/sql_parse.cc:2096           
#15 in mysql_parse at ./sql/sql_parse.cc:5550                     
#16 in dispatch_command at ./sql/sql_parse.cc:1078                
#17 in do_command at ./sql/sql_parse.cc:815                       
#18 in do_handle_one_connection at ./sql/sql_connect.cc:748       
#19 in handle_one_connection at ./sql/sql_connect.cc:684          
#20 in start_thread                                               
#21 in clone                                                      

How to repeat:
drop table if exists `t1`;
create table `t1`(`a` decimal(1,1)unsigned)engine=myisam;
insert into `t1` values (0.2),(0.1);
select 1 from `t1` group by 
@a:=(select round(`a`) from `t1` where @`a`=`a`);
[19 Apr 2011 16:51] Paul DuBois
Noted in 5.1.57, 5.5.12, 5.6.3 changelogs.

A missing variable initialization for Item_func_set_user_var objects
could cause an assertion to be raised.

CHANGESET - http://lists.mysql.com/commits/133978