Bug #92727 | Swapping column by ALTER TABLE RENAME COLUMN breaks STORED generated column | ||
---|---|---|---|
Submitted: | 10 Oct 2018 6:48 | Modified: | 17 Apr 2019 18:04 |
Reporter: | Tsubasa Tanaka (OCA) | Email Updates: | |
Status: | Closed | Impact on me: | |
Category: | MySQL Server: DDL | Severity: | S3 (Non-critical) |
Version: | 8.0.12 | OS: | CentOS (7.5) |
Assigned to: | CPU Architecture: | x86 |
[10 Oct 2018 6:48]
Tsubasa Tanaka
[10 Oct 2018 7:04]
MySQL Verification Team
Hello Tanaka-San, Thank you for the report and test case. regards, Umesh
[10 Oct 2018 7:16]
Tsubasa Tanaka
mtr (*) I confirm the code being submitted is offered under the terms of the OCA, and that I am authorized to contribute it.
Contribution: bug92727.test (application/octet-stream, text), 356 bytes.
[10 Oct 2018 7:16]
Tsubasa Tanaka
mtr result (*) I confirm the code being submitted is offered under the terms of the OCA, and that I am authorized to contribute it.
Contribution: bug92727.result (application/octet-stream, text), 280 bytes.
[10 Oct 2018 7:17]
Tsubasa Tanaka
Workaround is executing `OPTIMIZE TABLE` and generated column is re-calculated.
[17 Apr 2019 18:03]
Paul DuBois
Posted by developer: Fixed in 8.0.17. Stored generated column values and indexes on virtual generated columns were not correctly updated after columns on which these generated columns depended were swapped using ALTER TABLE with RENAME COLUMN or CHANGE COLUMN. Renaming of base columns for generated columns, generated defaults, and functional indexes is now prohibited unless the same ALTER TABLE statement satisfies one of these conditions: * The statement removes the generated column, generated default, or functional index. * The statement updates the dependent expression in question. This enables supporting existing scenarios in which generation expressions are updated to follow base column renaming. Restrictions on dropping columns on which generated columns, generated defaults, or functional indexes depend were relaxed in a similar way.