Bug #119598 ALTER TABLE will report Deadlock found ... when do a RENAME to itself and ENABLE KEYS.
Submitted: 26 Dec 2025 6:46
Reporter: Ceit Zhang Email Updates:
Status: Open Impact on me:
None 
Category:MySQL Server: DDL Severity:S3 (Non-critical)
Version: OS:Any
Assigned to: CPU Architecture:Any

[26 Dec 2025 6:46] Ceit Zhang
Description:
When executing ALTER TABLE ... RENAME TO <same_name>, ENABLE KEYS on a table that is referenced by a view, MySQL reports a deadlock error: Deadlock found when trying to get lock; try restarting transaction.If renaming to a different table name or executing without the ENABLE KEYS clause, the issue does not occur.

How to repeat:
create table t1(pk int, data int, key di(data));
create view v1 as select * from t1;
alter table t1 rename to t1, enable keys;