Here is an excerpt from http://www.innodb.com/ibman.html#InnoDB_distros,
section 4.2:
"Starting from version 3.23.43b InnoDB features foreign key constraints.
InnoDB is the first MySQL table type which allows you to define foreign key
constraints..."
Now, I assumed the version number above was suspiciously similar to
MySQL one - and since I use 4.0.1, I thought I was OK (I need them
references... ON DELETE and friends would be great, but plain references
save most of the hassle).
After trying to (and failing to) create my own tables, I did tables as
in the example on InnoDB site:
CREATE TABLE parent(id INT NOT NULL, PRIMARY KEY (id)) TYPE=InnoDB;
CREATE TABLE child(id INT, parent_id INT, INDEX par_ind (parent_id),
FOREIGN KEY (parent_id) REFERENCES parent(id)) TYPE=InnoDB;
And what do I see? I see indices in the tables, but no FK! Yes, tables
_are_ InnoDB. I have proper indices - so on to the next step (there was no
error return), just in case - it says:
"Starting from version 3.23.50 InnoDB allows you to add a new foreign key
constraint to a table..."
So, here I go:
ALTER TABLE child ADD CONSTRAINT FOREIGN KEY (parent_id) REFERENCES parent(id);
No error. No effect, either...
So, here comes the big question: What am I doing wrong?
--------------------------------------------------
sql, query
Tomasz Korycki [EMAIL PROTECTED]
---------------------------------------------------------------------
Before posting, please check:
http://www.mysql.com/manual.php (the manual)
http://lists.mysql.com/ (the list archive)
To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php