summaryrefslogtreecommitdiff
path: root/sql/handler.cc
diff options
context:
space:
mode:
authorVasil Dimov <vasil.dimov@oracle.com>2011-10-25 16:46:38 +0300
committerVasil Dimov <vasil.dimov@oracle.com>2011-10-25 16:46:38 +0300
commitdce337406ea07b4581bf724133d5262fddd365f3 (patch)
treec1d19ab858ba2e467a7359dff5265defbbfb215a /sql/handler.cc
parent11a1a5633a3d61e1faee8b3d5e9da83a443346b8 (diff)
downloadmariadb-git-dce337406ea07b4581bf724133d5262fddd365f3.tar.gz
Fix Bug#12661768 UPDATE IGNORE CRASHES SERVER IF TABLE IS INNODB AND IT IS
PARENT FOR OTHER ONE Do not try to lookup key_nr'th key in 'table' because there may not be such a key there. key_nr is the number of the key in the _child_ table name, not in the parent table. Instead just print the fields of the record that are covered by the first key defined on the parent table. This bug gets a better fix in MySQL 5.6, which is too risky for 5.1 and 5.5. Approved by: Jon Olav Hauglid (via IM)
Diffstat (limited to 'sql/handler.cc')
-rw-r--r--sql/handler.cc8
1 files changed, 7 insertions, 1 deletions
diff --git a/sql/handler.cc b/sql/handler.cc
index 82f5f2ee841..895e7cc4df0 100644
--- a/sql/handler.cc
+++ b/sql/handler.cc
@@ -2692,7 +2692,13 @@ 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);
+ key_unpack(&str,table,0 /* Use 0 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 */);
max_length= (MYSQL_ERRMSG_SIZE-
(uint) strlen(ER(ER_FOREIGN_DUPLICATE_KEY)));
if (str.length() >= max_length)