i have been using the following sql to try and get foreign keys working, the table creation works fine but when i try and delete data from the parent table it deletes as would normally happen in mysql, also the desired results do not happen if i use RESTRICT.
is this a problem to do with indexes???

DROP TABLE IF EXISTS parent;
CREATE TABLE parent(id INT NOT NULL, name char(5), PRIMARY KEY (id)) TYPE=INNODB;
DROP TABLE IF EXISTS child;
CREATE TABLE child(id INT NOT NULL, parent_id INT, INDEX par_ind (parent_id), PRIMARY KEY (id),
FOREIGN KEY (parent_id) REFERENCES parent(id)
ON DELETE RESTRICT
) TYPE=INNODB;

insert into parent(name) values('asdfg');
insert into child(parent_id) values(last_insert_id());


system
os x 10.2.3
mysql 3.23.53-entropy.ch


---------------------------------------------------------------------
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

Reply via email to