Description:
The query below crashes mysqld with the following assertion
mysqld: my_decimal.h:207: uint32 my_decimal_precision_to_length_no_truncation(uint, uint8, bool): Assertion `precision || !scale' failed.
backtrace:
#8 0x00897de8 in __assert_fail () from /lib/libc.so.6
#9 0x081b95d4 in my_decimal_precision_to_length_no_truncation (precision=0, scale=31 '\037', unsigned_flag=false) at my_decimal.h:207
#10 0x081e9ba8 in Item_func_case::fix_length_and_dec (this=0xad200c50) at item_cmpfunc.cc:2992
#11 0x081cbbaa in Item_func::fix_fields (this=0xad200c50, thd=0xa62e0d0, ref=0xad200d34) at item_func.cc:218
#12 0x081e9618 in Item_func_case::fix_fields (this=0xad200c50, thd=0xa62e0d0, ref=0xad200d34) at item_cmpfunc.cc:2881
#13 0x082d0b30 in setup_fields (thd=0xa62e0d0, ref_pointer_array=0xad2045c0, fields=..., mark_used_columns=MARK_COLUMNS_READ, sum_func_list=0xad20239c,
allow_sum_func=true) at sql_base.cc:7704
#14 0x082e1ef5 in JOIN::prepare (this=0xad201280, rref_pointer_array=0xa62f5cc, tables_init=0xad200e60, wild_num=0, conds_init=0x0, og_num=0,
order_init=0x0, group_init=0x0, having_init=0x0, proc_param_init=0x0, select_lex_arg=0xa62f4d4, unit_arg=0xa62f0a8) at sql_select.cc:536
#15 0x082e8c29 in mysql_select (thd=0xa62e0d0, rref_pointer_array=0xa62f5cc, tables=0xad200e60, wild_num=0, fields=..., conds=0x0, og_num=0, order=0x0,
group=0x0, having=0x0, proc_param=0x0, select_options=2147748608, result=0xad201270, unit=0xa62f0a8, select_lex=0xa62f4d4) at sql_select.cc:2528
#16 0x082e17f1 in handle_select (thd=0xa62e0d0, lex=0xa62f048, result=0xad201270, setup_tables_done_option=0) at sql_select.cc:290
#17 0x0827f275 in execute_sqlcom_select (thd=0xa62e0d0, all_tables=0xad200e60) at sql_parse.cc:4882
#18 0x0827709b in mysql_execute_command (thd=0xa62e0d0) at sql_parse.cc:2329
#19 0x08281079 in mysql_parse (thd=0xa62e0d0,
inBuf=0xad200588 "SELECT ( CASE WHEN f4 THEN ( GREATEST ( f2 , ( f4 <> f2 ) ) ) WHEN f4 THEN f4 END ) FROM t1", length=100,
parser_state=0xb6e44d30) at sql_parse.cc:5911
#20 0x08274a47 in dispatch_command (command=COM_QUERY, thd=0xa62e0d0,
packet=0xa6b4b21 "SELECT ( CASE WHEN f4 THEN ( GREATEST ( f2 , ( f4 <> f2 ) ) ) WHEN f4 THEN f4 END ) FROM t1", packet_length=100)
at sql_parse.cc:1135
#21 0x08273f06 in do_command (thd=0xa62e0d0) at sql_parse.cc:807
#22 0x0827228a in do_handle_one_connection (thd_arg=0xa62e0d0) at sql_connect.cc:1196
#23 0x0827213f in handle_one_connection (arg=0xa62e0d0) at sql_connect.cc:1135
#24 0x085dfaf6 in pfs_spawn_thread (arg=0xa6a3998) at pfs.cc:1015
#25 0x00a08919 in start_thread () from /lib/libpthread.so.0
#26 0x00951e5e in clone () from /lib/libc.so.6
bzr version-info:
revision-id: sunanda.menon@sun.com-20100623083133-m89mnt4ivnpzqzny
date: 2010-06-23 10:31:33 +0200
build-date: 2010-07-09 05:43:15 -0700
revno: 3072
branch-nick: mysql-server
How to repeat:
CREATE TABLE t1 (
f2 VARCHAR (2) ,
f4 INT
);
SELECT (
CASE
WHEN f4 THEN ( GREATEST ( f2 , ( f4 <> f2 ) ) )
WHEN f4 THEN f4 END
)
FROM t1;