[MDEV-22230] Unexpected ER_ERROR_ON_RENAME upon DROP non-existing FOREIGN KEY with ALGORITHM=COPY Created: 2020-04-13 Updated: 2023-11-30 Resolved: 2023-11-27 |
|
| Status: | Closed |
| Project: | MariaDB Server |
| Component/s: | Data Definition - Alter Table, Storage Engine - InnoDB |
| Affects Version/s: | 10.1, 10.2, 10.3, 10.4, 10.5, 10.6, 10.9, 10.10, 10.11, 11.0, 11.1 |
| Fix Version/s: | 10.4.33, 10.5.24, 10.6.17, 10.11.7, 11.0.5, 11.1.4, 11.2.3 |
| Type: | Bug | Priority: | Major |
| Reporter: | Elena Stepanova | Assignee: | Thirunarayanan Balathandayuthapani |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | None | ||
| Issue Links: |
|
||||||||||||||||
| Description |
|
Without ALGORITHM=COPY it fails with ER_CANT_DROP_FIELD_OR_KEY as expected. There is an ancient upstream bug https://bugs.mysql.com/bug.php?id=14347 which seems related, but I'm not sure it's quite the same. |
| Comments |
| Comment by Jan Lindström (Inactive) [ 2022-06-20 ] | |||||||||||||||||||||
|
While testing my fix I noticed that DROP CONSTRAINT ..., ALGORITHM=COPY has no effect. If you remove ALGORITHM it works as expected.
| |||||||||||||||||||||
| Comment by Jan Lindström (Inactive) [ 2022-08-05 ] | |||||||||||||||||||||
| Comment by Elena Stepanova [ 2023-07-04 ] | |||||||||||||||||||||
|
Maybe a more convincing test case would be
as it doesn't tamper explicitly with the algorithm and it has "IF EXISTS" for the foreign key drop, so it's a perfectly normal valid ALTER which shouldn't fail. But it does
| |||||||||||||||||||||
| Comment by Marko Mäkelä [ 2023-07-04 ] | |||||||||||||||||||||
|
The FOREIGN KEY handling was refactored in 10.5.0 by | |||||||||||||||||||||
| Comment by Thirunarayanan Balathandayuthapani [ 2023-08-08 ] | |||||||||||||||||||||
|
Needs different patch. So taking over this issue | |||||||||||||||||||||
| Comment by Thirunarayanan Balathandayuthapani [ 2023-11-06 ] | |||||||||||||||||||||
|
Patch is in bb-10.4- | |||||||||||||||||||||
| Comment by Thirunarayanan Balathandayuthapani [ 2023-11-08 ] | |||||||||||||||||||||
| Comment by Marko Mäkelä [ 2023-11-08 ] | |||||||||||||||||||||
|
This needs some more work, including test coverage to ensure that ALTER TABLE some_table DROP FOREIGN KEY IF EXISTS fk_in_another_table will not drop a constraint by that name from another table. |