Hi,

 

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???

 

Is there a way that I can solve the problem without dropping those
tables and creating them again??

 

Thanks

Deepak

Reply via email to