Commit f76beb08 authored by Alexander Barkov's avatar Alexander Barkov

MDEV-5241: Collation incompatibilities with MySQL-5.6

A clean-up: removing the code catching collation incompatibilities
from handler::check_collation_compatibility(), as the collation IDs
are already replaced at this point by TABLE_SHARE::init_from_binary_frm_image.
parent 192678e7
......@@ -3534,39 +3534,6 @@ bool handler::get_error_message(int error, String* buf)
return FALSE;
}
/**
Check if a collation has changed number
@param mysql_version
@param current collation number
@retval new collation number (same as current collation number of no change)
*/
uint upgrade_collation(ulong mysql_version, uint cs_number)
{
if (mysql_version >= 50300 && mysql_version <= 50399)
{
switch (cs_number) {
case 149: return MY_PAGE2_COLLATION_ID_UCS2; // ucs2_crotian_ci
case 213: return MY_PAGE2_COLLATION_ID_UTF8; // utf8_crotian_ci
}
}
if ((mysql_version >= 50500 && mysql_version <= 50599) ||
(mysql_version >= 100000 && mysql_version <= 100005))
{
switch (cs_number) {
case 149: return MY_PAGE2_COLLATION_ID_UCS2; // ucs2_crotian_ci
case 213: return MY_PAGE2_COLLATION_ID_UTF8; // utf8_crotian_ci
case 214: return MY_PAGE2_COLLATION_ID_UTF32; // utf32_croatian_ci
case 215: return MY_PAGE2_COLLATION_ID_UTF16; // utf16_croatian_ci
case 245: return MY_PAGE2_COLLATION_ID_UTF8MB4;// utf8mb4_croatian_ci
}
}
return cs_number;
}
/**
Check for incompatible collation changes.
......@@ -3611,25 +3578,6 @@ int handler::check_collation_compatibility()
}
}
if (mysql_version < 100006)
{
/*
Check if we are using collations from that has changed numbering.
This happend at least between MariaDB 5.5 and MariaDB 10.0 as MySQL
added conflicting numbers.
*/
if (table->s->table_charset->number !=
upgrade_collation(mysql_version, table->s->table_charset->number))
return HA_ADMIN_NEEDS_ALTER;
for (Field **field= table->field; (*field); field++)
{
if ((*field)->charset()->number !=
upgrade_collation(mysql_version, (*field)->charset()->number))
return HA_ADMIN_NEEDS_ALTER;
}
}
return 0;
}
......
......@@ -4055,5 +4055,4 @@ inline const char *table_case_name(HA_CREATE_INFO *info, const char *name)
void print_keydup_error(TABLE *table, KEY *key, const char *msg, myf errflag);
void print_keydup_error(TABLE *table, KEY *key, myf errflag);
uint upgrade_collation(ulong mysql_version, uint cs_number);
#endif
......@@ -832,6 +832,42 @@ static bool create_key_infos(const uchar *strpos, const uchar *frm_image_end,
}
/**
Check if a collation has changed number
@param mysql_version
@param current collation number
@retval new collation number (same as current collation number of no change)
*/
static uint
upgrade_collation(ulong mysql_version, uint cs_number)
{
if (mysql_version >= 50300 && mysql_version <= 50399)
{
switch (cs_number) {
case 149: return MY_PAGE2_COLLATION_ID_UCS2; // ucs2_crotian_ci
case 213: return MY_PAGE2_COLLATION_ID_UTF8; // utf8_crotian_ci
}
}
if ((mysql_version >= 50500 && mysql_version <= 50599) ||
(mysql_version >= 100000 && mysql_version <= 100005))
{
switch (cs_number) {
case 149: return MY_PAGE2_COLLATION_ID_UCS2; // ucs2_crotian_ci
case 213: return MY_PAGE2_COLLATION_ID_UTF8; // utf8_crotian_ci
case 214: return MY_PAGE2_COLLATION_ID_UTF32; // utf32_croatian_ci
case 215: return MY_PAGE2_COLLATION_ID_UTF16; // utf16_croatian_ci
case 245: return MY_PAGE2_COLLATION_ID_UTF8MB4;// utf8mb4_croatian_ci
}
}
return cs_number;
}
/**
Read data from a binary .frm file image into a TABLE_SHARE
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment