[MDEV-32171] When updating cascaded foreign keys, closing foreign key constraints is ignored and invalid. Created: 2023-09-14 Updated: 2023-12-11 Resolved: 2023-12-11 |
|
| Status: | Closed |
| Project: | MariaDB Server |
| Component/s: | Data Definition - Alter Table, Storage Engine - InnoDB |
| Affects Version/s: | 11.1.2 |
| Fix Version/s: | N/A |
| Type: | Bug | Priority: | Major |
| Reporter: | Runzi | Assignee: | Unassigned |
| Resolution: | Not a Bug | Votes: | 0 |
| Labels: | foreign-keys | ||
| Environment: |
Docker containers with mariadb-galera-cluster |
||
| Issue Links: |
|
||||||||||||||||
| Description |
|
table1:
table2
Update:
|
| Comments |
| Comment by Runzi [ 2023-09-14 ] |
|
I am not sure whether this is expected or a bug. maybe my approach is incorrect? |
| Comment by Marko Mäkelä [ 2023-09-15 ] |
|
In
The benefit of using foreign_key_checks=off while doing this is that that the constraint can be added instantly, without any validation. Currently (until MDEV-16356 is fixed), the validation involves an unnecessary table rebuild. |
| Comment by Runzi [ 2023-09-19 ] |
|
thanks, therefore, when foreign_key_checks=OFF is used, only the check of add/del foreign key constraint is ignored, instead of the check of modification or update. If I need to update, I can only implement it by deleting/adding logic, right? |
| Comment by Marko Mäkelä [ 2023-09-21 ] |
|
I do not foresee any changes to this logic in the near term. Implementing transactional DDL (so that the 2 ALTER TABLE could be executed as one atomic unit) would be a huge undertaking and could be years ahead. |
| Comment by Runzi [ 2023-09-25 ] |
|
I see, thank you for your reply |