"Deepak Vishwanathan" <[EMAIL PROTECTED]> wrote: > I have a table named t1 with a column x1 which is the primary key for > that table. There are some other tables that reference this table t1 on > x1 with foreign key constraints. > > > > I wanted to rename the column x1 for some reason, so, I went ahead and > renamed the column x1 to y1. I was able to change it successfully. Then, > I wanted to rename the foreign key's column name from x1 to y1 in all > referencing tables and I got the error ERROR 1025: Error on rename of > './Test/t1' to './Test/#sql2-3c90-4bd' (errno: 121). > > So, then, I tried dropping the foreign key constraints on the > referencing tables with alter table command with the foreign key value > that I got from show create table command for those referencing > tables...But, the system won't allow me to do that. > > > I understand this problem is because of the foreign key > constraints....Does that mean, I should have dropped the foreign key > constraint in referencing tables before I renamed the column x1 to y1 in > the base table t1???
Yes, you should drop foreign key constraint first. -- For technical support contracts, goto https://order.mysql.com/?ref=ensita This email is sponsored by Ensita.net http://www.ensita.net/ __ ___ ___ ____ __ / |/ /_ __/ __/ __ \/ / Victoria Reznichenko / /|_/ / // /\ \/ /_/ / /__ [EMAIL PROTECTED] /_/ /_/\_, /___/\___\_\___/ MySQL AB / Ensita.net <___/ www.mysql.com -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]