| Bug #10409 | ON UPDATE CASCADE does not enforce maximum length of UTF-8 data | ||
|---|---|---|---|
| Submitted: | 6 May 2005 11:47 | Modified: | 4 Jul 2005 10:17 |
| Reporter: | Marko Mäkelä | Email Updates: | |
| Status: | Closed | Impact on me: | |
| Category: | MySQL Server: InnoDB storage engine | Severity: | S3 (Non-critical) |
| Version: | 5.0.6-bk | OS: | Any (all) |
| Assigned to: | Marko Mäkelä | CPU Architecture: | Any |
[1 Jul 2005 21:51]
Heikki Tuuri
Marko, please look at this. --Heikki
[4 Jul 2005 10:17]
Marko Mäkelä
This bug was closed in 5.0.8 in the same changeset with Bug #10511, if I remember correctly. Only the status of Bug #10511 was updated automatically. I'm sorry for not checking this manually.

Description: The part of InnoDB that implements ON UPDATE CASCADE in 5.0 checks the maximum length of UTF-8 columns in terms of bytes, not characters. Thus, for ROW_FORMAT=COMPACT tables, it may write longer strings than those that can be written by INSERT or UPDATE. How to repeat: create table parent(a char(5) primary key) engine=innodb charset=utf8; create table child(a varchar(4) primary key,constraint c foreign key(a)references parent(a) on update cascade) engine=innodb charset=utf8; insert into parent values ('abc'),('def'),('gh'); insert into child values ('abc'),('def'); update parent set a='bcdef' where a='def'; -- the child table will incorrectly be updated to 'bcdef' Suggested fix: Check the updated length of the column in characters rather than bytes when a variable-length character set (such as UTF-8) is being used.