1 message in com.mysql.lists.bugsImportant bug fix for Innobase non-la...
FromSent OnAttachments
Heikki Tuuri19 Mar 2001 05:03 
Subject:Important bug fix for Innobase non-latin1 character sets
From:Heikki Tuuri (Heik@innobase.inet.fi)
Date:03/19/2001 05:03:32 AM
List:com.mysql.lists.bugs

Readers of the mailing list!

There is a serious bug in the non-latin1 character set support of Innobase. The bug causes indexes to be sorted in a wrong order, and queries to return wrong results. The bug explains why test-ATIS returned wrong results in a Russian installation.

I assumed that the function my_sortncmp returns -1, 0, or 1, but actually it returns a difference of ASCII codes for characters.

You can fix the bug by editing the file mysql/sql/ha_innobase.cc, function innobase_mysql_cmp, about line 920, and recompiling. The function should be like the following:

........snip........

extern "C" { /***************************************************************** Innobase uses this function is to compare two data fields for which the data type is such that we must use MySQL code to compare them. NOTE that the prototype of this function is in rem0cmp.c in Innobase source code! If you change this function, remember to update the prototype there! */

int innobase_mysql_cmp( /*===============*/ /* out: 1, 0, -1, if a is greater, equal, less than b, respectively */ int mysql_type, /* in: MySQL type */ unsigned char* a, /* in: data field */ unsigned int a_length, /* in: data field length, not UNIV_SQL_NULL */ unsigned char* b, /* in: data field */ unsigned int b_length) /* in: data field length, not UNIV_SQL_NULL */ { enum_field_types mysql_tp; int ret;

dbug_assert(a_length != UNIV_SQL_NULL); dbug_assert(b_length != UNIV_SQL_NULL);

mysql_tp = (enum_field_types) mysql_type;

switch (mysql_tp) {

case FIELD_TYPE_STRING: case FIELD_TYPE_VAR_STRING: ret = my_sortncmp((const char*) a, a_length, (const char*) b, b_length); if (ret < 0) { return(-1); } else if (ret > 0) { return(1); } else { return(0); } default: assert(0); }

return(0); } }

.......snip..........

Regards,