Hi. Creating the below to tables give errno 150, any idea why?
CREATE TABLE categories (
id int(11) unsigned NOT NULL auto_increment,
name varchar(64) NOT NULL,
PRIMARY KEY (id),
UNIQUE KEY name (name)
) TYPE=InnoDB;
CREATE TABLE types (
id int(11) unsigned NOT NULL auto_increment,
category_id int(11) unsigned NOT NULL,
name varchar(64) NOT NULL,
PRIMARY KEY (id),
FOREIGN KEY (category_id) REFERENCES categories(id)
) TYPE=InnoDB;
Br,
Morten 2 2378
Morten,
please use
SHOW INNODB STATUS;
to print a detailed error explanation.
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
"Morten" <us****@kikobu.com> kirjoitti
viestissä:cq**********@news.cybercity.dk... Hi. Creating the below to tables give errno 150, any idea why?
CREATE TABLE categories ( id int(11) unsigned NOT NULL auto_increment, name varchar(64) NOT NULL, PRIMARY KEY (id), UNIQUE KEY name (name) ) TYPE=InnoDB;
CREATE TABLE types ( id int(11) unsigned NOT NULL auto_increment, category_id int(11) unsigned NOT NULL, name varchar(64) NOT NULL, PRIMARY KEY (id), FOREIGN KEY (category_id) REFERENCES categories(id) ) TYPE=InnoDB;
Br,
Morten
Thanks for the pointer. The issue was a lacking index on the
types.category_id column.
Heikki Tuuri wrote: Morten,
please use
SHOW INNODB STATUS;
to print a detailed error explanation.
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
"Morten" <us****@kikobu.com> kirjoitti viestissä:cq**********@news.cybercity.dk...
Hi. Creating the below to tables give errno 150, any idea why?
CREATE TABLE categories ( id int(11) unsigned NOT NULL auto_increment, name varchar(64) NOT NULL, PRIMARY KEY (id), UNIQUE KEY name (name) ) TYPE=InnoDB;
CREATE TABLE types ( id int(11) unsigned NOT NULL auto_increment, category_id int(11) unsigned NOT NULL, name varchar(64) NOT NULL, PRIMARY KEY (id), FOREIGN KEY (category_id) REFERENCES categories(id) ) TYPE=InnoDB;
Br,
Morten This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Morten Gulbrandsen |
last post by:
Dear MySQL developers,
Could some experienced Database developer please take a look at this ?
It is supposed to be plain SQL2.
How can it be coded under MySQL
Especially all referential...
|
by: Morten Gulbrandsen |
last post by:
Hi Programmers,
after this legal statement
ALTER TABLE EMPLOYEE TYPE =3D InnoDB;
I get=20
Warnings: 0 =20
and still MySQL claims to have to use Type =3D MyISAM,
|
by: Peter Sels |
last post by:
Hello,
I have a simple, but very general problem with MySQL using InnoDB tables.
I am sure you experienced folks can give me a solution...
Using foreign keys I want to delete a row in the...
|
by: Mike Ho |
last post by:
I'm wondering if there is a way to retrieve Foreign Key declaration
information on both MyISAM and InnoDB tables.
Of course, I understand that MyISAM doesn't support Foreign Keys,
however, it...
|
by: Robert Brown |
last post by:
Let's say I have a type hierarchy: (just an example)
the general entity customer:
CREATE TABLE customer(customer_id int, customer_name varchar(250),
customer_type int)
three specific...
|
by: Eddie |
last post by:
I have a MySQL-server running Innodb. We have installed ~ 2GB of
memory in the server. In spite of this MySQL keeps crashing due to
out-of-memory errors. The server is a dual xeon i686 running...
|
by: adammitchell |
last post by:
How can you indicate that a FOREIGN KEY constraint references two
columns in two different tables?
"SQL Server Books Online" show an example of how to reference two
columns in the SAME table:...
|
by: Tibor |
last post by:
I am using PostgreSQL 7.4.1 (only through psql)
I know, that the command
ALTER TABLE OFFICES
DROP PRIMARY KEY (CITY);
and its foreign key equivalent:
ALTER TABLE SALESREPS
DROP CONSTRAINT
|
by: crescent_au |
last post by:
I've read articles and postings about MyISAM vs InnoDB but I am still a
bit unsure about which storage engine to use for my new project.
I am developing a website in PHP/MySQL, which includes...
|
by: taylorcarr |
last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: aa123db |
last post by:
Variable and constants
Use var or let for variables and const fror constants.
Var foo ='bar';
Let foo ='bar';const baz ='bar';
Functions
function $name$ ($parameters$) {
}
...
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
| |