With ALGORITHM=COPY, changing the data type of a virtual column will cause each value to be validated. ALTER IGNORE TABLE would issue warnings for any invalid values, and without IGNORE the operation would be aborted.
The type compatibility aspect of virtual columns is similar to constraints. By default, ADD CONSTRAINT requires validation as well, both for CHECK and FOREIGN KEY. Currently this validation is only performed by ALGORITHM=COPY; it would be much more efficient to perform the validation only (scan the table) and then change the metadata instantly.
Theoretically, we could skip the validation if the type of the virtual column is changed to a more permissive one, or if NOT NULL is being added and the virtual column expression never returns NULL. But even in this case, it could be that the virtual column was inconsistently created (with ALTER IGNORE) earlier, and also the altered virtual column would fail validation.
For more efficient algorithms, ALGORITHM=COPY is the specification that dictates what should be done. If ALTER IGNORE…ALGORITHM=COPY is issuing warnings for incompatible values, then it looks like we should not support instant operation (without validation) even with the IGNORE clause. We might want a separate WITHOUT VALIDATION clause.
With ALGORITHM=COPY, changing the data type of a virtual column will cause each value to be validated. ALTER IGNORE TABLE would issue warnings for any invalid values, and without IGNORE the operation would be aborted.
The type compatibility aspect of virtual columns is similar to constraints. By default, ADD CONSTRAINT requires validation as well, both for CHECK and FOREIGN KEY. Currently this validation is only performed by ALGORITHM=COPY; it would be much more efficient to perform the validation only (scan the table) and then change the metadata instantly.
Theoretically, we could skip the validation if the type of the virtual column is changed to a more permissive one, or if NOT NULL is being added and the virtual column expression never returns NULL. But even in this case, it could be that the virtual column was inconsistently created (with ALTER IGNORE) earlier, and also the altered virtual column would fail validation.
For more efficient algorithms, ALGORITHM=COPY is the specification that dictates what should be done. If ALTER IGNORE…ALGORITHM=COPY is issuing warnings for incompatible values, then it looks like we should not support instant operation (without validation) even with the IGNORE clause. We might want a separate WITHOUT VALIDATION clause.