Is there a way to disable custom table checks in MySQL?
Table checks were previously silently ignored by MySQL, since version 8.0.16 they are implemented and enforced, but it seems that there is no way to turn them globaly.
MySQL has only FOREIGN_KEY_CHECKS and UNIQUE_CHECKS variables, which are specific, there is nothing for check constraints.
My principal issue is that I need to add a check on big table. If this happens with a foreign key check, one can use the FOREIGN_KEY_CHECK variable together with ALTER_TABLE and INPLACE algorihtm:
SET FOREIGN_KEY_CHECKS = 0;
ALTER TABLE my_table
ADD CONSTRAINT my_table_constraint FOREIGN KEY (...) REFERENCES other_table, ALGORITHM=INPLACE
SET FOREIGN_KEY_CHECKS = 1;
Now because it seems that there is nothing to turn off checks globaly, there is no way to use the INPLACE algorithm with check constraint, the following will fail:
ALTER TABLE my_big_table
ADD CONSTRAINT only_some_numbers
CHECK (column_one >= 100 AND column_one <= 300), ALGORITHM=INPLACE;
It seems that MariaDB has a variable to allow this: https://mariadb.com/kb/en/server-system-variables/#check_constraint_checks
I did not find anything in MySQL documentation. Is there a different way to achieve such inplace addition of new check constraint?