<?xml version="1.0" encoding="UTF-8"?><!-- generator="wordpress/2.2.2" -->
<rss version="2.0" 
	xmlns:content="http://purl.org/rss/1.0/modules/content/">
<channel>
	<title>Comments on: MySQL&#8217;s ERROR 1025 explained</title>
	<link>http://www.xaprb.com/blog/2006/08/22/mysqls-error-1025-explained/</link>
	<description>Stay curious!</description>
	<pubDate>Fri, 08 Aug 2008 18:58:29 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.2.2</generator>

	<item>
		<title>By: Monalisa</title>
		<link>http://www.xaprb.com/blog/2006/08/22/mysqls-error-1025-explained/#comment-14211</link>
		<author>Monalisa</author>
		<pubDate>Tue, 12 Feb 2008 06:05:50 +0000</pubDate>
		<guid>http://www.xaprb.com/blog/2006/08/22/mysqls-error-1025-explained/#comment-14211</guid>
		<description>Hi All,
Can anybody help me out please?
Can I drop the foreign key and column in separate clauses of one SQL statement?
for example:
ALTER TABLE party 
DROP FOREIGN KEY FK_party_advertiser_id,
DROP COLUMN advertiser_id;

Do help please........
:)</description>
		<content:encoded><![CDATA[<p>Hi All,<br />
Can anybody help me out please?<br />
Can I drop the foreign key and column in separate clauses of one SQL statement?<br />
for example:<br />
ALTER TABLE party<br />
DROP FOREIGN KEY FK_party_advertiser_id,<br />
DROP COLUMN advertiser_id;</p>
<p>Do help please&#8230;&#8230;..<br />
:)</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Fuvito</title>
		<link>http://www.xaprb.com/blog/2006/08/22/mysqls-error-1025-explained/#comment-14184</link>
		<author>Fuvito</author>
		<pubDate>Tue, 22 Jan 2008 20:20:21 +0000</pubDate>
		<guid>http://www.xaprb.com/blog/2006/08/22/mysqls-error-1025-explained/#comment-14184</guid>
		<description>Hi All,

I was having the same problem, I was trying to drop a column,

Thanks to Karuna, after reading his reply I noticed: I was trying to drop the index before dropping the foreign key,

Now it works fine with the following order:

SET FOREIGN_KEY_CHECKS = 0;

ALTER TABLE tableX DROP FOREIGN KEY fkId;

ALTER TABLE tableX DROP INDEX idxId;

ALTER TABLE tableX DROP COLUMN columnX;

SET FOREIGN_KEY_CHECKS = 1;

in my case fkId and idxId were same,

Thanks all,</description>
		<content:encoded><![CDATA[<p>Hi All,</p>
<p>I was having the same problem, I was trying to drop a column,</p>
<p>Thanks to Karuna, after reading his reply I noticed: I was trying to drop the index before dropping the foreign key,</p>
<p>Now it works fine with the following order:</p>
<p>SET FOREIGN_KEY_CHECKS = 0;</p>
<p>ALTER TABLE tableX DROP FOREIGN KEY fkId;</p>
<p>ALTER TABLE tableX DROP INDEX idxId;</p>
<p>ALTER TABLE tableX DROP COLUMN columnX;</p>
<p>SET FOREIGN_KEY_CHECKS = 1;</p>
<p>in my case fkId and idxId were same,</p>
<p>Thanks all,</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Carlos Seo</title>
		<link>http://www.xaprb.com/blog/2006/08/22/mysqls-error-1025-explained/#comment-14125</link>
		<author>Carlos Seo</author>
		<pubDate>Fri, 04 Jan 2008 12:09:29 +0000</pubDate>
		<guid>http://www.xaprb.com/blog/2006/08/22/mysqls-error-1025-explained/#comment-14125</guid>
		<description>A great solution. I was thinking on delete some tables, change the data  column type and create the same tables. I think this is a better solution.</description>
		<content:encoded><![CDATA[<p>A great solution. I was thinking on delete some tables, change the data  column type and create the same tables. I think this is a better solution.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Karuna (kgx)</title>
		<link>http://www.xaprb.com/blog/2006/08/22/mysqls-error-1025-explained/#comment-13438</link>
		<author>Karuna (kgx)</author>
		<pubDate>Mon, 01 Oct 2007 23:19:17 +0000</pubDate>
		<guid>http://www.xaprb.com/blog/2006/08/22/mysqls-error-1025-explained/#comment-13438</guid>
		<description>For those of you still looking for a solution, do this:
&#62; SHOW CREATE TABLE table_name; 

That will show the actual constraint name, which may differ from the column name.

Then simply do something like:
&#62; ALTER TABLE table_name DROP FOREIGN KEY xxx_ibfk_d;

Replace 'xxx_ibfk_d' with the constraint name that you got above.

HTH :)</description>
		<content:encoded><![CDATA[<p>For those of you still looking for a solution, do this:<br />
&gt; SHOW CREATE TABLE table_name; </p>
<p>That will show the actual constraint name, which may differ from the column name.</p>
<p>Then simply do something like:<br />
&gt; ALTER TABLE table_name DROP FOREIGN KEY xxx_ibfk_d;</p>
<p>Replace &#8216;xxx_ibfk_d&#8217; with the constraint name that you got above.</p>
<p>HTH :)</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Xaprb</title>
		<link>http://www.xaprb.com/blog/2006/08/22/mysqls-error-1025-explained/#comment-13405</link>
		<author>Xaprb</author>
		<pubDate>Wed, 19 Sep 2007 21:49:40 +0000</pubDate>
		<guid>http://www.xaprb.com/blog/2006/08/22/mysqls-error-1025-explained/#comment-13405</guid>
		<description>Ah yes, that's another gotcha.  There's also another case where it won't give you more information -- in fact, it won't give you any information -- in SHOW INNODB STATUS.  You can't ALTER either the parent or child table to a different storage engine without first dropping the constraint, which as you point out has to be done by constraint name, not index name.</description>
		<content:encoded><![CDATA[<p>Ah yes, that&#8217;s another gotcha.  There&#8217;s also another case where it won&#8217;t give you more information &#8212; in fact, it won&#8217;t give you any information &#8212; in SHOW INNODB STATUS.  You can&#8217;t ALTER either the parent or child table to a different storage engine without first dropping the constraint, which as you point out has to be done by constraint name, not index name.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Trenton</title>
		<link>http://www.xaprb.com/blog/2006/08/22/mysqls-error-1025-explained/#comment-13404</link>
		<author>Trenton</author>
		<pubDate>Wed, 19 Sep 2007 21:38:37 +0000</pubDate>
		<guid>http://www.xaprb.com/blog/2006/08/22/mysqls-error-1025-explained/#comment-13404</guid>
		<description>I had a variant of this problem when trying to drop a foreign key column. In my scenario, customer is many-to-one with master_customer, and I wanted to remove master_customer.

This bug/thread http://bugs.mysql.com/bug.php?id=14347 has some info. The short of it is:

1) alter table customer drop foreign key customer_ibfk_1;
2) alter table customer drop column master_customer_id;
3) drop table master_customer;

works for me.</description>
		<content:encoded><![CDATA[<p>I had a variant of this problem when trying to drop a foreign key column. In my scenario, customer is many-to-one with master_customer, and I wanted to remove master_customer.</p>
<p>This bug/thread <a href="http://bugs.mysql.com/bug.php?id=14347" rel="nofollow">http://bugs.mysql.com/bug.php?id=14347</a> has some info. The short of it is:</p>
<p>1) alter table customer drop foreign key customer_ibfk_1;<br />
2) alter table customer drop column master_customer_id;<br />
3) drop table master_customer;</p>
<p>works for me.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: nimrod-</title>
		<link>http://www.xaprb.com/blog/2006/08/22/mysqls-error-1025-explained/#comment-12500</link>
		<author>nimrod-</author>
		<pubDate>Mon, 23 Jul 2007 22:45:58 +0000</pubDate>
		<guid>http://www.xaprb.com/blog/2006/08/22/mysqls-error-1025-explained/#comment-12500</guid>
		<description>i solved this problem by doing it at hand, it is, with other name i create a copy of the table that doesn't have the definition of the foreign key, then copy all the data in this new table, then delete the old table, and so i couldn't find a way to rename the new table, create again a table with the original name and place the data in the correct one. then delete the temporal table</description>
		<content:encoded><![CDATA[<p>i solved this problem by doing it at hand, it is, with other name i create a copy of the table that doesn&#8217;t have the definition of the foreign key, then copy all the data in this new table, then delete the old table, and so i couldn&#8217;t find a way to rename the new table, create again a table with the original name and place the data in the correct one. then delete the temporal table</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Xaprb</title>
		<link>http://www.xaprb.com/blog/2006/08/22/mysqls-error-1025-explained/#comment-12362</link>
		<author>Xaprb</author>
		<pubDate>Tue, 17 Jul 2007 01:50:11 +0000</pubDate>
		<guid>http://www.xaprb.com/blog/2006/08/22/mysqls-error-1025-explained/#comment-12362</guid>
		<description>I'm not sure what Anon meant.  If it was a comment about a GUI program, I'm not the one to ask; I do everything from the command-line.</description>
		<content:encoded><![CDATA[<p>I&#8217;m not sure what Anon meant.  If it was a comment about a GUI program, I&#8217;m not the one to ask; I do everything from the command-line.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Rohitesh</title>
		<link>http://www.xaprb.com/blog/2006/08/22/mysqls-error-1025-explained/#comment-12361</link>
		<author>Rohitesh</author>
		<pubDate>Mon, 16 Jul 2007 18:50:19 +0000</pubDate>
		<guid>http://www.xaprb.com/blog/2006/08/22/mysqls-error-1025-explained/#comment-12361</guid>
		<description>Anon's comment helped. Is this a bug???

Cheers,
Rohitesh.</description>
		<content:encoded><![CDATA[<p>Anon&#8217;s comment helped. Is this a bug???</p>
<p>Cheers,<br />
Rohitesh.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Alnoor</title>
		<link>http://www.xaprb.com/blog/2006/08/22/mysqls-error-1025-explained/#comment-8459</link>
		<author>Alnoor</author>
		<pubDate>Wed, 23 May 2007 18:00:14 +0000</pubDate>
		<guid>http://www.xaprb.com/blog/2006/08/22/mysqls-error-1025-explained/#comment-8459</guid>
		<description>Very Very Informative!</description>
		<content:encoded><![CDATA[<p>Very Very Informative!</p>
]]></content:encoded>
	</item>
</channel>
</rss>
