Details
-
Bug
-
Status: Closed (View Workflow)
-
Major
-
Resolution: Won't Fix
-
10.11.5
-
None
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 [(none)]> CREATE DATABASE playground;
MariaDB [(none)]> USE playground;
MariaDB [playground]> CREATE TABLE table1 (my_id VARCHAR(20), PRIMARY KEY (my_id));
MariaDB [playground]> CREATE TABLE table2 (your_id VARCHAR(20), FOREIGN KEY (your_id) REFERENCES table1(my_id));
MariaDB [playground]> ALTER TABLE table1 MODIFY my_id VARCHAR(25);
ERROR 1833 (HY000): Cannot change column 'my_id': used in a foreign key constraint 'playground/table2_ibfk_1' of table 'playground/table2'
This used to work with MariaDB 10.11.4 without the error. It also works in MySQL 5.7.
Is this an intended change to protect the foreign key relation? This impacts our existing database migration scripts, which no longer work as before.
Attachments
Issue Links
- duplicates
-
MDEV-31987 Cannot disable FOREIGN_KEY_CHECKS anymore for converting character set
- Closed
- is caused by
-
MDEV-31086 MODIFY COLUMN can break FK constraints, and lead to unrestorable dumps
- Closed