Deepak,

I tested this, and MySQL refused to rename the column in either the parent
table or the child table. I do not understand how you have been able to
rename the column x1 to to y1 in the parent table.

Can you make a simple, repeatable test case where the renaming in the parent
table succeeds?

Best regards,

Heikki Tuuri
Innobase Oy
Foreign keys, transactions, and row level locking for MySQL
InnoDB Hot Backup - a hot backup tool for InnoDB which also backs up MyISAM
tables
http://www.innodb.com/order.php

Order MySQL technical support from https://order.mysql.com/

----- Original Message ----- 
From: "Victoria Reznichenko" <[EMAIL PROTECTED]>
Newsgroups: mailing.database.myodbc
Sent: Wednesday, May 12, 2004 4:30 PM
Subject: Re: Foreign Key Renaming Problem


> "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]
>


-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to