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 > order of tables in DDL statement

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 03-25-09, 16:12
rbfree rbfree is offline
Registered User
 
Join Date: Feb 2009
Posts: 104
order of tables in DDL statement

Am I correct that a parent table must precede a child table (in a DDL statement) or get a errno150?

That's my conclusion after several rounds of isolate and substitute.

BTW -- I had no problems (no errno 150) with a child table preceding a parent when building MyISAM tables. Is that because ref. integrity isn't forced with the MyISAM engine, or because something else was different?
__________________
In theory, there is no difference between theory and practice. In practice there is.
Disputed Origins

Ninety-three percent of all statistics are made-up on the spot.
Ancient proverb.
Reply With Quote
  #2 (permalink)  
Old 03-25-09, 16:16
r937 r937 is offline
SQL Consultant
 
Join Date: Apr 2002
Location: Toronto, Canada
Posts: 19,534
you understand the situation perfectly

a foreign key cannot reference a primary/unique key if that key has not yet been defined
__________________
r937.com | rudy.ca
please visit Simply SQL and buy my book
Reply With Quote
  #3 (permalink)  
Old 03-25-09, 19:46
guelphdad guelphdad is offline
Registered User
 
Join Date: Mar 2004
Posts: 440
and to answer your other question, since myisam tables don't enforce referential integrity you won't run into the same problem with them that you do with innodb ones.
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