1
0
mirror of https://github.com/MariaDB/server.git synced 2025-08-08 11:22:35 +03:00

Merge with MySQL 5.1.60

This commit is contained in:
Michael Widenius
2011-11-23 19:32:14 +02:00
283 changed files with 11351 additions and 5797 deletions

View File

@@ -2725,7 +2725,23 @@ void handler::print_error(int error, myf errflag)
char key[MAX_KEY_LENGTH];
String str(key,sizeof(key),system_charset_info);
/* Table is opened and defined at this point */
key_unpack(&str,table,(uint) key_nr);
/*
Use primary_key instead of key_nr because key_nr is a key
number in the child FK table, not in our 'table'. See
Bug#12661768 UPDATE IGNORE CRASHES SERVER IF TABLE IS INNODB
AND IT IS PARENT FOR OTHER ONE This bug gets a better fix in
MySQL 5.6, but it is too risky to get that in 5.1 and 5.5
(extending the handler interface and adding new error message
codes)
*/
if (table->s->primary_key < MAX_KEY)
key_unpack(&str,table,table->s->primary_key);
else
{
LEX_CUSTRING tmp= {USTRING_WITH_LEN("Unknown key value")};
str.set((const char*) tmp.str, tmp.length, system_charset_info);
}
max_length= (MYSQL_ERRMSG_SIZE-
(uint) strlen(ER(ER_FOREIGN_DUPLICATE_KEY)));
if (str.length() >= max_length)