Bug #3704 charset conversion doesn't fix fields for function items
Submitted: 10 May 2004 22:07 Modified: 11 May 2004 17:33
Reporter: Timothy Smith Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server Severity:S2 (Serious)
Version:4.1.2 OS:Any (any)
Assigned to: Timothy Smith CPU Architecture:Any

[10 May 2004 22:07] Timothy Smith
Description:
Assertion failure in Item_func_conv_charset::val_str().  The field should be fixed, but isn't.

Here's a backtrace:

(gdb) bt
#0  0x28455dcf in kill () from /lib/libc.so.5
#1  0x2844a878 in raise () from /lib/libc.so.5
#2  0x284c2f82 in abort () from /lib/libc.so.5
#3  0x284993ef in __assert () from /lib/libc.so.5
#4  0x0808bdf5 in Item_func_conv_charset::val_str(String*) (this=0x82e9421, 
    str=0x0) at item_strfunc.cc:2145
#5  0x08077e05 in Arg_comparator::compare_string() (this=0x9146308)
    at item_cmpfunc.cc:324
#6  0x08078a37 in Item_func_eq::val_int() (this=0x91462a8) at item_cmpfunc.h:63
#7  0x081214e0 in make_join_select (join=0x9146370, select=0x9147180, 
    cond=0x91462a8) at sql_select.cc:3442
#8  0x08119a54 in JOIN::optimize() (this=0x9146370) at sql_select.cc:644
#9  0x0811c848 in mysql_select(THD*, Item***, st_table_list*, unsigned, List<Item>&, Item*, unsigned, st_order*, st_order*, Item*, st_order*, unsigned long, select_result*, st_select_lex_unit*, st_select_lex*) (thd=0x9138018, 
    rref_pointer_array=0x91381f4, tables=0x91460e8, wild_num=0, fields=@0x0, 
    conds=0x91462a8, og_num=0, order=0x0, group=0x0, having=0x0, 
    proc_param=0x0, select_options=8669696, result=0x9146360, unit=0x9138034, 
    select_lex=0x913810c) at sql_select.cc:1611
#10 0x081188e7 in handle_select(THD*, st_lex*, select_result*) (thd=0x9138018, 
    lex=0x9138028, result=0x9146360) at sql_select.cc:181
#11 0x080eecf3 in mysql_execute_command(THD*) (thd=0x9138018)
    at sql_parse.cc:1955
#12 0x080f413b in mysql_parse(THD*, char*, unsigned) (thd=0x9138018, 
    inBuf=0x9146028 "select 1 from t1 where CONCAT(_latin1't') = t", 
    length=152272936) at sql_parse.cc:3877
#13 0x080ed760 in dispatch_command(enum_server_command, THD*, char*, unsigned)
    (command=COM_QUERY, thd=0x9138018, 
    packet=0x913a019 "select 1 from t1 where CONCAT(_latin1't') = t", 
    packet_length=46) at sql_parse.cc:1450
#14 0x080ed072 in do_command(THD*) (thd=0x9138018) at sql_parse.cc:1266
#15 0x080ec588 in handle_one_connection (arg=0x0) at sql_parse.cc:1016
#16 0x283f050e in _thread_start () from /usr/lib/libc_r.so.5

How to repeat:
SET NAMES UTF8;
CREATE TABLE t1 (t text) DEFAULT CHARSET UTF8;
INSERT INTO t1 (t) VALUES ('x');
SELECT 1 FROM t1 WHERE CONCAT(_latin1'x') = t;

Suggested fix:
Call Item_func_conv_charset::fix_fields in Item_bool_func2::fix_length_and_dec().
[11 May 2004 17:33] Timothy Smith
Thank you for your bug report. This issue has been committed to our
source repository of that product and will be incorporated into the
next release.

If necessary, you can access the source repository and build the latest
available version, including the bugfix, yourself. More information 
about accessing the source trees is available at
    http://www.mysql.com/doc/en/Installing_source_tree.html