<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: MySQL (errno: 150)</title>
	<atom:link href="http://www.danieltome.com/blog/2008/01/17/mysql-errno-150/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.danieltome.com/blog/2008/01/17/mysql-errno-150/</link>
	<description>Flash, PHP, Open Source, Actionscript, Australia and Argentina stuff.</description>
	<lastBuildDate>Tue, 14 Dec 2010 16:25:51 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.4</generator>
	<item>
		<title>By: CMR</title>
		<link>http://www.danieltome.com/blog/2008/01/17/mysql-errno-150/comment-page-1/#comment-50176</link>
		<dc:creator>CMR</dc:creator>
		<pubDate>Sun, 05 Feb 2012 02:25:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.danieltome.com/blog/2008/01/17/mysql-errno-150/#comment-50176</guid>
		<description>I recently ran into this error when trying to create tables through mysql workbench&#039;s outputted script.  

Specifically, the primary key table had a compound primary key (product_id, vendor_id), and the child table had both of these as well, but for some reason MySql Workbench kept outputting the key sequence in the wrong order - (vendor_id, product_id) instead of (product_id, vendor_id).  The key sequence must match the order of the primary key index on the parent table.

A quick edit of the script and it works, but I&#039;m kind of mad at MySQL workbench right now...</description>
		<content:encoded><![CDATA[<p>I recently ran into this error when trying to create tables through mysql workbench&#8217;s outputted script.  </p>
<p>Specifically, the primary key table had a compound primary key (product_id, vendor_id), and the child table had both of these as well, but for some reason MySql Workbench kept outputting the key sequence in the wrong order &#8211; (vendor_id, product_id) instead of (product_id, vendor_id).  The key sequence must match the order of the primary key index on the parent table.</p>
<p>A quick edit of the script and it works, but I&#8217;m kind of mad at MySQL workbench right now&#8230;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Chris</title>
		<link>http://www.danieltome.com/blog/2008/01/17/mysql-errno-150/comment-page-1/#comment-47794</link>
		<dc:creator>Chris</dc:creator>
		<pubDate>Sun, 05 Feb 2012 03:41:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.danieltome.com/blog/2008/01/17/mysql-errno-150/#comment-47794</guid>
		<description>I&#039;m so glad I found this blog. I&#039;m taking a course in mySQL and ran up against this error. Googled it, came here and problem solved. Thanks! No doubt, I&#039;ll be back.</description>
		<content:encoded><![CDATA[<p>I&#8217;m so glad I found this blog. I&#8217;m taking a course in mySQL and ran up against this error. Googled it, came here and problem solved. Thanks! No doubt, I&#8217;ll be back.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Piers</title>
		<link>http://www.danieltome.com/blog/2008/01/17/mysql-errno-150/comment-page-1/#comment-45202</link>
		<dc:creator>Piers</dc:creator>
		<pubDate>Sun, 05 Feb 2012 16:41:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.danieltome.com/blog/2008/01/17/mysql-errno-150/#comment-45202</guid>
		<description>Bah! thanks for the tip... saved my sanity :)</description>
		<content:encoded><![CDATA[<p>Bah! thanks for the tip&#8230; saved my sanity <img src='http://www.danieltome.com/blog/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Confuzed</title>
		<link>http://www.danieltome.com/blog/2008/01/17/mysql-errno-150/comment-page-1/#comment-41832</link>
		<dc:creator>Confuzed</dc:creator>
		<pubDate>Sun, 05 Feb 2012 01:43:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.danieltome.com/blog/2008/01/17/mysql-errno-150/#comment-41832</guid>
		<description>Andreas: it did. :)</description>
		<content:encoded><![CDATA[<p>Andreas: it did. <img src='http://www.danieltome.com/blog/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Andreas</title>
		<link>http://www.danieltome.com/blog/2008/01/17/mysql-errno-150/comment-page-1/#comment-41471</link>
		<dc:creator>Andreas</dc:creator>
		<pubDate>Sun, 05 Feb 2012 19:13:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.danieltome.com/blog/2008/01/17/mysql-errno-150/#comment-41471</guid>
		<description>Even though this is an old post, I would also like to add that I had the same error. My solution was that I changed the table to MyISAM instead of previously set innoDB. 

I have a slight memory that I&#039;ve read that innoDB dosen&#039;t support FK. Anyways, hope that this help someone!</description>
		<content:encoded><![CDATA[<p>Even though this is an old post, I would also like to add that I had the same error. My solution was that I changed the table to MyISAM instead of previously set innoDB. </p>
<p>I have a slight memory that I&#8217;ve read that innoDB dosen&#8217;t support FK. Anyways, hope that this help someone!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Giannis</title>
		<link>http://www.danieltome.com/blog/2008/01/17/mysql-errno-150/comment-page-1/#comment-40980</link>
		<dc:creator>Giannis</dc:creator>
		<pubDate>Sun, 05 Feb 2012 06:26:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.danieltome.com/blog/2008/01/17/mysql-errno-150/#comment-40980</guid>
		<description>Thanks!
that was really helpfull!</description>
		<content:encoded><![CDATA[<p>Thanks!<br />
that was really helpfull!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Liam O'Boyle</title>
		<link>http://www.danieltome.com/blog/2008/01/17/mysql-errno-150/comment-page-1/#comment-27503</link>
		<dc:creator>Liam O'Boyle</dc:creator>
		<pubDate>Sun, 05 Feb 2012 14:29:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.danieltome.com/blog/2008/01/17/mysql-errno-150/#comment-27503</guid>
		<description>I found another case where the same error occurs.  If the foreign key is not nullable, then this error is thrown if you try to set the foreign key constraint to ON DELETE SET NULL.

e.g, using the above example

ALTER TABLE vik_energy MODIFY COLUMN energy_id energy_id INT NOT NULL;

ALTER TABLE vik ADD FOREIGN KEY(energy_id) REFERENCES vik_energy(energy_id) ON DELETE SET NOT NULL;</description>
		<content:encoded><![CDATA[<p>I found another case where the same error occurs.  If the foreign key is not nullable, then this error is thrown if you try to set the foreign key constraint to ON DELETE SET NULL.</p>
<p>e.g, using the above example</p>
<p>ALTER TABLE vik_energy MODIFY COLUMN energy_id energy_id INT NOT NULL;</p>
<p>ALTER TABLE vik ADD FOREIGN KEY(energy_id) REFERENCES vik_energy(energy_id) ON DELETE SET NOT NULL;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: D Miller</title>
		<link>http://www.danieltome.com/blog/2008/01/17/mysql-errno-150/comment-page-1/#comment-20247</link>
		<dc:creator>D Miller</dc:creator>
		<pubDate>Sun, 05 Feb 2012 06:42:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.danieltome.com/blog/2008/01/17/mysql-errno-150/#comment-20247</guid>
		<description>Thanks!!</description>
		<content:encoded><![CDATA[<p>Thanks!!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: myyellowshoe</title>
		<link>http://www.danieltome.com/blog/2008/01/17/mysql-errno-150/comment-page-1/#comment-10893</link>
		<dc:creator>myyellowshoe</dc:creator>
		<pubDate>Sun, 05 Feb 2012 04:46:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.danieltome.com/blog/2008/01/17/mysql-errno-150/#comment-10893</guid>
		<description>Hey there,
Thanks for the clear write up on this issue, though I might have found yet another caveat. Take a gander.
This code will run up untill I ad the foreign key. Funny part is, it was working like yesterday. Which I added an on cascade delete, though it is removed in this.
Gotta love sql! :D


CREATE TABLE vik (
		vik_id INT NOT NULL AUTO_INCREMENT,
		nid INT NOT NULL,
		description BLOB,
		PRIMARY KEY(vik_id),	
			energy_id INT	
		)ENGINE = INNODB;

		CREATE TABLE vik_energy(
			vik_id INT,
			energy_id INT,
			FOREIGN KEY(vik_id) REFERENCES vik(vik_id)
			
		)ENGINE=INNODB;

ALTER TABLE vik ADD FOREIGN KEY(energy_id) REFERENCES vik_energy(energy_id);</description>
		<content:encoded><![CDATA[<p>Hey there,<br />
Thanks for the clear write up on this issue, though I might have found yet another caveat. Take a gander.<br />
This code will run up untill I ad the foreign key. Funny part is, it was working like yesterday. Which I added an on cascade delete, though it is removed in this.<br />
Gotta love sql! <img src='http://www.danieltome.com/blog/wp-includes/images/smilies/icon_biggrin.gif' alt=':D' class='wp-smiley' /> </p>
<p>CREATE TABLE vik (<br />
		vik_id INT NOT NULL AUTO_INCREMENT,<br />
		nid INT NOT NULL,<br />
		description BLOB,<br />
		PRIMARY KEY(vik_id),<br />
			energy_id INT<br />
		)ENGINE = INNODB;</p>
<p>		CREATE TABLE vik_energy(<br />
			vik_id INT,<br />
			energy_id INT,<br />
			FOREIGN KEY(vik_id) REFERENCES vik(vik_id)</p>
<p>		)ENGINE=INNODB;</p>
<p>ALTER TABLE vik ADD FOREIGN KEY(energy_id) REFERENCES vik_energy(energy_id);</p>
]]></content:encoded>
	</item>
</channel>
</rss>

