[MDEV-32003] MODIFY COLUMN no longer possible with Foreign Key Constraints Created: 2023-08-24 Updated: 2023-08-30 Resolved: 2023-08-30 |
|
| Status: | Closed |
| Project: | MariaDB Server |
| Component/s: | Storage Engine - InnoDB |
| Affects Version/s: | 10.11.5 |
| Fix Version/s: | N/A |
| Type: | Bug | Priority: | Major |
| Reporter: | KrZipfel | Assignee: | Unassigned |
| Resolution: | Won't Fix | Votes: | 1 |
| Labels: | None | ||
| Issue Links: |
|
||||||||||||||||
| Description |
|
Starting with MariaDB version 10.11.5 modifying the column type of a foreign key in the referenced table leads to an error. Consider the following example: MariaDB [(none)]> DROP DATABASE IF EXISTS playground; MariaDB [playground]> CREATE TABLE table1 (my_id VARCHAR(20), PRIMARY KEY (my_id)); MariaDB [playground]> ALTER TABLE table1 MODIFY my_id VARCHAR(25); This used to work with MariaDB 10.11.4 without the error. It also works in MySQL 5.7. |
| Comments |
| Comment by KrZipfel [ 2023-08-24 ] |
|
Maybe it relates to |
| Comment by Marko Mäkelä [ 2023-08-30 ] |
|
Yes, this is an intentional change due to |
| Comment by Marko Mäkelä [ 2023-08-30 ] |
|
|
| Comment by Marko Mäkelä [ 2023-08-30 ] |
|
The ALTER TABLE statement in the Description would leave the database in an inconsistent state. Because MariaDB (or MySQL 5.7) cannot execute multiple ALTER TABLE statements atomically, the character set cannot be changed in both a parent and a child tables with just 2 ALTER TABLE statements. At least 3 statements will be needed to avoid committing an inconsistent schema, like I explained in |