[MDEV-18114] Foreign Key Constraint actions don't affect Virtual Column Created: 2018-12-31 Updated: 2023-11-10 Resolved: 2023-08-02 |
|
| Status: | Closed |
| Project: | MariaDB Server |
| Component/s: | Storage Engine - InnoDB, Virtual Columns |
| Affects Version/s: | 10.0, 10.1, 10.3.11, 10.2, 10.3, 10.4 |
| Fix Version/s: | 10.5.22, 10.6.15, 10.9.8, 10.10.6, 10.11.5, 11.0.3, 11.1.2 |
| Type: | Bug | Priority: | Critical |
| Reporter: | Aurelien Marchand | Assignee: | Elena Stepanova |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | None | ||
| Environment: |
CentOS 7 |
||
| Issue Links: |
|
||||||||||||||||||||||||||||||||||||||||||||||||||||
| Description |
|
One of my tables has several columns with FK ON DELETE SET NULL constraints on them, plus one virtual column with mildly complex expression based on these FK columns. When a DELETE is issued on the foreign table, the FK fields get set to NULL but the STORED Virtual column is not updated. There is no trace of this behaviour on the documentation. |
| Comments |
| Comment by Aurelien Marchand [ 2018-12-31 ] | ||||||||||||||||||||
|
| ||||||||||||||||||||
| Comment by Elena Stepanova [ 2019-01-23 ] | ||||||||||||||||||||
|
Thanks for the report, reproducible as described. MySQL 5.7 rejects the attempt to create a table with a foreign key (with a cascade action) defined on a base column of a virtual column, even though I can't find this particular limitation in MySQL manual. MySQL 8.0 rejects this CREATE TABLE as well, although it's less verbose about the reason. | ||||||||||||||||||||
| Comment by Sergei Golubchik [ 2023-07-13 ] | ||||||||||||||||||||
|
please, review these five commits:
as usual "cleanup" means "internal code rearrangement, no user visible effects" | ||||||||||||||||||||
| Comment by Nikita Malyavin [ 2023-08-02 ] | ||||||||||||||||||||
|
The fix looks correct and exhaustive. Ok to push after the minor issues are resolved |