[MDEV-10425] Assertion `collation.derivation == DERIVATION_IMPLICIT' failed in Item_func_conv_charset::fix_length_and_dec() Created: 2016-07-24  Updated: 2016-11-15  Resolved: 2016-09-22

Status: Closed
Project: MariaDB Server
Component/s: Character Sets
Affects Version/s: 10.1
Fix Version/s: 10.1.18, 10.2.3

Type: Bug Priority: Major
Reporter: Elena Stepanova Assignee: Alexander Barkov
Resolution: Fixed Votes: 0
Labels: None

Sprint: 10.1.18

 Description   

PREPARE stmt FROM "SELECT SHA2(CONVERT('foo' USING latin1), 224)";
EXECUTE stmt;

Stack trace from 10.1 commit a52d3aa831

mysqld: /data/src/10.1/sql/item_strfunc.cc:3417: virtual void Item_func_conv_charset::fix_length_and_dec(): Assertion `collation.derivation == DERIVATION_IMPLICIT' failed.
160724 17:22:05 [ERROR] mysqld got signal 6 ;
 
#6  0x00007f61e4c26266 in __assert_fail_base (fmt=0x7f61e4d5f238 "%s%s%s:%u: %s%sAssertion `%s' failed.\n%n", assertion=assertion@entry=0x7f61e7e07198 "collation.derivation == DERIVATION_IMPLICIT", file=file@entry=0x7f61e7e07038 "/data/src/10.1/sql/item_strfunc.cc", line=line@entry=3417, function=function@entry=0x7f61e7e085c0 <Item_func_conv_charset::fix_length_and_dec()::__PRETTY_FUNCTION__> "virtual void Item_func_conv_charset::fix_length_and_dec()") at assert.c:92
#7  0x00007f61e4c26312 in __GI___assert_fail (assertion=0x7f61e7e07198 "collation.derivation == DERIVATION_IMPLICIT", file=0x7f61e7e07038 "/data/src/10.1/sql/item_strfunc.cc", line=3417, function=0x7f61e7e085c0 <Item_func_conv_charset::fix_length_and_dec()::__PRETTY_FUNCTION__> "virtual void Item_func_conv_charset::fix_length_and_dec()") at assert.c:101
#8  0x00007f61e76fa9c7 in Item_func_conv_charset::fix_length_and_dec (this=0x7f61db999660) at /data/src/10.1/sql/item_strfunc.cc:3417
#9  0x00007f61e76c6a73 in Item_func::fix_fields (this=0x7f61db999660, thd=0x7f61ddbfa070, ref=0x7f61db999900) at /data/src/10.1/sql/item_func.cc:234
#10 0x00007f61e76eed8b in Item_str_func::fix_fields (this=0x7f61db999660, thd=0x7f61ddbfa070, ref=0x7f61db999900) at /data/src/10.1/sql/item_strfunc.cc:106
#11 0x00007f61e76c683f in Item_func::fix_fields (this=0x7f61db999878, thd=0x7f61ddbfa070, ref=0x7f61db999958) at /data/src/10.1/sql/item_func.cc:208
#12 0x00007f61e76eed8b in Item_str_func::fix_fields (this=0x7f61db999878, thd=0x7f61ddbfa070, ref=0x7f61db999958) at /data/src/10.1/sql/item_strfunc.cc:106
#13 0x00007f61e73cf3ad in setup_fields (thd=0x7f61ddbfa070, ref_pointer_array=0x7f61db9999f8, fields=..., mark_used_columns=MARK_COLUMNS_READ, sum_func_list=0x7f61db8e2598, allow_sum_func=true) at /data/src/10.1/sql/sql_base.cc:7901
#14 0x00007f61e7466d7a in JOIN::prepare (this=0x7f61db8e2238, rref_pointer_array=0x7f61db998ad0, tables_init=0x0, 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=0x7f61db998858, unit_arg=0x7f61db998158) at /data/src/10.1/sql/sql_select.cc:795
#15 0x00007f61e7470485 in mysql_select (thd=0x7f61ddbfa070, rref_pointer_array=0x7f61db998ad0, tables=0x0, wild_num=0, fields=..., conds=0x0, og_num=0, order=0x0, group=0x0, having=0x0, proc_param=0x0, select_options=2416184064, result=0x7f61db9999d8, unit=0x7f61db998158, select_lex=0x7f61db998858) at /data/src/10.1/sql/sql_select.cc:3415
#16 0x00007f61e746602c in handle_select (thd=0x7f61ddbfa070, lex=0x7f61db998090, result=0x7f61db9999d8, setup_tables_done_option=0) at /data/src/10.1/sql/sql_select.cc:384
#17 0x00007f61e7436382 in execute_sqlcom_select (thd=0x7f61ddbfa070, all_tables=0x0) at /data/src/10.1/sql/sql_parse.cc:5894
#18 0x00007f61e742c28f in mysql_execute_command (thd=0x7f61ddbfa070) at /data/src/10.1/sql/sql_parse.cc:2960
#19 0x00007f61e7453ec6 in Prepared_statement::execute (this=0x7f61dbb44470, expanded_query=0x7f61e8382a10, open_cursor=false) at /data/src/10.1/sql/sql_prepare.cc:4269
#20 0x00007f61e7452d37 in Prepared_statement::execute_loop (this=0x7f61dbb44470, expanded_query=0x7f61e8382a10, open_cursor=false, packet=0x0, packet_end=0x0) at /data/src/10.1/sql/sql_prepare.cc:3901
#21 0x00007f61e7450dcf in mysql_sql_stmt_execute (thd=0x7f61ddbfa070) at /data/src/10.1/sql/sql_prepare.cc:3033
#22 0x00007f61e742c2c0 in mysql_execute_command (thd=0x7f61ddbfa070) at /data/src/10.1/sql/sql_parse.cc:2971
#23 0x00007f61e7439aba in mysql_parse (thd=0x7f61ddbfa070, rawbuf=0x7f61db8e2088 "EXECUTE stmt", length=12, parser_state=0x7f61e83835e0) at /data/src/10.1/sql/sql_parse.cc:7314
#24 0x00007f61e74284e4 in dispatch_command (command=COM_QUERY, thd=0x7f61ddbfa070, packet=0x7f61df53e071 "EXECUTE stmt", packet_length=12) at /data/src/10.1/sql/sql_parse.cc:1486
#25 0x00007f61e742721b in do_command (thd=0x7f61ddbfa070) at /data/src/10.1/sql/sql_parse.cc:1107
#26 0x00007f61e755ce45 in do_handle_one_connection (thd_arg=0x7f61ddbfa070) at /data/src/10.1/sql/sql_connect.cc:1350
#27 0x00007f61e755cba9 in handle_one_connection (arg=0x7f61ddbfa070) at /data/src/10.1/sql/sql_connect.cc:1262
#28 0x00007f61e783e0fa in pfs_spawn_thread (arg=0x7f61e4027ef0) at /data/src/10.1/storage/perfschema/pfs.cc:1860
#29 0x00007f61e6b280a4 in start_thread (arg=0x7f61e8384b00) at pthread_create.c:309
#30 0x00007f61e4ce087d in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:111

10.2 is also affected.
Not reproducible on 5.5, 10.0.
Nothing bad seems to happen on a release build.



 Comments   
Comment by Alexander Barkov [ 2016-09-21 ]

The same problem is repeatable for:

PREPARE stmt FROM "SELECT SHA(CONVERT('foo' USING latin1))";
EXECUTE stmt;

PREPARE stmt FROM "SELECT MD5(CONVERT('foo' USING latin1))";
EXECUTE stmt;

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