[MDEV-30238] LOAD DATA REPLACE into ucs2-encoded FK field fails Created: 2022-12-15 Updated: 2023-11-28 |
|
| Status: | Open |
| Project: | MariaDB Server |
| Component/s: | None |
| Affects Version/s: | 10.3, 10.4, 10.5, 10.6, 10.7, 10.8, 10.9, 10.10 |
| Fix Version/s: | 10.4, 10.5, 10.6 |
| Type: | Bug | Priority: | Major |
| Reporter: | Nikita Malyavin | Assignee: | Marko Mäkelä |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Issue Links: |
|
||||||||||||||||||||
| Description |
|
A replace from file of duplicated values into ucs2-encoded referencing field fails:
Expected behavior: no error. Note that if a foreign key is added during CREATE TABLE, LOAD DATA does not fail:
|
| Comments |
| Comment by Nikita Malyavin [ 2022-12-15 ] | ||||||||||||||||||||||||||||||||||||||
|
This issue is found during fixing of MDEV-15990. After i left only one execution branch for system versioning in replace (the one that corresponds to having triggers case), it started failing. Since REPLACE on table with FK added on CREATE works fine, i conclude that the problem is not a file encoding. With trigger actions logged like this:
We'll have a result
The first row is BEFORE INSERT log, the second is BEFORE DELETE. Insert detects duplicate correctly, then Delete, presumably, correctly deletes. After that, Insert is retried and is failed with ER_NO_REFERENCED_ROW_2. So, innodb matched against duplicate correctly, but did incorrectly match against child row. | ||||||||||||||||||||||||||||||||||||||
| Comment by Marko Mäkelä [ 2022-12-21 ] | ||||||||||||||||||||||||||||||||||||||
|
The mention of triggers triggered me to suspect MDEV-12302, but indeed the test case is specific to ucs2 and works fine with utf8mb3. | ||||||||||||||||||||||||||||||||||||||
| Comment by Nikita Malyavin [ 2022-12-21 ] | ||||||||||||||||||||||||||||||||||||||
|
A test case triggered this bug to be created is from |