Description:
Upgrading from 8.0.20 to 8.0.28 makes tables containing a check constraint calling regexp_like() with parameters of incompatible charsets inaccessible (the table is shown by 'show tables', but it's impossible to select data from the table, repair the table, alter the table, or delete the table).
Besides fixing the bug, please let me know if there is a way to get access to the data (in my real table there is much more columns than listed in "How to repeat" scenario and real data that I would like to restore).
How to repeat:
1. On 8.0.20 create a table
CREATE TABLE `t` (
`custom_prefix` varchar(14) NOT NULL,
CONSTRAINT `ck_t_custom_prefix` CHECK (regexp_like(cast(`custom_prefix` as char charset binary),_utf8mb4'^[a-z0-9-]+$'))
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
2. Upgrade to 8.0.28.
3.
mysql> select * from `t`;
ERROR 3995 (HY000): Character set 'binary' cannot be used in conjunction with 'utf8mb4_0900_ai_ci' in call to regexp_like.
mysql> ALTER TABLE `t` DROP CHECK `ck_t_custom_prefix`;
ERROR 3995 (HY000): Character set 'binary' cannot be used in conjunction with 'utf8mb4_0900_ai_ci' in call to regexp_like.
mysql> show create table `t`;
ERROR 3995 (HY000): Character set 'binary' cannot be used in conjunction with 'utf8mb4_0900_ai_ci' in call to regexp_like.
mysql> drop table `t`;
ERROR 3995 (HY000): Character set 'binary' cannot be used in conjunction with 'utf8mb4_0900_ai_ci' in call to regexp_like.
Suggested fix:
Probably the MySQL server should fail on upgrading DBs with such tables keeping the DBs unchanged.