If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > MySQL > self-referential in innodb?

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 10-18-03, 09:46
zingers zingers is offline
Registered User
 
Join Date: Oct 2003
Posts: 1
self-referential in innodb?

Hi,i'm a newbie about innodb,
i read the manual and found 'self-referential'...
i guess i can create a table with two refenced column and then is 'on delete
cascade',so i run the next sql in mysql4.0.15(mysqld-max-nt --console)
the code is:

#--------------test sql code1---------------------------
CREATE TABLE TESTFOREIGN
(
someid INT,
parentid INT,
PRIMARY KEY(someid),
INDEX bull (someid),
CONSTRAINT sym FOREIGN KEY (parentid)
REFERENCES TESTFOREIGN(someid)
ON DELETE CASCADE
) type=innodb
#-------------test sql code1---------------------------

i receive:
Error 1005:Cant' create table **TESTFOREIGN.frm (errno:150)






even i edit the sql as

#-------------test sql code2---------------------------
CREATE TABLE TESTFOREIGN
(
someid INT,
parentid INT,
PRIMARY KEY(someid,parentid),
FOREIGN KEY (parentid)
REFERENCES TESTFOREIGN(someid)
) type=innodb
#-------------test sql code2---------------------------

i got the same unsuceed information


now someone can help me?
thx anyway.
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On