Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

ERROR 1005: Can't create table './MRI/test.frm' (errno: 150

Status
Not open for further replies.

aarushi2001

Technical User
Nov 16, 2005
109
US
Hi,

I am getting the above error. I have created 2 tables:

categories: id, code varchar(50) not null, name, primary key (code)) type=InnoDB;

quest: id, code varchar(50) not null, name, primary key (code), index (code), foreign key (code) references categories (code)) type=InnoDB;

When I try n create ques table, it gives me an error. Can someone please help me?

Thanks
 
Post the entire error message into the body of a message. Posting error messages into subject lines is useless -- the site, as has happened here, truncates subject lines.


Without seeing the error message, it's difficult to diagnose. But I'd bet that the problem is related to the fact that you're trying to make the column "code" a primary key while simultaneously trying to make it constrained by a foreign key.

Want the best answers? Ask the best questions!

TANSTAAFL!!
 
the error was:
ERROR 1005: Can't create table './test/customer_sales.frm' (errno: 150)

checked out MySQL manual.. says: foreign key doesnot support blob and text..

about primary key and calling it as a foreign key, that is not wrong.. you can check out:
 
aarushi2001:
I have checked out your article. Where does it say or imply anywhere that a column can both be a primary key and be constrained by a foreign key? In all that artible, every table has one column that is the primary key and another that is contrainted by a foreing key.

Want the best answers? Ask the best questions!

TANSTAAFL!!
 
I misread your first post.

I was referring to a primary key of one table and being referenced.

thanks
 
I am concerned about your description of your table:

aarushi2001 said:
primary key (code), index (code), foreign key (code) references categories (code))
From which I infer that you intend the column "code" in the table "quest" be both a primary key and constrained by a foreign key. This troubles me.



Want the best answers? Ask the best questions!

TANSTAAFL!!
 
ya I know u were referring to quest. In your first post when u had used 'code' I by mistake took it for categories (otherwise I wudnt have forwarded that article).

But problem solved. Thanks :)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top