[MDEV-14613] Assertion `fixed == 0' failed in Item_func::fix_fields Created: 2017-12-10  Updated: 2017-12-20  Resolved: 2017-12-20

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

Type: Bug Priority: Major
Reporter: Elena Stepanova Assignee: Oleksandr Byelkin
Resolution: Fixed Votes: 0
Labels: None

Sprint: 10.2.12

 Description   

Filed on behalf of jbrauge:

--source include/have_innodb.inc
 
CREATE TABLE `gtfmt` (
  `numgtfmt` char(10) COLLATE utf8_bin NOT NULL 
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
 
create or replace view gtfmtl(numgtfmt)
as
select 'x' from gtfmt
union
select 'x' from gtfmt ;
 
SELECT * FROM gtfmtl WHERE numgtfmt =  NAME_CONST('wnumgtfmt',_utf8'QEDITIONS' COLLATE 'utf8_bin');
 
# Cleanup
DROP VIEW gtfmtl;
DROP TABLE gtfmt;

10.2 0af52734a790b

mysqld: /data/src/10.2/sql/item_func.cc:179: virtual bool Item_func::fix_fields(THD*, Item**): Assertion `fixed == 0' failed.
171211  0:20:34 [ERROR] mysqld got signal 6 ;
 
#7  0x00007f8c3568aee2 in __assert_fail () from /lib/x86_64-linux-gnu/libc.so.6
#8  0x00005628b02e6a65 in Item_func::fix_fields (this=0x7f8bd8013138, thd=0x7f8bd8000b00, ref=0x7f8bd8034b00) at /data/src/10.2/sql/item_func.cc:179
#9  0x00005628b0318595 in Item_str_func::fix_fields (this=0x7f8bd8013138, thd=0x7f8bd8000b00, ref=0x7f8bd8034b00) at /data/src/10.2/sql/item_strfunc.cc:106
#10 0x00005628b028862e in Item_name_const::fix_fields (this=0x7f8bd8034a80, thd=0x7f8bd8000b00, ref=0x7f8bd80347c8) at /data/src/10.2/sql/item.cc:1817
#11 0x00005628b02e6ba3 in Item_func::fix_fields (this=0x7f8bd8034730, thd=0x7f8bd8000b00, ref=0x7f8bd80174b0) at /data/src/10.2/sql/item_func.cc:210
#12 0x00005628b0040591 in JOIN::optimize_inner (this=0x7f8bd80170a8) at /data/src/10.2/sql/sql_select.cc:1297
#13 0x00005628b003fa89 in JOIN::optimize (this=0x7f8bd80170a8) at /data/src/10.2/sql/sql_select.cc:1085
#14 0x00005628b00e54a2 in st_select_lex_unit::optimize (this=0x7f8bd8013740) at /data/src/10.2/sql/sql_union.cc:919
#15 0x00005628affd07d2 in mysql_derived_optimize (thd=0x7f8bd8000b00, lex=0x7f8bd80045d8, derived=0x7f8bd8012768) at /data/src/10.2/sql/sql_derived.cc:886
#16 0x00005628affcf0c7 in mysql_handle_single_derived (lex=0x7f8bd80045d8, derived=0x7f8bd8012768, phases=4) at /data/src/10.2/sql/sql_derived.cc:197
#17 0x00005628b004083c in JOIN::optimize_inner (this=0x7f8bd80169b0) at /data/src/10.2/sql/sql_select.cc:1337
#18 0x00005628b003fa89 in JOIN::optimize (this=0x7f8bd80169b0) at /data/src/10.2/sql/sql_select.cc:1085
#19 0x00005628b0048ab4 in mysql_select (thd=0x7f8bd8000b00, tables=0x7f8bd8012768, wild_num=1, fields=..., conds=0x7f8bd8013310, og_num=0, order=0x0, group=0x0, having=0x0, proc_param=0x0, select_options=2147748608, result=0x7f8bd8016990, unit=0x7f8bd80046a0, select_lex=0x7f8bd8004dd8) at /data/src/10.2/sql/sql_select.cc:3695
#20 0x00005628b003d3a8 in handle_select (thd=0x7f8bd8000b00, lex=0x7f8bd80045d8, result=0x7f8bd8016990, setup_tables_done_option=0) at /data/src/10.2/sql/sql_select.cc:373
#21 0x00005628b00094a0 in execute_sqlcom_select (thd=0x7f8bd8000b00, all_tables=0x7f8bd8012768) at /data/src/10.2/sql/sql_parse.cc:6455
#22 0x00005628affff4a3 in mysql_execute_command (thd=0x7f8bd8000b00) at /data/src/10.2/sql/sql_parse.cc:3462
#23 0x00005628b000ce62 in mysql_parse (thd=0x7f8bd8000b00, rawbuf=0x7f8bd80124e8 "SELECT * FROM gtfmtl WHERE numgtfmt =  NAME_CONST('wnumgtfmt',_utf8'QEDITIONS' COLLATE 'utf8_bin')", length=98, parser_state=0x7f8c30167200, is_com_multi=false, is_next_command=false) at /data/src/10.2/sql/sql_parse.cc:7896
#24 0x00005628afffad94 in dispatch_command (command=COM_QUERY, thd=0x7f8bd8000b00, packet=0x7f8bd808d211 "SELECT * FROM gtfmtl WHERE numgtfmt =  NAME_CONST('wnumgtfmt',_utf8'QEDITIONS' COLLATE 'utf8_bin')", packet_length=98, is_com_multi=false, is_next_command=false) at /data/src/10.2/sql/sql_parse.cc:1805
#25 0x00005628afff96f2 in do_command (thd=0x7f8bd8000b00) at /data/src/10.2/sql/sql_parse.cc:1360
#26 0x00005628b0147169 in do_handle_one_connection (connect=0x5628b3969000) at /data/src/10.2/sql/sql_connect.cc:1354
#27 0x00005628b0146ef6 in handle_one_connection (arg=0x5628b3969000) at /data/src/10.2/sql/sql_connect.cc:1260
#28 0x00005628b056588e in pfs_spawn_thread (arg=0x5628b38cc950) at /data/src/10.2/storage/perfschema/pfs.cc:1863
#29 0x00007f8c37361494 in start_thread (arg=0x7f8c30168700) at pthread_create.c:333
#30 0x00007f8c3574793f in clone () from /lib/x86_64-linux-gnu/libc.so.6



 Comments   
Comment by Oleksandr Byelkin [ 2017-12-20 ]

fix_fields() inside Item_name_const::fix_fields called without check of 'fixed', which broke existing protocol of prepare

Comment by Oleksandr Byelkin [ 2017-12-20 ]

revision-id: eb1404238346405edc51b0b916a8e0650f061cf0 (mariadb-10.2.11-55-geb140423834)
parent(s): 8d70097c216081e8013a548bfbde156e48985816
author: Oleksandr Byelkin
committer: Oleksandr Byelkin
timestamp: 2017-12-20 16:52:02 +0100
message:

MDEV-14613: Assertion `fixed == 0' failed in Item_func::fix_fields

fix_fields calls fixed.

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